var ajax={"request":function(_1){
var _2=this.create(),self=this,tried=0,tmp,i,j;
var _3,onrequest,filter,callback,tries,target,url,method,xtra,params;
_3=_1.onload;
onrequest=_1.onrequest;
filter=_1.filter;
callback=_1.callback;
tries=_1.tries;
target=_1.target;
url=_1.url;
method=_1.method;
xtra=_1.xtra;
params=_1.params;
method=method.toLowerCase();
if(params){
if(typeof params=="object"){
tmp=[];
for(i in params){
j=params[i];
tmp.push(i+"="+(typeof filter=="function"?filter.call(null,j):escape(j)));
}
params=tmp.join("&");
}
if(method=="get"){
url+=url.indexOf("?")==-1?"?"+params:"&"+params;
}
}
_2.open(method,url,true);
if(method=="post"){
_2.setRequestHeader("Method","POST "+url+" HTTP/1.1");
_2.setRequestHeader("Content-type","application/x-www-form-urlencoded");
}else{
params=null;
}
_2.onreadystatechange=function(){
if(_2.readyState!=4){
return;
}
if(typeof _3=="function"){
_3.call(null);
}
if(_2.status==200){
if(target){
if(_2.getResponseHeader("content-type").match(/(html|plain)/)){
self.parseHTML(target,_2.responseText);
}
}
if(typeof callback=="function"){
callback.call(null,true,_2,xtra);
}
}else{
if(tries>0){
if(tried<tries){
tried++;
_2.abort();
_2.send(params);
}
}else{
if(typeof callback=="function"){
callback.call(null,false,_2,xtra);
}
}
}
};
if(typeof onrequest=="function"){
onrequest.call(null);
}
_2.send(params);
return _2;
},"create":function(){
var _4;
try{
_4=new XMLHttpRequest();
}
catch(e){
try{
_4=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(f){
try{
_4=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(g){
null;
}
}
}
return _4;
},"get":function(_5){
_5.method="GET";
this.request(_5);
},"post":function(_6){
_6.method="POST";
this.request(_6);
},"parseHTML":function(_7,_8,_9){
var _a,child,children,i,tmp;
_7=document.getElementById(_7);
if(_7){
if(_9){
_a=_7.cloneNode(false);
_7.parentNode.replaceChild(_a,_7);
_7=_a;
}
tmp=document.createElement("div");
tmp.innerHTML=_8;
children=tmp.childNodes;
for(i=0;child=children[i];i++){
child=child.cloneNode(true);
_7.appendChild(child);
}
}
}};

