function createRequest(){
var request=false
if(window.XMLHttpRequest){
request=new XMLHttpRequest()}
else if(window.ActiveXObject){
try{
request=new ActiveXObject("MSXML2.XMLHTTP")}
catch(err1){
try{
request=new ActiveXObject("Microsoft.XMLHTTP")}
catch(err2){
request=null}}}
return request}
function requestGET(url,query,req){
myRand=parseInt(Math.random()*99999999)
req.open("GET",url+'?'+query+'&rand='+myRand,true)
req.send(null)}
function requestPOST(url,query,req){
req.open("POST",url,true)
req.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
req.send(query)}
function doCallback(callback,item){
eval(callback+'(item)')}
function doAjax(url,query,callback,reqtype,getxml){
var myreq=createRequest()
var item
myreq.onreadystatechange=function(){
if(myreq.readyState==4){
if(myreq.status==200){
if(getxml==1){
item=myreq.responseXML}
else{
item=myreq.responseText}
doCallback(callback,item)}}}
if(reqtype=='post'){
requestPOST(url,query,myreq)}
else{
requestGET(url,query,myreq)}}

