function validate_rer(i){
var reqFields = ""
	
	if (i==1) {
		//if(document.form1.ZipCode.value == ""){
		//	reqFields += "Zip Code \n"
		//}
		
		//if(document.form1.ZipCode.value.length!=5){
		//	alert("Please enter your 5 digit zip code.")
		//	return false	
		//}				
	} else if (i==2) {

		if((document.form1.HelpWith.value == "Want to purchase a home") || (document.form1.HelpWith.value == "Want to buy and sell")) {
	
			if(document.form1.BuyingCity.value == ""){
				reqFields += "Buying City \n"
			}
			if(document.form1.BuyingState.value == ""){
				reqFields += "Buying State \n"
			}
			/*if(document.form1.BuyingPriceRange.value == ""){
				reqFields += "Buying Price Range \n"
			}*/
			
		}
				
		if((document.form1.HelpWith.value == "Want to sell my home") || (document.form1.HelpWith.value == "Want to buy and sell")) {
		
			if(document.form1.SellingCity.value == ""){
				reqFields += "Selling City \n"
			}
			if(document.form1.SellingState.value == ""){
				reqFields += "Selling State \n"
			}
			/*if(document.form1.SellingPriceRange.value == ""){
				reqFields += "Selling Price Range \n"
			}*/
			
					
		}
			
	
	} else if (i==3) {
		if(document.form1.FirstName.value == ""){
			reqFields += "First Name \n"
		}
	
		if(document.form1.LastName.value == ""){
			reqFields += "Last Name \n"
		}
	
		if(document.form1.Address1.value == ""){
			reqFields += "Address \n"
		}
		
		if(document.form1.City.value == ""){
			reqFields += "City \n"
		}
		
		if(document.form1.State.value == ""){
			reqFields += "State \n"
		}
		
		if(document.form1.ZipCode.value == ""){
			reqFields += "Zip Code  \n"
		}
	
		if((document.form1.HomePhone1.value == "")||(document.form1.HomePhone2.value == "")||(document.form1.HomePhone3.value == "")||(document.form1.HomePhone1.value.length!=3)||(document.form1.HomePhone2.value.length!=3)||(document.form1.HomePhone3.value.length!=4)){
			reqFields += "Home Phone  \n"
		}
		
		if((document.form1.WorkPhone1.value == "")||(document.form1.WorkPhone2.value == "")||(document.form1.WorkPhone3.value == "")||(document.form1.WorkPhone1.value.length!=3)||(document.form1.WorkPhone2.value.length!=3)||(document.form1.WorkPhone3.value.length!=4)){
			reqFields += "Work Phone  \n"
		}
		
		if(document.form1.Email.value == ""){
			reqFields += "Email \n"
		}
	
		var emailFilter=/^.+@.+\..{2,3}$/;
		if (!(emailFilter.test(document.form1.Email.value))) { 
		    	reqFields += "Email Address is invalid. \n";
		}		
		
	}

	if(reqFields != ""){
		alert("Please fill in the following required fields: \n \n" + reqFields)
		return false
	}
	
}

function IsNumeric(PossibleNumber){	var PNum = new String(PossibleNumber);	var regex = /[^0-9]/;	return !regex.test(PNum);}