function openPixels() {


}

function isNumeric(sText) {
  var ValidChars = "0123456789";
  var IsNumber=true;
  var Char;

	for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
			IsNumber = false;
		}
  }
	return IsNumber;
}

function Validate() {
	var state="";
	var zip="";
	var min="";
	var max="";
	var msg="";
	state=document.forms.zipform.state.value;
	zip=document.forms.zipform.zip.value;
	min=document.forms.zipform.listing_price_min.value;
	max=document.forms.zipform.listing_price_max.value;

	if (state == "" && zip == "")	 {
		msg= msg+"Please enter both a city and a state or just a zip code."+"\n\n";
	} else {
		var pattern=/^[0-9]{0}$|^[0-9]{5}$/;
		if (zip.search(pattern)==-1) { //if match failed
			msg= msg+"There is a problem with your zip code.\n\n";
		}
	}
	
	if (min > max && max != "")	 {
		msg= msg+"Please adjust your minimum and maximum prices."+"\n\n";
	}
	
	if (msg != ""){
		alert(msg);
		msg="";
		return false;
	}
	
	return true;
}

function ValidateLarge() {
	var min="";
	var max="";
	var msg="";
	state=document.forms.zipform2.state.value;
	zip=document.forms.zipform2.zip.value;
	min=document.forms.zipform2.listing_price_min.value;
	max=document.forms.zipform2.listing_price_max.value;

	if (state == "" && zip == "")	 {
		msg= msg+"Please enter both a city and a state or just a zip code."+"\n\n";
	} else {
		var pattern=/^[0-9]{0}$|^[0-9]{5}$/;
		if (zip.search(pattern)==-1) { //if match failed
			msg= msg+"There is a problem with your zip code.\n\n";
		}
	}
	
	if (min > max && max != "")	 {
		msg= msg+"Please adjust your minimum and maximum prices."+"\n\n";
	}
	
	if (msg != ""){
		alert(msg);
		msg="";
		return false;
	}
	
	alert (min +"\n"+max);
	
//	return true;
}

function ValidateSmall() {
	var state="";
	var zip="";
	var msg="";
	state=document.forms.zipform.state.value;
	zip=document.forms.zipform.zip.value;

	if (state == "" && zip == "")	 {
		msg= msg+"Please enter both a city and a state or just a zip code."+"\n\n";
	} else {
		var pattern=/^[0-9]{0}$|^[0-9]{5}$/;
		if (zip.search(pattern)==-1) { //if match failed
			msg= msg+"There is a problem with your zip code.\n\n";
		}
	}
	
	if (msg != ""){
		alert(msg);
		msg="";
		return false;
	}
	
	return true;
}


function ValidateBox1() {
	
	var pattern=/^[0-9a-zA-Z ]{3,},{1}(\s){0,1}[a-zA-Z]{2}$/;
	var pattern2=/^[0-9]{5}$/;
	if (document.forms.box1.location.value.search(pattern)==-1 && document.forms.box1.location.value.search(pattern2)==-1) { //if match failed
		alert("There is a problem with your entry.\n Please enter a city and a state, or a zip code.\n Example \"San Jose, CA\" or \"95129\"");
	} else {
		openPixels();
		document.forms.box1.submit();
	}
}


function ValidateBox2() {
	
	var pattern=/^[0-9a-zA-Z ]{3,},{1}(\s){0,1}[a-zA-Z]{2}$/;
	var pattern2=/^[0-9]{5}$/;
	if (document.forms.box2.location.value.search(pattern)==-1 && document.forms.box2.location.value.search(pattern2)==-1) { //if match failed
		alert("There is a problem with your entry.\n Please enter a city and a state, or a zip code.\n Example \"San Jose, CA\" or \"95129\"");
	} else {
		openPixels();
		document.forms.box2.submit();
	}
}


function ValidateBox3() {
	
	var pattern=/^[0-9a-zA-Z ]{3,},{1}(\s){0,1}[a-zA-Z]{2}$/;
	var pattern2=/^[0-9]{5}$/;
	if (document.forms.box3.location.value.search(pattern)==-1 && document.forms.box3.location.value.search(pattern2)==-1) { //if match failed
		alert("There is a problem with your entry.\n Please enter a city and a state, or a zip code.\n Example \"San Jose, CA\" or \"95129\"");
	} else {
		openPixels();
		document.forms.box3.submit();
	}
}


function ValidateBox4() {
	
	var pattern=/^[0-9a-zA-Z ]{3,},{1}(\s){0,1}[a-zA-Z]{2}$/;
	var pattern2=/^[0-9]{5}$/;
	if (document.forms.box4.location.value.search(pattern)==-1 && document.forms.box4.location.value.search(pattern2)==-1) { //if match failed
		alert("There is a problem with your entry.\n Please enter a city and a state, or a zip code.\n Example \"San Jose, CA\" or \"95129\"");
	} else {
		openPixels();
		document.forms.box4.submit();
	}
}

function openwin(url,name){
   window.open (url, name, config='height=500,width=550, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
}