var Ajax = { int_req_counter : 0, int_sync_result : null , _timeoutAdjustment : 1, xmlHttp : null, async_request : function (cb,cb_args,query) { this.int_req_counter++; var rc = this.int_req_counter; this.int_sync_result = null; xmlHttp=this.getXMLHTTP(); if(xmlHttp){ xmlHttp.open("GET",query,true); xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4&&xmlHttp.responseText) { if(xmlHttp.responseText.charAt(0)=="<"){ this._timeoutAdjustment-- }else{ // The response text gets executed as javascript... var myObject = eval('(' + xmlHttp.responseText + ')'); if ( myObject.replace_parts ) { for ( p in myObject.replace_parts ) { var div = document.getElementById(p); if ( div ) { div.innerHTML = myObject.replace_parts[p]; } } } if ( cb ) cb(myObject.res,cb_args); } } } xmlHttp.send(null) return 1; } else { return 0; } }, // HELPER // Was function jb... // returns an XMLHttp object... gets it in an IE/Mozilla friendly way.. getXMLHTTP : function (){ var A=null; try{ A=new ActiveXObject("Msxml2.XMLHTTP") }catch(e){ try{ A=new ActiveXObject("Microsoft.XMLHTTP") } catch(oc){ A=null } } if(!A && typeof XMLHttpRequest != "undefined") { A=new XMLHttpRequest() } return A } };