function validate(theForm){

	if(isBlank(theForm.login.value)){
		alert("\"Login\" is a required field.");
		theForm.login.focus();
		return false;
	}
	if (theForm.login.value.length < 3) {
		alert("\"Login\" cannot be less than 3 characters.");
		theForm.login.focus();
		return false;
	}
	if (theForm.login.value.length > 8 ) {
		alert("\"Login\" cannot be more than 8 characters.");
		theForm.login.focus();
		return false;
	}	
		
 	if(isBlank(theForm.password.value)){
		alert("\"Password\" is a required field.");
		theForm.password.focus();
		return false;
	}
	if (theForm.password.value.length < 6) {
		alert("\"Password\" cannot be less than 6 characters.");
		theForm.password.focus();
		return false;
	}
	if(isBlank(theForm.passwordconfirm.value)){
		alert("\"Confirm Password\" is a required field.");
		theForm.passwordconfirm.focus();
		return false;
	}
	if(theForm.password.value!=theForm.passwordconfirm.value){
		alert("The 2 entered passwords don't match. Please re-enter the passwords.");
		theForm.password.focus();
		return false;
	}
	if(isBlank(theForm.howdidyou.value)){
		alert("\"How did you hear about us\" is a required field.");
		theForm.howdidyou.focus();
		return false;
	}
		
	if(isBlank(theForm.name.value)){
		alert("\"Name\" is a required field.");
		theForm.name.focus();
		return false;
	}

	if(isBlank(theForm.jobtitle.value)){
		alert("\"Job Title\" is a required field.");
		theForm.jobtitle.focus();
		return false;
	}
	if(isBlank(theForm.email.value)){
		alert("\"Email Address\" is a required field.");
		theForm.email.focus();
		return false;
	}else{
		if(!(isValidEmail(theForm.email.value))){
			alert("\"Email Address\" is not valid.");
			theForm.email.focus();
			return false;
		}
	}	
	if(!(isBlank(theForm.secondaryEmail.value))){
		if(!(isValidEmail(theForm.secondaryEmail.value))){
			alert("\"Secondary Email\" is not valid.");
			theForm.secondaryEmail.focus();
			return false;
		}
	}	
	if(isBlank(theForm.street.value)){
		alert("\"Street\" is a required field.");
		theForm.street.focus();
		return false;
	}
	if(isBlank(theForm.city.value)){
		alert("\"City\" is a required field.");
		theForm.city.focus();
		return false;
	}
	if(isBlank(theForm.state.value)){
		alert("\"State\" is a required field.");
		theForm.state.focus();
		return false;
	}
	if(isBlank(theForm.postalcode.value)){
		alert("\"Postal Code\" is a required field.");
		theForm.postalcode.focus();
		return false;
	}
	if (!(isNumeric(theForm.postalcode.value))) {
		alert("\"Postal Code\" is not valid.. Please enter 5 digit postal code.");
		theForm.postalcode.focus();
		return false;
	}
	if(theForm.postalcode.value.length != 5){
		alert("\"Postal Code\" is not valid. Please enter 5 digit postal code.");
		theForm.postalcode.focus();
		return false;
	}
	/*
	if(isBlank(theForm.website.value)){
		alert("Advertiser's website is a required field.");
		theForm.website.focus();
		return false;
	}
	*/
	if(isBlank(theForm.primaryphone.value)){
		alert("\"Primary Phone\" is a required field.");
		theForm.primaryphone.focus();
		return false;
	} else {
		if (!(CheckPhoneNumber(theForm.primaryphone.value))) {
			alert("\"Primary Phone\" is not valid");
			theForm.primaryphone.focus();
			return false;
		}
	}
	if (!(isBlank(theForm.secondaryphone.value))) { 
		if (!(CheckPhoneNumber(theForm.secondaryphone.value))) {
			alert("\"Secondary Phone\" is not valid");
			theForm.secondaryphone.focus();
			return false;
		}
	}

	if(isBlank(theForm.fax.value)){
		alert("\"Fax\" is a required field.");
		theForm.fax.focus();
		return false;
	}
	else {
		if (!(CheckPhoneNumber(theForm.fax.value))) {
			alert("\"Fax\" is not valid");
			theForm.fax.focus();
			return false;
		}
	}

	return true;

}

function submitForm(){
	document.form1.submit();
}


