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\" should be more than 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\" should be more than 6 characters.");
		theForm.password.focus();
		return false;
	}
	if(isBlank(theForm.passwordconfirm.value)){
		alert("\"Confirm Password\" is a required field and should match the \"Password\" field.");
		theForm.passwordconfirm.focus();
		return false;
	}
	if(theForm.password.value!=theForm.passwordconfirm.value){
		alert("The passwords were not correctly confirmed, please re-enter them.");
		theForm.passwordconfirm.focus();
		return false;
	}

//	theForm.howdidyou.options[theForm.howdidyou.selectedIndex].value
//	if(theForm.howdidyou.selectedIndex==0){
	if(isBlank(theForm.howdidyou.value)){	
		alert("\"How did you hear about us?\" is a required field.");
		theForm.howdidyou.focus();
		return false;
	}	
	if(isBlank(theForm.primaryEmail.value)){
			alert("\"Primary Email\" is a required field.");
			theForm.primaryEmail.focus();
			return false;
	}else{
			if(!(isValidEmail(theForm.primaryEmail.value))){
				alert("\"Primary Email\" is not valid.");
				theForm.primaryEmail.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( (theForm.htmlemail[0].checked==false) && (theForm.htmlemail[1].checked==false)){
		alert("\"Can you read HTML emails?\" is required, please select Yes/No.");
		return false;
	}	
	return true;
}

function submitForm(){
	document.form1.submit();
}
