function clearForm()
{
	document.Form1.fname.value="";
	document.Form1.lname.value="";
	document.Form1.City.value="";
	document.Form1.Zip.value="";
	//document.Form1.areacode.value="";
	document.Form1.radius.value="";
	document.Form1.State.selectedIndex=0;
}

function validate(field) 
{
	var valid = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÈÉÊËÌÍÎÒÓÔÕÖÙÚÛÜâäãèéêëìíîïòóôõöùúûü-, ."
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) 
	{
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") 
	{
		alert("Invalid value "+field.value+" for "+field.name+". Only alphabetical characters and numbers are accepted.");
		field.focus();
		field.select();
		return "false";
	}	
}
function validatenumbers(field) 
{
	var valid = "1234567890"
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) 
	{
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") 
	{
		alert("Invalid value "+field.value+" for "+field.name+". Only numbers are accepted.");
		field.focus();
		field.select();
		return "false";
	}	
}

function removespaces(Field)
{
	while (Field.value.substr(0,1)==" ") Field.value = Field.value.substr(1,Field.value.length);
}

function WipeZip()
{
	document.Form1.Zip.value="";
	//document.Form1.areacode.value="";
}
function WipeCity()
{
	document.Form1.City.value="";
	document.Form1.State.value="";
	//document.Form1.areacode.value="";
}
function WipeCityZip()
{
	document.Form1.City.value="";
	document.Form1.State.value="";
	document.Form1.Zip.value="";
}
function CheckForm() 
{	
	//remove preceding spaces
	removespaces(document.Form1.Zip);
	removespaces(document.Form1.City);
	//removespaces(document.Form1.areacode);
	removespaces(document.Form1.radius);
	
	if (document.Form1.Zip.value.length==0 && document.Form1.City.value.length==0 && document.Form1.fname.value.length==0 && document.Form1.lname.value.length==0 && document.Form1.State.selectedIndex==0) 
	{
		alert("Search criteria is incomplete");
		document.Form1.Zip.focus();
		return false;
	}
	if (validatenumbers(document.Form1.results)=="false") return false;
	if (validate(document.Form1.Zip)=="false") return false;
	if (validate(document.Form1.City)=="false") return false;
	//if (validatenumbers(document.Form1.areacode)=="false") return false;
	if (validatenumbers(document.Form1.radius)=="false") return false;
	else 	
	return true;		
}
