var Transport={filename:"transport.js",debugging:{isDebugging:0,debuggingMode:0,linefeed:"",containerId:0},debug:function(b,a){this.debugging={isDebugging:b,debuggingMode:a,linefeed:a?"<br />":"\n",containerId:"dubugging-container"+new Date().getTime()}},onComplete:function(){},onRunning:function(){},run:function(b,e,j,a,f,i,c){e=this.parseParams(e);a=typeof(a)==="string"&&a.toUpperCase()==="GET"?"GET":"POST";if(a==="GET"){var h=new Date();b+=e?(b.indexOf("?")===-1?"?":"&")+e:"";b=encodeURI(b)+(b.indexOf("?")===-1?"?":"&")+h.getTime()+h.getMilliseconds();e=null}f=typeof(f)==="string"&&((f=f.toUpperCase())==="JSON"||f==="XML")?f:"TEXT";i=i===false?false:true;var l=this.createXMLHttpRequest();try{var k=this;if(typeof(k.onRunning)==="function"&&!c){k.onRunning()}l.open(a,b,i);if(a==="POST"){l.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}if(i){l.onreadystatechange=function(){if(l.readyState==4){switch(l.status){case 0:case 200:if(typeof(k.onComplete)==="function"){k.onComplete()}if(typeof(j)==="function"){j.call(k,k.parseResult(f,l),l.responseText)}break;case 304:break;case 400:alert("XmlHttpRequest status: [400] Bad Request");break;case 404:alert("XmlHttpRequest status: [404] \nThe requested URL "+b+" was not found on this server.");break;case 409:break;case 503:alert("XmlHttpRequest status: [503] Service Unavailable");break;default:alert("XmlHttpRequest status: ["+l.status+"] Unknow status.")}l=null}};if(l!=null){l.send(e)}}else{if(typeof(k.onRunning)==="function"){k.onRunning()}l.send(e);var m=k.parseResult(f,l);if(typeof(k.onComplete)==="function"){k.onComplete()}if(typeof(j)==="function"){j.call(k,m,l.responseText)}return m}}catch(g){if(typeof(k.onComplete)==="function"){k.onComplete()}alert(this.filename+"/run() error:"+g.description)}},displayDebuggingInfo:function(c,a){if(!this.debugging.debuggingMode){alert(c)}else{var e=this.debugging.containerId;if(!document.getElementById(e)){div=document.createElement("DIV");div.id=e;div.style.position="absolute";div.style.width="98%";div.style.border="1px solid #f00";div.style.backgroundColor="#eef";var b=document.body.scrollTop||window.pageYOffset||0;div.style.top=document.body.clientHeight*0.6+b+"px";document.body.appendChild(div);div.innerHTML="<div></div><hr style='height:1px;border:1px dashed red;'><div></div>"}var d=div.getElementsByTagName("DIV");if(a==="param"){d[0].innerHTML=c}else{d[1].innerHTML=c}}},createXMLHttpRequest:function(){var d=null;if(window.ActiveXObject){var a=["Microsoft.XMLHTTP","MSXML6.XMLHTTP","MSXML5.XMLHTTP","MSXML4.XMLHTTP","MSXML3.XMLHTTP","MSXML2.XMLHTTP","MSXML.XMLHTTP"];for(var c=0;c<a.length;c++){try{d=new ActiveXObject(a[c]);break}catch(b){continue}}}else{d=new XMLHttpRequest()}return d},onXMLHttpRequestError:function(b,a){throw"URL: "+a+"\nreadyState: "+b.readyState+"\nstate: "+b.status+"\nheaders: "+b.getAllResponseHeaders()},parseParams:function(d){var e="";d=d?d:"";if(typeof(d)==="string"){e=d}else{if(typeof(d)==="object"){try{e="JSON="+d.toJSONString()}catch(b){alert("Can't stringify JSON!");return false}}else{alert("Invalid parameters!");return false}}if(this.debugging.isDebugging){var a=this.debugging.linefeed,c="[Original Parameters]"+a+d+a+a+"[Parsed Parameters]"+a+e;this.displayDebuggingInfo(c,"param")}return e},preFilter:function(a){return a.replace(/\xEF\xBB\xBF/g,"")},parseResult:function(c,f){var a=null;switch(c){case"JSON":a=this.preFilter(f.responseText);try{a=a.parseJSON()}catch(d){throw this.filename+"/parseResult() error: can't parse to JSON.\n\n"+f.responseText}break;case"XML":a=f.responseXML;break;case"TEXT":a=this.preFilter(f.responseText);break;default:throw this.filename+"/parseResult() error: unknown response type:"+c}if(this.debugging.isDebugging){var b=this.debugging.linefeed,e="[Response Result of "+c+" Format]"+b+a;if(c==="JSON"){e="[Response Result of TEXT Format]"+b+f.responseText+b+b+e}this.displayDebuggingInfo(e,"result")}return a}};var Ajax=Transport;Ajax.call=Transport.run;if(!Object.prototype.toJSONString){Array.prototype.toJSONString=function(){var e=["["],c,g,d=this.length,f;function h(a){if(c){e.push(",")}e.push(a);c=true}for(g=0;g<d;g++){f=this[g];switch(typeof f){case"undefined":case"function":case"unknown":break;case"object":if(f){if(typeof f.toJSONString==="function"){h(f.toJSONString())}}else{h("null")}break;default:h(f.toJSONString())}}e.push("]");return e.join("")};Boolean.prototype.toJSONString=function(){return String(this)};Date.prototype.toJSONString=function(){function a(b){return b<10?"0"+b:b}return'"'+this.getFullYear()+"-"+a(this.getMonth()+1)+"-"+a(this.getDate())+"T"+a(this.getHours())+":"+a(this.getMinutes())+":"+a(this.getSeconds())+'"'};Number.prototype.toJSONString=function(){return isFinite(this)?String(this):"null"};Object.prototype.toJSONString=function(){var d=["{"],c,f,e;function g(a){if(c){d.push(",")}d.push(f.toJSONString(),":",a);c=true}for(f in this){if(this.hasOwnProperty(f)){e=this[f];switch(typeof e){case"undefined":case"function":case"unknown":break;case"object":if(e){if(typeof e.toJSONString==="function"){g(e.toJSONString())}}else{g("null")}break;default:g(e.toJSONString())}}}d.push("}");return d.join("")};(function(s){var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};s.parseJSON=function(filter){try{if(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(this)){var j=eval("("+this+")");if(typeof filter==="function"){function walk(k,v){if(v&&typeof v==="object"){for(var i in v){if(v.hasOwnProperty(i)){v[i]=walk(i,v[i])}}}return filter(k,v)}j=walk("",j)}return j}}catch(e){}throw new SyntaxError("parseJSON")};s.toJSONString=function(){var _self=this.replace("&","%26");if(/["\\\x00-\x1f]/.test(this)){return'"'+_self.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c}c=b.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+_self+'"'}})(String.prototype)}Ajax.onRunning=showLoader;Ajax.onComplete=hideLoader;function showLoader(){document.getElementsByTagName("body").item(0).style.cursor="wait";if(top.frames["header-frame"]){top.frames["header-frame"].document.getElementById("load-div").style.display="block"}else{var a=document.getElementById("loader");if(!a&&process_request){a=document.createElement("DIV");a.id="loader";a.innerHTML=process_request;document.body.appendChild(a)}}}function hideLoader(){document.getElementsByTagName("body").item(0).style.cursor="auto";if(top.frames["header-frame"]){setTimeout(function(){top.frames["header-frame"].document.getElementById("load-div").style.display="none"},10)}else{try{var b=document.getElementById("loader");b.style.display="none";document.body.removeChild(b)}catch(a){}}};

