function phloc_server_log(a,c,b,d){sajax_do_call(a,"log",null,[c,b,d])}function phloc_server_error(a){phloc_server_log(null,a,"error",null)}
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".split(","),c=0;c<a.length;c++)try{return new ActiveXObject(a[c])}catch(b){}if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;throw Error("XMLHttp (AJAX) not supported");}
function _addSessionURLSuffix(a,c){if(-1!=a.indexOf(c))return a;var b=a.indexOf("?");0>b&&(b=a.indexOf("#"));return 0>b?a+c:a.substring(0,b)+c+a.substring(b)}
function phloc_remote_call_get(a,c){"undefined"!=typeof g_session_url_suffix&&(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("function"==typeof c)b.onreadystatechange=function(){4==b.readyState&&(200==b.status||304==b.status?c(b.responseText):0!=b.status&&alert("Unexpected status from remote GET call: "+b.status+" / "+b.statusText))};
b.send();delete b}
function phloc_remote_call_post(a,c,b){"undefined"!=typeof g_session_url_suffix&&(a=_addSessionURLSuffix(a,g_session_url_suffix));var d=_sajax_create_object();d.open("POST",a,!0);d.setRequestHeader("Method","POST "+a+" HTTP/1.1");d.setRequestHeader("Content-Type","application/x-www-form-urlencoded");if("function"==typeof b)d.onreadystatechange=function(){4==d.readyState&&(200==d.status||304==d.status?b(d.responseText):0!=d.status&&alert("Unexpected status from remote POST call: "+d.status+" / "+d.statusText))};
d.send(c);delete d}function sajax_extract_scripts(a){var c="",a=a.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(a,d){c+=d+"\n";return""});return{html:a,scripts:c}}function sajax_extract_htmlcomments(a){var c="",a=a.replace(/<\!--([\s\S]*?)--\>/g,function(a,d){c+=d+"\n";return""});return{html:a,comments:c}}function sajax_extract_executablecode(a){a=sajax_extract_htmlcomments(a);return a.comments&&""!=a.comments?a.comments:a.html}
function sajax_do_call(a,c,b,d){var k=a?a:sajax_remote_uri;if("undefined"==typeof k)return alert("ERROR: AJAX Remote URI is undefined!"),!1;var h="rsname="+encodeURIComponent(c),h=h+("&rsrnd="+(new Date).getTime());if(d)for(var i=0;i<d.length;i++)h+="&rsargs[]="+encodeURIComponent(d[i]);phloc_remote_call_post(k,h,function(j){j=sajax_extract_scripts(j);try{var f=null;try{var g=j.html,f=/^'/.test(g)?(new Function("return "+g))():g}catch(h){phloc_server_log(a,"ERROR: AJAX caught eval error "+h+"!\nTo eval:\n"+
g,"error")}f||(f=g);var e,g=!1;b&&"object"==typeof b?(e=b.callback,g=b.extra_data):e=b;e&&e(f,g)}catch(i){e="AJAX error caught in callback: "+i+"!\nFunc: "+c+"\nURI: "+k+"\nCallback: "+e+"\n",alert(e),f=printStackTrace({e:i}),"log"==c?alert("Error stacktrace:\n"+f):phloc_server_log(a,e+"\n"+f.join("\n"),"error")}if(j.scripts)try{var l=sajax_extract_executablecode(j.scripts);window.execScript?window.execScript(l):eval(l)}catch(m){e="AJAX script eval error: "+m+"!\nFunc: "+c+"\nURI: "+k+"\nArgs: "+
d+"\nScript: "+j.scripts,alert(e),f=printStackTrace({e:m}),"log"==c?alert("Error stacktrace:\n"+f):phloc_server_log(a,e+"\n"+f.join("\n"),"error")}});return!0}function sajax_convert_parm_map(a){var c={},b;for(b in a)c[a[b].name]=a[b].value;return c}function sajax_clean_result(a){return a?a.replace(/\\n/g,""):a};

