function check_zipcode()
{
	temp= false;

	var zipcode = document.getElementById('zipcode').value;
	var site_url = document.getElementById('site_url').value;

	var temp= true;
	if(zipcode=="" && zipcode.length<5 && isNaN(zipcode))
	{
		alert("Please enter five digit zipcode");
		temp= false;
	}
	if(temp==true)
	{
		var url=site_url.toLowerCase()+'/checkzipcodeajax.php';					
		url=url+"?zipcode="+zipcode;
	//	alert(url);
	//	return false;
		getURl(url);
	}
	//pass the url
}
	
	
	var xmlHttp_lead = null;

	function getURl(url)
		{
			
			xmlHttp_lead=GetXmlHttpObject();
			if (xmlHttp_lead==null)
			  {
			  alert ("Your browser does not support AJAX!");
			  return;
			  } 
	
			xmlHttp_lead.onreadystatechange=stateChanged;
			xmlHttp_lead.open("GET",url,true);					//request to get data
//			xmlHttp_lead.send(null); 
			xmlHttp_lead.setRequestHeader("lastCached", new Date());
			xmlHttp_lead.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xmlHttp_lead.send(document.forms[0]);			
		}
	
	function stateChanged() 
	{
		if (xmlHttp_lead.readyState==4)
		{ 
			if (xmlHttp_lead.status == 200) {
		 	var datanode=xmlHttp_lead.responseText;				//response of our request
			if(datanode.match(/Error/) == "Error")
			{
				alert('Please enter valid zipcode.');
				document.getElementById('zipcode').style.border = "groove #FF0000";
				var str = document.location.href;
				var matched = str.match(/index.php/);
				if(matched == null)
				{
					window.scroll(0,450);
				}
				document.getElementById('zipcode').focus;
			}
			else if(datanode.match(/Success/) == "Success")
			{
				document.forms[0].submit();
			}
		  }
		}
	}
	
	function GetXmlHttpObject()
	{
		var xmlHttp=null;
		try
	  	{
		  // Firefox, Opera 8.0+, Safari
		  xmlHttp=new XMLHttpRequest();
		}
		catch (e)
	  	{
		  // Internet Explorer
		  try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		  catch (e)
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
	  	}
		return xmlHttp;
	}
	