function _sajax_create_object(){if(window.ActiveXObject)for(var a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"],d=0;d<a.length;d++)try{return new ActiveXObject(a[d])}catch(b){}if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;throw Error("XMLHttp (AJAX) not supported");}
function _addSessionURLSuffix(a,d){if(a.indexOf(d)!=-1)return a;var b=a.indexOf("?");b<0&&(b=a.indexOf("#"));if(b<0)return a+d;return a.substring(0,b)+d+a.substring(b)}
function phloc_remote_call_get(a,d){typeof g_session_url_suffix!="undefined"&&(a=_addSessionURLSuffix(a,g_session_url_suffix));var b=_sajax_create_object();b.open("GET",a,!0);b.setRequestHeader("Method","GET "+a+" HTTP/1.1");b.setRequestHeader("Content-Type","application/x-www-form-urlencoded");if(typeof d=="function")b.onreadystatechange=function(){b.readyState==4&&(b.status==200||b.status==304?d(b.responseText):alert("Unexpected status from remote GET call: "+b.status+" / "+b.statusText))};b.send();
delete b}
function phloc_remote_call_post(a,d,b){typeof g_session_url_suffix!="undefined"&&(a=_addSessionURLSuffix(a,g_session_url_suffix));var c=_sajax_create_object();c.open("POST",a,!0);c.setRequestHeader("Method","POST "+a+" HTTP/1.1");c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");if(typeof b=="function")c.onreadystatechange=function(){c.readyState==4&&(c.status==200||c.status==304?b(c.responseText):alert("Unexpected status from remote POST call: "+c.status+" / "+c.statusText))};c.send(d);
delete c}
function sajax_do_call(a,d,b,c){var j=a?a:sajax_remote_uri;if(typeof j=="undefined")return alert("ERROR: AJAX Remote URI is undefined!"),!1;var g="rsname="+encodeURIComponent(d);g+="&rsrnd="+(new Date).getTime();if(c)for(var h=0;h<c.length;h++)g+="&rsargs[]="+encodeURIComponent(c[h]);phloc_remote_call_post(j,g,function(e){var e=e.replace(/^\s*|\s*$/g,""),i=e.charAt(0),e=e.substring(2);if(i!="")if(i=="-")alert("ERROR: AJAX response: "+e);else try{var f,i=!1;typeof b=="object"?(f=b.callback,i=b.extra_data):
f=b;var g=null;try{g=eval(e)}catch(h){alert("ERROR: AJAX caught eval error "+h+"!\nTo eval: "+e)}f&&f(g,i)}catch(k){f="ERROR: AJAX caught in callback: "+k+"!\nFunc: "+d+"\nArgs: "+c+"\nURI: "+j+"\nCallback: "+f,alert(f),e=printStackTrace({e:k}),d=="log"||!phloc_server_log?alert(sStackTrace):phloc_server_log(a,f+"\n"+e.join("\n"),"error")}});return!0}function sajax_clean_result(a){if(a)return a.replace(/\\n/g,"");return a};

