var ajax={bNoCache:true,init:function(bCache){this.bNoCache=(bCache?true:false);},load:function(url,callback,data,userid,password,bText){var self=this;var method="GET";if(data){method="POST";}else if(self.bNoCache){url+=(url.indexOf("?")===-1?"?Open":"")+"&noCache="+(new Date()).getTime();}var req=self.createXMLHTTPObject();if(!req){return req;}try{if(typeof callback==="function"){req.open(method,url,true,userid,password);if(data){req.setRequestHeader('Content-type','application/x-www-form-urlencoded');}req.onreadystatechange=function(){if(req.readyState!==4){return;}if(req.status!==200&&req.status!==304){callback(null,req);return;}if(bText){callback(req.responseText);}else{callback(self.getXML(req));}};if(req.readyState===4){return null;}req.send(data);return true;}req.open(method,url,false,userid,password);if(data){req.setRequestHeader('Content-type','application/x-www-form-urlencoded');}if(req.readyState===4){return null;}req.send(data);return(bText?req.responseText:self.getXML(req));}catch(e){return null;}},loadText:function(url,callback,data,userid,password){return this.load(url,callback,data,userid,password,true);},transform:function(el,xmlData,xslData){if(typeof XSLTProcessor!=="undefined"){this.transform=function(el,xmlData,xslData){if(!(xmlData&&xslData)){return;}try{var xsltProcessor=new XSLTProcessor();xsltProcessor.importStylesheet(xslData);el.innerHTML="";el.appendChild(xsltProcessor.transformToFragment(xmlData,document));}catch(e){alert(e);}};}else{this.transform=function(el,xmlData,xslData){if(!(xmlData&&xslData)){return;}try{el.innerHTML=xmlData.transformNode(xslData.documentElement);}catch(e){alert("Transform error: "+e.number+":"+e.description);}};}this.transform(el,xmlData,xslData);},getXML:function(req){var xmlData=null;try{if(typeof req.responseXML.firstChild!=="undefined"){xmlData=req.responseXML;}}catch(e){try{var xmlDocument=(new DOMParser()).parseFromString(req.responseText,"text/xml");xmlData=xmlDocument;}catch(e){alert(e);}}return xmlData;},DOMDocumentFactories:[function(){return new ActiveXObject("Msxml2.DOMDocument.6.0");},function(){return new ActiveXObject("Msxml2.DOMDocument.3.0");},function(){return new ActiveXObject("Msxml2.DOMDocument");},function(){return new ActiveXObject("Microsoft.DOMDocument");}],DOMDocumentFactory:null,getXMLFromString:function(str){if(typeof DOMParser!=="undefined"){this.getXMLFromString=function(str){try{return(new DOMParser()).parseFromString(str,"text/xml");}catch(e){return null;}};return this.getXMLFromString(str);}var req=null;if(window.ActiveXObject){for(var i=0;i<this.DOMDocumentFactories.length;i++){try{req=this.DOMDocumentFactories[i]();this.DOMDocumentFactory=this.DOMDocumentFactories[i];this.getXMLFromString=function(str){var req=null;try{req=this.DOMDocumentFactory();req.async=false;req.loadXML(str);}catch(e){req=null;}return req;};return this.getXMLFromString(str);}catch(e){continue;}break;}}return req;},XMLHttpFactories:[function(){return new XMLHttpRequest();},function(){return new ActiveXObject("Msxml2.XMLHTTP.6.0");},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0");},function(){return new ActiveXObject("Msxml2.XMLHTTP");},function(){return new ActiveXObject("Microsoft.XMLHTTP");}],XMLHttpFactory:null,createXMLHTTPObject:function(){var req=null;for(var i=0;i<this.XMLHttpFactories.length;i++){try{req=this.XMLHttpFactories[i]();this.XMLHttpFactory=this.XMLHttpFactories[i];this.createXMLHTTPObject=function(){var req=null;try{req=this.XMLHttpFactory();}catch(e){req=null;}return req;};return req;}catch(e){continue;}break;}this.createXMLHTTPObject=function(){return null;};return req;},getNodeValue:function(obj,tag){try{return obj.getElementsByTagName(tag)[0].firstChild.nodeValue;}catch(e){return"";}}};
