////////////////////////////////////////////////////////// validate form checks for:// 	required fields are not blank// 	at least one radiobox is selected// 	email validation - @, full stop, # digits in the extension//////////////////////////////////////////////////////////////function validateForm(){////////////////////////////////////////////////////////// check if required form fields are empty// this method is suitable for short forms, but is not necessarily ideal for long forms//////////////////////////////////////////////////////////////var first = document.guestbook.first_name;var last= document.guestbook.last_name;var email = document.guestbook.email;	if(first.value == "") { 		alert("Please provide your first name."); 		first.focus();		return false;	}	if(last.value == "") { 		alert("Please provide your last name."); 		last.focus();		return false;	}		if(email.value == "") { 		alert("Please provide your email address."); 		email.focus();		return false;	}//if the emailAddrs does not contain the @ symbol or a full stop// emailAddress = email.value	 if( (email.value.indexOf('@')== -1)		|| (email.value.indexOf('.')== -1) ) {		alert("The email field requires a \"@\" and a \".\"be used. \n\nPlease enter a valid email address.") ;		email.focus();		email.select();		return false;			}// check that at least 2 characters follow the .	if( (email.value.charAt(email.value.length-4) != '.')		&& (email.value.charAt(email.value.length-3) != '.') ) {  		alert("You have entered an invalid email extension. You must have 2 or 3 digits after the '.' Please enter a valid email.");		email.focus();		email.select();		return false;	} 	//////////////////////////////////////////////////////////////// CONTINUE BLANK FIELD VALIDATION//////////////////////////////////////////////////////////////var phone = document.guestbook.phone;		if(phone.value == "") { 		alert("Please provide your phone number."); 		phone.focus();		return false;	}	//////////////////////////////////////////////////////////////	// check that at least one checkbox is selected ...//////////////////////////////////////////////////////////////var who9 = document.guestbook.who9;var who_other = document.guestbook.who_other;  	if( (document.guestbook.who1.checked == false) && (document.guestbook.who2.checked == false) && (document.guestbook.who3.checked == false) && 	    (document.guestbook.who4.checked == false) && (document.guestbook.who5.checked == false) && (document.guestbook.who6.checked == false) && 		(document.guestbook.who7.checked == false) && (document.guestbook.who8.checked == false) && (document.guestbook.who9.checked == false) ) {		alert("Please tell us your relationship to Employment Options, Inc.");		document.guestbook.who1.focus();		return false;	}		if( (who9.checked == true) && (who_other.value == "" ) ) {		alert("Please tell us your relationship to Employment Options, Inc.");		who_other.focus();		return false;	}		//////////////////////////////////////////////////////////////// CHECK select box values////////////////////////////////////////////////////////////// var ref = document.guestbook.referral;var other_ref= document.guestbook.referral_other;if  (ref.value==""  ) {			alert("Please specify how you found our Web site 1.");			ref.focus();			return false;}if ( (ref[8].selected==true) || (ref[6].selected==true)  ) {	if(other_ref.value == "" )  {			alert("Please specify how you found our Web site 2.");			other_ref.focus();			return false;		}}		////////////////////////////////////////////////////////////////if the form passes the above conditions//allow submission	return true;} //////////////////////////////////////////////////////////////// end function