var ae = { xhr:function() { var o=null; try { o=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("MSXML2.XMLHTTP"); } catch(e) { } return o; }, call:function(url,args,on_ok,on_err,mode) { var xhr = ae.xhr(); if (xhr) { loading_on(); flash(false); if (!mode) mode="GET"; if (!args) args=new Object; xhr.onreadystatechange=function() { if (xhr.readyState==4) { if (xhr.status==200) { var hdr=xhr.getResponseHeader("Content-Type"),err=doc=null; if (hdr.indexOf("text/xml")!=-1){ doc=xhr.responseXML; if (err=doc.getElementsByTagName("error")[0]) { err=err.getAttribute("msg"); } } else { doc=xhr.responseText; } if (err) { if (on_err) on_err(err); else flash(err); } else { if (on_ok) on_ok(doc,args); } loading_off(); } } }; args['trn']=Math.floor(Math.random()*100000); var q=queryString(args); if (mode=="GET") { xhr.open(mode,url+"?"+q,true); xhr.send(null); } else { xhr.open(mode,url,true); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded;'); xhr.send(q); } } } };