function submitIt(form) {
foundError = false;pathError = true;commaError = false;

//Referral Partners Details
	if (document.Referral.RP_Name.value == "") {
			alert("Please enter your name.")
			document.Referral.RP_Name.focus()
			return false
	}	
	if (document.Referral.RP_Org.value == "") {
			alert("Please enter your organisation.")
			document.Referral.RP_Org.focus()
			return false
	}
	if (document.Referral.RP_Country.value == "") {
			alert("Please enter your country.")
			document.Referral.RP_Country.focus()
			return false
	}	
	if (document.Referral.RP_Email.value =="") {
			alert("Please enter your email address.")
			document.Referral.RP_Email.focus()
			return false
	}		
		//check structure of email address
		if(document.Referral.RP_Email.value != "") {
        pathLen = document.Referral.RP_Email.value.length;
			for(var i=0; i<pathLen; i++) {
				ch = document.Referral.RP_Email.value.substring(i,i+1)
					if (ch == " ") {
            			commaError = true;
         			}
					if (ch == "@") {
						commaError = false;
         			}
			}
		}
		//spaces in email address
		if(foundError == false && commaError == true) {
			alert("Spaces are not permitted in Email addresses.");
			document.Referral.RP_Email.focus()
        	return (false);
		}
		//check for @ symbol
    	pathLen = document.Referral.RP_Email.value.length;
		for(var i=0; i<pathLen; i++) {
        ch = document.Referral.RP_Email.value.substring(i,i+1)
			if (ch == "@") {
				commaError = true;
			}
		}
		if(foundError == false && commaError == false) {
    		alert("Email addresses must include an '@' symbol.");
			document.Referral.RP_Email.focus()
        	return (false);
		}
//Recommended Person/Org Details
	if (document.Referral.Prod_SEM.checked == false && document.Referral.Prod_SC.checked == false){
		alert("Please select a product.")
		document.Referral.Prod_SEM.focus()
		return false
	}
	if (document.Referral.Name.value == "") {
		alert("Recommended: Please enter the name.")
		document.Referral.Name.focus()
		return false
	}		
	if (document.Referral.Org.value == "") {
		alert("Recommended: Please enter the organisation.")
		document.Referral.Org.focus()
		return false
	}
	if (document.Referral.Country.value == "") {
		alert("Recommended: Please enter the country.")
		document.Referral.Country.focus()
		return false
	}
	if (document.Referral.Phone.value == "" && document.Referral.Email.value =="") {
		alert("Recommended: Please enter either a phone number and/or email address.")
		document.Referral.Phone.focus()
		return false
	}
		//check structure of email address
	if(document.Referral.Email.value != "") {
        pathLen = document.Referral.Email.value.length;
			for(var i=0; i<pathLen; i++) {
				ch = document.Referral.Email.value.substring(i,i+1)
					if (ch == " ") {
            			commaError = true;
         			}
					if (ch == "@") {
						commaError = false;
         			}
			}
		//spaces in email address
		if(foundError == false && commaError == true) {
			alert("Spaces are not permitted in Email addresses.");
			document.Referral.Email.focus()
        	return (false);
		}
		//check for @ symbol
    	pathLen = document.Referral.Email.value.length;
		for(var i=0; i<pathLen; i++) {
        ch = document.Referral.Email.value.substring(i,i+1)
			if (ch == "@") {
				commaError = true;
			}
		}
		if(foundError == false && commaError == false) {
    		alert("Email addresses must include an '@' symbol.");
			document.Referral.Email.focus()
        	return (false);
		}
	}
	return true
}



