jxs={};function jx(){this.jx={http:false,format:"text",callback:function(data){},handler:false,error:false,opt:new Object(),getHTTPObject:function(){var http=false;if(typeof ActiveXObject!="undefined"){try{http=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{http=new ActiveXObject("Microsoft.XMLHTTP")}catch(E){http=false}}}else{if(XMLHttpRequest){try{http=new XMLHttpRequest()}catch(e){http=false}}}return http},load:function(url,callback,format,method){this.init();if(!this.http||!url){return}if(this.http.overrideMimeType){this.http.overrideMimeType("text/xml")}this.callback=callback;if(!method){var method="GET"}if(!format){var format="text"}this.format=format.toLowerCase();method=method.toUpperCase();var ths=this;var now="uid="+new Date().getTime();url+=(url.indexOf("?")+1)?"&":"?";url+=now;var parameters=null;if(method=="POST"){var parts=url.split("?");url=parts[0];parameters=parts[1]}this.http.open(method,url,true);if(method=="POST"){this.http.setRequestHeader("Content-type","application/x-www-form-urlencoded");this.http.setRequestHeader("Content-length",parameters.length);this.http.setRequestHeader("Connection","close")}if(this.handler){this.http.onreadystatechange=this.handler}else{this.http.onreadystatechange=function(){if(!ths){return}var http=ths.http;if(http.readyState==4){if(http.status==200){var result="";if(http.responseText){result=http.responseText}if(ths.format.charAt(0)=="j"){result=result.replace(/[\n\r]/g,"");result=eval("("+result+")")}else{if(ths.format.charAt(0)=="x"){result=http.responseXML}}if(ths.callback){ths.callback(result)}}else{if(ths.opt.loadingIndicator){document.getElementsByTagName("body")[0].removeChild(ths.opt.loadingIndicator)}if(ths.opt.loading){document.getElementById(ths.opt.loading).style.display="none"}if(ths.error){ths.error(http.status)}}}}}this.http.send(parameters)},bind:function(user_options){var opt={url:"",onSuccess:false,onError:false,format:"text",method:"GET",update:"",loading:"",loadingIndicator:""};for(var key in opt){if(user_options[key]){opt[key]=user_options[key]}}this.opt=opt;if(!opt.url){return}if(opt.onError){this.error=opt.onError}var div=false;if(opt.loadingIndicator){div=document.createElement("div");div.setAttribute("style","position:absolute;top:0px;left:0px;");div.style.position="fixed";div.style.top="0px";div.style.left="0px";div.setAttribute("class","loading-indicator");div.innerHTML=opt.loadingIndicator;document.getElementsByTagName("body")[0].appendChild(div);this.opt.loadingIndicator=div}if(opt.loading){document.getElementById(opt.loading).style.display="block"}this.load(opt.url,function(data){if(opt.onSuccess){opt.onSuccess(data)}if(opt.update){document.getElementById(opt.update).innerHTML=data}if(div){document.getElementsByTagName("body")[0].removeChild(div)}if(opt.loading){document.getElementById(opt.loading).style.display="none"}},opt.format,opt.method)},init:function(){this.http=this.getHTTPObject()},addJS:function(url){var head=document.getElementsByTagName("head")[0];script=document.createElement("script");script.type="text/javascript";script.src=url;head.appendChild(script);head=null},removeJS:function(url){var v=document.getElementsByTagName("head")[0];var n=null;for(i=0;i<v.childNodes.length;i++){n=v.childNodes[i];if(n.type){if(n.type=="text/javascript"){if(n.src==url){n.parentNode.removeChild(n);break}}}}v=n=null},addCSS:function(url){var head=document.getElementsByTagName("head")[0];css=document.createElement("link");css.type="text/css";css.rel="stylesheet";css.href=url;head.appendChild(css);css=null},removeCSS:function(url){var v=document.getElementsByTagName("head")[0];var n=null;for(i=0;i<v.childNodes.length;i++){n=v.childNodes[i];if(n.type){if(n.type=="text/css"){if(n.href==url){n.parentNode.removeChild(n);break}}}}v=n=null}}}jxs.ax=function ax(url,onSuccess,hideOverlayerOnError,alertOnError){if(!hideOverlayerOnError){hideOverlayerOnError=false}if(!alertOnError){alertOnError=true}var ajaxCode={url:url,onSuccess:onSuccess,fomat:"text",method:"post",onError:function(status){if(alertOnError==true){if(status!=0)alert('"Àøèïêà": '+status);if(hideOverlayerOnError==true){overlayer.hide()}}}};var jsN="x"+Math.round(Math.random()*10000000);eval("jxs."+jsN+"=new jx()");eval("jxs."+jsN+".jx.bind(ajaxCode)")};
