function results(status,XML)
{ document.getElementById(ajaxresid).innerHTML=XML;
}
function ajaxFunction()
{ var xmlHttp;
  try //Firefox, Opera 8.0+, Safari
  { xmlHttp=new XMLHttpRequest(); }
  catch (e) //Internet Explorer
  { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
    catch (e)
    { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
      catch (e)
      { //userMessage("Your browser does not support AJAX!");
        return null;
      }
    }
  }
  return xmlHttp;
}
var ajaxresid='';
function AJAXcall(type,url,id)//type=['POST','GET'], url=...
{ ajaxresid=id;
  if(type=='POST') {
  //xmlHttp.setRequestHeader('Content-Length', 0);
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.open('POST',url,true);
  xmlHttp.send(null);
  }
  else {
  xmlHttp.open('GET',url);
  xmlHttp.send(null);
  }
}
var xmlHttp=ajaxFunction();
xmlHttp.onreadystatechange=function()
{ if(xmlHttp.readyState==4)
  { if(xmlHttp.status != 200) return null; //userMessage("Can't connect to server.");
    else results(xmlHttp.status,xmlHttp.responseText);
  }
}