/** Developed by Fabio Teles - Pixel4 (pixel4@gmail.com) **/
var jx=function(){var f=function(p){return typeof p==='string'?document.getElementById(p):p};var $={http:false,url:"",format:"text",method:"post",onSuccess:false,onError:false,handler:false,loading:"",update:"",parameters:""};var g=function(){$.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}}};var h=function(){if($.http.readyState==4){if($.http.status==200){var a="";if($.http.responseText)a=$.http.responseText;if($.format.toLowerCase()=="json"){a=a.replace(/[\n\r]/g,"");a=eval('('+a+')')}else if($.format=="xml"){a=$.http.responseXML}if($.onSuccess)$.onSuccess(a);if($.update)f($.update).innerHTML=a}else{if($.onError)$.onError($.http.status)}if($.loading)document.getElementById($.loading).style.display="none"}};var i=function(){if($.format=="xml")if($.http.overrideMimeType)$.http.overrideMimeType('text/xml');var p="";if($.url.indexOf("\?")!=-1){var b=$.url.split("\?");$.url=b[0];p+="&"+b[1]}if($.parameters){if(typeof $.parameters=='object'){for(var a in $.parameters)p+="&"+a+"="+escape($.parameters[a])}else if(typeof $.parameters=='string'){p+=$.parameters}}p+="&_uid="+new Date().getTime();$.parameters=p.charAt(0)=="&"?p.substring(1):p;if($.method=="get"){$.url+="?"+$.parameters;$.parameters=null}$.http.open($.method,$.url,true);if($.method=="post"){$.http.setRequestHeader("Content-type","application/x-www-form-urlencoded");$.http.setRequestHeader("Content-length",$.parameters.length);$.http.setRequestHeader("Connection","close")}if($.handler){$.http.onreadystatechange=$.handler}else{$.http.onreadystatechange=h}$.http.send($.parameters)};g();return{xmlHttpRequest:$.http,request:function(a,b){if(!a||!$.http)return;var c={'onSuccess':false,'onError':false,'handler':false,'format':"text",'method':"GET",'update':"",'loading':"",'parameters':""};for(var d in c){if(b[d]){$[d]=b[d]}}$.url=a;$.format=$.format.toLowerCase();$.method=$.method.toLowerCase();if($.loading)document.getElementById($.loading).style.display="";i()}}}
