//for ajax
var xmlHttp;
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;
}

function ajxPostcode(postcode,catId,id)
{
	if(isInteger(postcode))
	{
   	    xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request");
		 return;
		 }
		var url="getPostcode.php";
		url=url+"?postcode="+postcode;
		url=url+"&categoryId="+catId;
		url=url+"&postcodeResultId="+id;
		resultId ="postcode_result"+id;
		document.getElementById(resultId).innerHTML = '';			 
		document.getElementById('indicator'+id).style.display='';
		xmlHttp.onreadystatechange=ajxPostcodeResult;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		

	}
} 
function ajxPostcodeResult() 
{ 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 txt=xmlHttp.responseText;
	 txt = txt.split("|");
	 resultId ="postcode_result"+txt[1];
	 str = txt[0];
	 document.getElementById('indicator'+txt[1]).style.display='none';
	 document.getElementById(resultId).innerHTML = str;
	 } 
	 
}