
var Ajax=function(){this.xmlHttpObject=null;this.onlyHeaders=false;this.initXmlHttpObject=function(){this.xmlHttpObject=this.getXmlHttpObject();};this.getXmlHttpObject=function(){var xmlHttp=null;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttp;};this.abort=function(){try{this.xmlHttpObject.abort();}catch(e){this.xmlHttpObject.stop();}};this.requestState=function(){try{return this.xmlHttpObject.readyState;}catch(e){return 0;}};this.requestStatus=function(){return this.xmlHttpObject.status;};this.requestDataText=function(){return this.requestData('texto');};this.requestDataXml=function(){return this.requestData('xml');};this.requestData=function(modo){if((this.requestState()==2)&&this.onlyHeaders){this.abort();}
if(this.requestState()==4){if(this.requestStatus()==200){if(modo=='xml'){return this.xmlHttpObject.responseXML;}else{return this.xmlHttpObject.responseText;}}else{}}
if(modo=='xml'){return null;}else{return'';}};this.sendDataGet=function(url,functionName){if(url.length==0||functionName.length==0){return;}
if(url.indexOf("?",0)>=0&&url.indexOf("sid",0)==-1){url=url+"&sid="+Math.random();}
this.initXmlHttpObject();if(this.xmlHttpObject==null){alert("Seu navegador não suporta AJAX!");return;}
this.xmlHttpObject.onreadystatechange=eval(functionName);this.xmlHttpObject.open("GET",url,true);this.xmlHttpObject.send(null);};this.sendDataPost=function(url,parameters,functionName){if(url.length==0||parameters.length==0||functionName.length==0){return;}
this.initXmlHttpObject();if(this.xmlHttpObject==null){alert("Seu navegador não suporta AJAX!");return;}
this.xmlHttpObject.onreadystatechange=eval(functionName);this.xmlHttpObject.open("POST",url,true);this.xmlHttpObject.setRequestHeader('Content-type','application/x-www-form-urlencoded');this.xmlHttpObject.setRequestHeader('Content-length',parameters.length);this.xmlHttpObject.setRequestHeader('Connection','close');this.xmlHttpObject.send(parameters);};};function funcaoVazia(){}
function getFunctionName(functionName){return(functionName==null||functionName=='')?'funcaoVazia':functionName;}
var AjaxDefault=new Ajax();function requestDataText(){return AjaxDefault.requestDataText();}
function requestDataXml(){return AjaxDefault.requestDataXml();}
function sendDataGet(url,functionName){AjaxDefault.onlyHeaders=false;AjaxDefault.sendDataGet(url,getFunctionName(functionName));}
function sendDataPost(url,parameters,functionName){AjaxDefault.onlyHeaders=false;AjaxDefault.sendDataPost(url,parameters,getFunctionName(functionName));}
function sendDataGetFast(url,functionName){AjaxDefault.onlyHeaders=true;AjaxDefault.sendDataGet(url,getFunctionName(functionName));}
function sendDataPostFast(url,parameters,functionName){AjaxDefault.onlyHeaders=true;AjaxDefault.sendDataPost(url,parameters,getFunctionName(functionName));}
function verifRequestEnd(){return(AjaxDefault.requestState()>=4);}
