var sajax_debug_mode=false;
var sajax_request_type="GET";
function sajax_debug(_1){
if(!sajax_debug_mode){
return false;
}
var e=document.getElementById("sajax_debug");
if(!e){
e=document.createElement("p");
e.className="sajax_debug";
e.id="sajax_debug";
var b=document.getElementsByTagName("body")[0];
if(b.firstChild){
b.insertBefore(e,b.firstChild);
}else{
b.appendChild(e);
}
}
var m=document.createElement("div");
m.appendChild(document.createTextNode(_1));
e.appendChild(m);
return true;
};
function sajax_init_object(){
sajax_debug("sajax_init_object() called..");
var A;
try{
A=new XMLHttpRequest();
}
catch(e){
try{
A=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
A=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(oc){
A=null;
}
}
}
if(!A){
sajax_debug("Could not create connection object.");
}
return A;
};
function sajax_do_call(_6,_7,_8){
var i,x,n;
var _c;
var _d;
_c=wgServer+((wgScript==null)?(wgScriptPath+"/index.php"):wgScript)+"?action=ajax";
if(sajax_request_type=="GET"){
if(_c.indexOf("?")==-1){
_c=_c+"?rs="+encodeURIComponent(_6);
}else{
_c=_c+"&rs="+encodeURIComponent(_6);
}
for(i=0;i<_7.length;i++){
_c=_c+"&rsargs[]="+encodeURIComponent(_7[i]);
}
_d=null;
}else{
_d="rs="+encodeURIComponent(_6);
for(i=0;i<_7.length;i++){
_d=_d+"&rsargs[]="+encodeURIComponent(_7[i]);
}
}
x=sajax_init_object();
if(!x){
alert("AJAX not supported");
return false;
}
try{
x.open(sajax_request_type,_c,true);
}
catch(e){
if(window.location.hostname=="localhost"){
alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing.");
}
throw e;
}
if(sajax_request_type=="POST"){
x.setRequestHeader("Method","POST "+_c+" HTTP/1.1");
x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
x.setRequestHeader("Pragma","cache=yes");
x.setRequestHeader("Cache-Control","no-transform");
x.onreadystatechange=function(){
if(x.readyState!=4){
return;
}
sajax_debug("received ("+x.status+" "+x.statusText+") "+x.responseText);
if(typeof (_8)=="function"){
_8(x);
}else{
if(typeof (_8)=="object"){
if(_8.tagName=="INPUT"){
if(x.status==200){
_8.value=x.responseText;
}
}else{
if(x.status==200){
_8.innerHTML=x.responseText;
}else{
_8.innerHTML="<div class='error'>Error: "+x.status+" "+x.statusText+" ("+x.responseText+")</div>";
}
}
}else{
alert("bad target for sajax_do_call: not a function or object: "+_8);
}
}
return;
};
sajax_debug(_6+" uri = "+_c+" / post = "+_d);
x.send(_d);
sajax_debug(_6+" waiting..");
delete x;
return true;
};

