<!-- Begin

function validate_member_application() {
	
	if (trimString(document.member_application_form.firstname.value) == "")
	{
		alert("Please tell us your first name.");
		return;
	}
	
	if (trimString(document.member_application_form.lastname.value) == "")
	{
		alert("Please tell us your last name.");
		return;
	}
	
	if (trimString(document.member_application_form.address.value) == "")
	{
		alert("Please tell us your home address.");
		return;
	}
	
	if (trimString(document.member_application_form.city.value) == "")
	{
		alert("Please tell us your home city.");
		return;
	}
	
	if (trimString(document.member_application_form.state.value) == "")
	{
		alert("Please tell us your home state.");
		return;
	}
	
	if (trimString(document.member_application_form.zip.value) == "")
	{
		alert("Please tell us your home zip code.");
		return;
	}
	
	if (trimString(document.member_application_form.phone1.value) == "")
	{
		alert("Please tell us your home phone area code.");
		return;
	}
	
	var valid_numeric_characters = "0123456789";
	
	var phone1_ok = "yes";
	var temp;
	for (var i=0; i<document.member_application_form.phone1.value.length; i++) {
	temp = "" + document.member_application_form.phone1.value.substring(i, i+1);
	if (valid_numeric_characters.indexOf(temp) == "-1") phone1_ok = "no";
	}
	if (phone1_ok == "no") {
	alert("Please use only numeric characters in your home phone number.");
	return;
	}
	
	if (trimString(document.member_application_form.phone2.value) == "")
	{
		alert("Please tell us your Home Phone Number.");
		return;
	}
	
	var phone2_ok = "yes";
	var temp;
	for (var i=0; i<document.member_application_form.phone2.value.length; i++) {
	temp = "" + document.member_application_form.phone2.value.substring(i, i+1);
	if (valid_numeric_characters.indexOf(temp) == "-1") phone2_ok = "no";
	}
	if (phone2_ok == "no") {
	alert("Please use only numeric characters in your home phone number.");
	return;
	}
	
	if (trimString(document.member_application_form.phone3.value) == "")
	{
		alert("Please tell us your Home Phone Number.");
		return;
	}
	
	var phone3_ok = "yes";
	var temp;
	for (var i=0; i<document.member_application_form.phone3.value.length; i++) {
	temp = "" + document.member_application_form.phone3.value.substring(i, i+1);
	if (valid_numeric_characters.indexOf(temp) == "-1") phone3_ok = "no";
	}
	if (phone3_ok == "no") {
	alert("Please use only numeric characters in your home phone area ");
	return;
	}
	
	if (trimString(document.member_application_form.email.value) == "")
	{
		alert("Please tell us your email address.");
		return;
	}
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(trimString(member_application_form.email.value))){
		}
		else {
		alert("The email address you entered is invalid. Please re-enter it.")
	  return;
	  }
	  
	var professionalstatusArray = document.member_application_form.professionalstatus;
	var professionalstatus_ok = "no";
	
	for ( var index = 0; index < professionalstatusArray.length; index++ ) {
	
		if ( professionalstatusArray[ index ].checked )
		{
		professionalstatus_ok = "yes";
		break;
		}
	}
	if (professionalstatus_ok == "no") {
	alert("Please select your professional status.");
	return;
	}

	var propertytypeArray = document.member_application_form.elements['propertytypes[]'];
	var propertytype_ok = "no";
	
	for ( var index = 0; index < propertytypeArray.length; index++ ) {
	
		if ( propertytypeArray[ index ].checked )
		{
		propertytype_ok = "yes";
		break;
		}
	}
	if (propertytype_ok == "no") {
	alert("Please select at least one property type that you specialize in.");
	return;
	}

	var servicelocationsArray = document.member_application_form.elements['servicelocations[]'];
	var servicelocations_ok = "no";
	
	for ( var index = 0; index < servicelocationsArray.length; index++ ) {
	
		if ( servicelocationsArray[ index ].checked )
		{
		servicelocations_ok = "yes";
		break;
		}
	}
	if (servicelocations_ok == "no") {
	alert("Please select at least one service location.");
	return;
	}

	
	if (trimString(document.member_application_form.agentpassword.value) == "")
	{
		alert("Please provide a unique password of 6-16 characters, letters and numbers only (no spaces, dashes, underscores, etc.).");
		return;
	}

	if (trimString(document.member_application_form.agentpassword.value).length < 4)
		{
		alert("Please choose a password that is password to 4-12 characters long");
		return;
		}

	if (trimString(document.member_application_form.agentpassword.value).length > 12)
		{
		alert("Please choose a password that is password to 4-12 characters long");
		return;
		}

	if (trimString(document.member_application_form.agentpasswordcheck.value) == "")
	{
		alert("Please re-type your password");
		return;
	}

	if (trimString(document.member_application_form.agentpassword.value) != trimString(document.member_application_form.agentpasswordcheck.value))
		{
		alert("Password and password re-type don't match! Please re-enter both.");
		return;
		}

	var valid_password_characters = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789";
	
	var password_ok = "yes";
	var temp;
	for (var i=0; i<document.member_application_form.agentpassword.value.length; i++) {
	temp = "" + document.member_application_form.agentpassword.value.substring(i, i+1);
	if (valid_password_characters.indexOf(temp) == "-1") password_ok = "no";
	}
	if (password_ok == "no") {
	alert("Please use only alphanumeric characters in your password(no spaces, dashes, underscores, periods, commas, etc.).");
	return;
	}



	if (document.member_application_form.termsagreement.checked)
		 {

		 }
	else
		 {
			alert("Please verify that you agree to the terms and conditions");
	return;
		 }

	if (trimString(document.member_application_form.antispam.value) == "")
	{
		alert("Please enter the antispam code.");
		return;
	}


	var valid_antispam_characters = "0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789";
	
	var antispam_ok = "yes";
	var temp;
	for (var i=0; i<document.member_application_form.antispam.value.length; i++) {
	temp = "" + document.member_application_form.antispam.value.substring(i, i+1);
	if (valid_antispam_characters.indexOf(temp) == "-1") antispam_ok = "no";
	}
	if (antispam_ok == "no") {
		alert("Invalid antispam code. Please re-enter the antispam code.");
	return;
	}
	 
	document.getElementById('member_application_form_submit').innerHTML = "<span class=\"errormessage\">Request processing, please wait ...</span>";
	document.member_application_form.submit();
	
}


//  End -->

