Ajax={};Ajax.createXMLHttpRequest=function(a){var c=false;if(!a){a=window}if(Browser.getEngine()!="ie"){c=new a.XMLHttpRequest();if(c.overrideMimeType){c.overrideMimeType("text/xml")}}else{if(a.ActiveXObject){try{c=new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){try{c=new a.ActiveXObject("Msxml2.XMLHTTP")}catch(b){}}}}if(!c){alert("Giving up :( Cannot create an XMLHTTP instance")}return c};Ajax.ajaxCall=function(source,mode,params,callback){var req=Ajax.createXMLHttpRequest();var ajaxArgs=arguments;function processRequest(){if(req.readyState==4){if(req.status==200){try{var xml=req.responseXML;var root=Ajax.selectNodes(xml,null,"/response");if(root!=null){root=root[0]}var type=root==null?null:root.getAttribute("type");if(type=="xml"||type=="html"){if(callback){if(ajaxArgs.length>4||typeof(callback)=="string"){var call="callback(req";for(var i=4;i<ajaxArgs.length;i++){call+=", ajaxArgs["+i+"]"}call+=")";eval(call)}else{callback(req)}}}else{if(type=="redirect"){window.location=root.firstChild.nodeValue}}}finally{if(Browser.getEngine()=="opera"){req.abort()}}}}}req.onreadystatechange=processRequest;var parameters="action=ajax&source="+source+"&mode="+mode+"&"+params;req.open("POST",window.location.pathname,true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.setRequestHeader("Content-length",parameters.length);req.setRequestHeader("Connection","close");req.send(parameters)};Ajax.selectNodes=function(e,a,b){if(Ajax.isEmpty(e)){return null}if(Browser.getEngine()=="ie"){if(a){return a.selectNodes(b)}else{return e.selectNodes(b)}}else{if(Ajax.isEmpty(e.documentElement)){return null}var d=new Array();var c=e.evaluate(b,a?a:e.documentElement,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);if(c){var f=c.iterateNext();while(f){d[d.length]=f;f=c.iterateNext()}}return d}};Ajax.nodeValue=function(g,f,d){var a=null;try{var b=Ajax.selectNodes(g,f,d)[0];a="";b=b.firstChild;while(b){a+=b.nodeValue;b=b.nextSibling}}catch(c){}return a};Ajax.selectNodeText=function(b,a){return Ajax.nodeValue(b,null,a)};Ajax.quote=function(a){if(encodeURIComponent){return encodeURIComponent(a)}else{return escape(a)}};Ajax.extractHtml=function(e){var b=e.responseXML;var a=Ajax.selectNodes(b,null,"/response")[0];var d="";for(var c=0;c<a.childNodes.length;c++){d+=a.childNodes[c].nodeValue}return d};Ajax.trim=function(a){if(!a){return""}return a.replace(/(^\s+)|(^\u00A0+)|(^\u00A0+)|(\s+$)/g,"")};Ajax.isEmpty=function(a){if(a==null||typeof(a)=="undefined"){return true}if(a instanceof Array){return a.length==0}if(typeof(a)=="string"){return Ajax.trim(a).length==0}return false};
