// dealer_form.js
// validate the zip code

//////////////////////////////////////////////
function LTrim(str) 
{
	for (var i=0; str.charAt(i)==" "; i++);
	return str.substring(i,str.length);
}

function RTrim(str) 
{
	for (var i=str.length-1; str.charAt(i)==" "; i--);
	return str.substring(0,i+1);
}

function Trim(str) 
{
	return LTrim(RTrim(str));
}


function CheckVal(echoForm) {

	if(echoForm.Zip.value == "")
	{
		alert("Please enter your zip code.");
		echoForm.Zip.focus();
		return(false);
	}
	
	var value = Trim(echoForm.Zip.value);
	
	if(value.match(/^\d+$/) == null)
	{
		alert("Please double check the zip code.");
		echoForm.Zip.focus();
		return(false);
	}
	 		
	return true;
}



