var xmlHttp

function stateChanged(strID)
{
	if (xmlHttp.readyState==1) {
		document.getElementById(strID).innerHTML="<img src=\"/images/ajax-loader.gif\"/>"
	}
	if (xmlHttp.readyState==4) {
	  if (isNaN(xmlHttp.responseText)) { 
	    document.getElementById(strID).innerHTML='';
		document.getElementById(strID).innerHTML=xmlHttp.responseText;
	  } else { 
		window.location.href="http://amazingphuketproperty.com/phuketproperty/property_"+xmlHttp.responseText+".asp"; 
	  }
	}
}

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 checkPropID(strID) //check if a username is available or already in the system.
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX so we cannot check availability of this username.");
  		return;
  	} 
	xmlHttp.onreadystatechange= new Function("stateChanged('"+strID+"')");
	xmlHttp.open("GET","/phuketproperty/checkPropID.asp?strID="+document.frmSearch.propID.value,true);
	xmlHttp.send(null);
}
