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 then 3 characters.");

		theForm.login.focus();

		return false;

	}

	if (theForm.login.value.length > 8 ) {

		alert("Login cannot be more then 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 then 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("Provided passwords are diferent.");

		theForm.passwordconfirm.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("Your full name is a required field.");

		theForm.name.focus();

		return false;

	}

	

	if(isBlank(theForm.establishmentName.value)){

		alert("Establishment name is a required field.");

		theForm.establishmentName.focus();

		return false;

	}

	if(isBlank(theForm.address.value)){

		alert("Address is a required field.");

		theForm.address.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.");

		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.primarycontactname.value)){

		alert("Primary contact name is a required field.");

		theForm.primarycontactname.focus();

		return false;

	}

	if(isBlank(theForm.primarycontacttitle.value)){

		alert("Primary contact title is a required field.");

		theForm.primarycontacttitle.focus();

		return false;

	}

	
	if(isBlank(theForm.primarycontactphone.value)){

		alert("Primary contact phone is a required field.");

		theForm.primarycontactphone.focus();

		return false;

	} else {

		if (!(CheckPhoneNumber(theForm.primarycontactphone.value))) {

			alert("Primary contact phone number is Not Valid");

			theForm.primarycontactphone.focus();

			return false;

		}

	}



/*

	if(isBlank(theForm.secondarycontactname.value)){

		alert("Secondary Contact Name is a required field.");

		theForm.secondarycontactname.focus();

		return false;

	}

*/



	if (!(isBlank(theForm.secondarycontactphone.value))) { 

		if (!(CheckPhoneNumber(theForm.secondarycontactphone.value))) {

			alert("Secondary Phone number is Not Valid");

			theForm.secondarycontactphone.focus();

			return false;

		}

	}

	



	return true;



}

/*

function submitForm(){

	document.form1.submit();

}me.focus();

		return false;

	}





	if (!(isBlank(theForm.secondarycontactphone.value))) { 

		if (!(CheckPhoneNumber(theForm.secondarycontactphone.value))) {

			alert("\"Secondary Phone\" is not valid");

			theForm.secondarycontactphone.focus();

			return false;

		}

	}

	



	return true;



}
*/


function submitForm(){

	document.form1.submit();

}