function stateChanged(xmlHttp,onReadyState)
{ 
  //console.log(xmlHttp.readyState);  if (xmlHttp.readyState==4 && xmlHttp.status == 200)
  { 
    onReadyState()
  }  else if(xmlHttp.readyState == 4 && xmlHttp.status != 200)  {	alert('Error: '+xmlHttp.statusText)
	//alert(xmlHttp.status)  }
}

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 ajax(xmlHttp,url,onReadyState)
{  try  {
	xmlHttp = GetXmlHttpObject();	xmlHttp.onreadystatechange=function(){stateChanged(xmlHttp,onReadyState)};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	return xmlHttp;
  }
  catch(e)
  {	//Need to do something here
  }}
