function sendForm(pForm){
	var l=pForm.length;
	var ok=true;

	var cb1 = document.getElementById("pdt").checked; // translation
	var cb2 = document.getElementById("pddtp").checked; //dtp
	var cb3 = document.getElementById("pdtt").checked; //Tape
	var cb4 = document.getElementById("pdvo").checked; //voiceover
	var cb5 = document.getElementById("pdi").checked; //Interpretation
	var cb6 = document.getElementById("pde").checked; //Editing
	var cb7 = document.getElementById("pdcc").checked; //cultural

	var cb = cb1 || cb2 || cb3 || cb4 || cb5 || cb6 || cb7;
	if (!cb) {
		ok = false;
		alert ("You must select at least one Service!");

	} else {
		if (cb1){
			document.getElementById("srtp").setAttribute("checkfor", "Empty|msg:You must complete the Translation rate p/word!");
			document.getElementById("srtpm").setAttribute("checkfor", "Empty|msg:You must complete the Translation rate min. fee!");

		} else if (cb5){
			document.getElementById("toi").setAttribute("checkfor", "Empty|msg:You must complete the Type of Interpreting field!");
			document.getElementById("sric").setAttribute("checkfor", "Empty|msg:You must complete the Interpretation-Consecutive rate p/word!");
			document.getElementById("sric").setAttribute("checkfor", "Empty|msg:You must complete the Interpretation-Simultaneous rate p/word!");
			document.getElementById("sris").setAttribute("checkfor", "Empty|msg:You must complete the Interpretation-Consecutive rate min. fee!");
			document.getElementById("srism").setAttribute("checkfor", "Empty|msg:You must complete the Interpretation-Simultaneous rate min. fee!");

		} else if (cb6){
			document.getElementById("sre").setAttribute("checkfor", "Empty|msg:You must complete the Editing rate p/word!");
			document.getElementById("srem").setAttribute("checkfor", "Empty|msg:You must complete the Editing rate min. fee!");

		} else if (cb2){
			document.getElementById("srd").setAttribute("checkfor", "Empty|msg:You must complete the DTP rate p/word!");
			document.getElementById("srdm").setAttribute("checkfor", "Empty|msg:You must complete the DTP rate min. fee!");

		} else if (cb7){
			document.getElementById("srcc").setAttribute("checkfor", "Empty|msg:You must complete the Cultural Consulting rate p/word!");
			document.getElementById("srcc").setAttribute("checkfor", "Empty|msg:You must complete the Cultural Consulting rate min. fee!");

		} else if (cb3){
			document.getElementById("srtt").setAttribute("checkfor", "Empty|msg:You must complete the Tape Transcription rate p/word!");
			document.getElementById("srttm").setAttribute("checkfor", "Empty|msg:You must complete the Tape Transcription rate min. fee!");

		} else if (cb4){
			document.getElementById("srvo").setAttribute("checkfor", "Empty|msg:You must complete the Voice Over rate p/word!");
			document.getElementById("srvom").setAttribute("checkfor", "Empty|msg:You must complete the Voice Over rate min. fee!");
		}
	}

	for (var i=0; i<l; i++){
		var tmpObj=pForm.elements[i];
		var alt=tmpObj.getAttribute("checkfor");
		if (isEmpty(alt) && alt!=undefined){

			var altArray=alt.split("|");
			var cmd=altArray[0].split(":");

			for (var j=1; j< altArray.length; j++){
				var t=altArray[j].split(":");
				if (t[0]=="msg") msg=t[1];
			}

			var value;

			switch(tmpObj.type){
				case "text":
					value = tmpObj.value;
				break;

				case "select-one":
					value = tmpObj.selectedIndex;
				break;

				case "checkbox":
					value = tmpObj.checked;
				break;
			}

			ok = eval("is"+cmd[0])(value, cmd[1], tmpObj);
			if (!ok){
				errorOn(tmpObj, msg);
				break;
			}
		}
	}

	return ok;
}

function errorOn(pObj, pMsg){
	alert (pMsg);
}

function isNotFirst(nPos){
	return (nPos==0 ? false:true);
}

function isEmail(s_email) {
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(s_email) && r2.test(s_email));
}

function isEmpty ( pString ) {
	return !isBlank(pString)
}

function isBlank ( pString ) {
	return Boolean( /^\s*$/.test( pString ) );
}

