function fillzipcode(zipval)
{
  document.residential.to_zip.value = zipval;
}
function validateFields( theForm )
{
	if ( theForm.fullname.value == "" )
	{
		warnEmpty (theForm.fullname, "Name" )
		return false;
	}
	if ( theForm.email.value == "" )
	{
		warnEmpty (theForm.email, "Email" )
		return false;
	}
	/*if(!theForm.email.value.match(/^[a-zA-Z0-9_\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/))
	{
		alert("Please enter a valid email address.")
		theForm.email.focus;
		return false;
	}*/
	if ( !checkUSPhone11( theForm.phone, true ))
		return false;

	if ( !checkUSPhone11( theForm.workphone, true ))
		return false;

	if ( !checkUSPhone11( theForm.cellphone, true ))
		return false;

	if (theForm.phone.value == "" && theForm.workphone.value == "" && theForm.cellphone.value == "")
	{
		alert("You must fill atleast 1 telephone number");
		theForm.phone.focus();
		return false;
	}
	if (theForm.movedate.value == "")
	{
		alert("You must specify a move date.");
		theForm.movedate.focus();
		return false;
	}
 	var gdate = theForm.movedate.value;
 	var gyear = gdate.substring (gdate.lastIndexOf ("/")+1, gdate.length);
 	var gmonth = gdate.substring (0, gdate.indexOf ("/"));
 	var gday = gdate.substring (gdate.indexOf ("/")+1, gdate.lastIndexOf ("/"));
 	if (gday.substring(0,1) == "0") { gday = gday.substring(1);}
	if (gmonth.substring(0,1) == "0") { gmonth = gmonth.substring(1);}
 	//if (!isDate (gdate.substring (gdate.lastIndexOf ("/")+1, gdate.length),gdate.substring (0, gdate.indexOf ("/")),gdate.substring (gdate.indexOf ("/")+1, gdate.lastIndexOf ("/"))))
 	if (!isDate (gyear,gmonth,gday))
	{
		alert("Invalid date selected. Please check the date.\n It should be in the mm/dd/yyyy format" );
		theForm.movedate.selectedIndex = theForm.movedate.selectedIndex; //This sets focus correctly in some browsers.
		theForm.movedate.focus()
		return false;
	}
	else
	{
		var dateNow = new Date();
		var year=dateNow.getYear()
		if (year <1000)
		year+=1900
		var day=dateNow.getDay()
		var month=dateNow.getMonth()
		var daym=dateNow.getDate()
		month=month+1
		if (month<10)
		month="0"+month
		daym=daym+2
		if (daym<10)
		daym="0"+daym

		var tShow = month+"/"+daym+"/"+year
		var MoveDate = new Date(gyear,gmonth-1,gday);
		var dateDiffDays = parseInt((MoveDate - dateNow) / (1000 * 60 * 60 * 24));

	}

	if ( !checkZIPCode( theForm.from_zip, false ))
		return false;

	if ( !checkZIPCode( theForm.to_zip, false ))
		return false;

	return true;
}
function toggleAuto()
{
	var formname = document.getElementById("formname");
	formname.value = "showauto";
	var toggle = document.getElementById("toggle");
	document.residential.submit();
}