XHR=function() {this.reinit=function() {if(window.XMLHttpRequest){this._xmlHttp=new XMLHttpRequest();} else if(window.ActiveXObject){this._xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");} else{alert("xhr.js: XMLHttpRequest is not supported by this browser!");}} this.busy=function(){if(!this._xmlHttp) return false;switch(this._xmlHttp.readyState) {case 1:case 2:case 3:return true;default:return false;}} this.abort=function(){if(this.busy()) this._xmlHttp.abort();} this.get=function(url,data,callback) {this.reinit();var xhr=this._xmlHttp;var code=this._encode(data);url=location.protocol+'//'+location.host+url;if(code) if(url.substr(url.length-1,1)=='&') url+=code;else url+='?'+code;xhr.open('GET',url,true);xhr.onreadystatechange=function() {if(xhr.readyState==4){var json=null;if(xhr.getResponseHeader("Content-Type")=="application/json"){try{json=eval('('+xhr.responseText+')');} catch(e){json=null;}} callback(xhr,json);}} xhr.send(null);} this.post=function(url,data,callback) {this.reinit();var xhr=this._xmlHttp;var code=this._encode(data);xhr.onreadystatechange=function() {if(xhr.readyState==4) callback(xhr);} xhr.open('POST',url,true);xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');xhr.send(code);} this.cancel=function() {this._xmlHttp.onreadystatechange=function(){};this._xmlHttp.abort();} this.send_form=function(form,callback,extra_values) {var code='';for(var i=0;i