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,D,I,A,E,H,C){D=this.parseParams(D);A=typeof(A)==="string"&&A.toUpperCase()==="GET"?"GET":"POST";if(A==="GET"){var G=new Date();B+=D?(B.indexOf("?")===-1?"?":"&")+D:"";B=encodeURI(B)+(B.indexOf("?")===-1?"?":"&")+G.getTime()+G.getMilliseconds();D=null}E=typeof(E)==="string"&&((E=E.toUpperCase())==="JSON"||E==="XML")?E:"TEXT";H=H===false?false:true;var K=this.createXMLHttpRequest();try{var J=this;if(typeof(J.onRunning)==="function"&&!C){J.onRunning()}K.open(A,B,H);if(A==="POST"){K.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}if(H){K.onreadystatechange=function(){if(K.readyState==4){switch(K.status){case 0:case 200:if(typeof(J.onComplete)==="function"){J.onComplete()}if(typeof(I)==="function"){I.call(J,J.parseResult(E,K),K.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: ["+K.status+"] Unknow status.")}K=null}};if(K!=null){K.send(D)}}else{if(typeof(J.onRunning)==="function"){J.onRunning()}K.send(D);var L=J.parseResult(E,K);if(typeof(J.onComplete)==="function"){J.onComplete()}if(typeof(I)==="function"){I.call(J,L,K.responseText)}return L}}catch(F){if(typeof(J.onComplete)==="function"){J.onComplete()}alert(this.filename+"/run() error:"+F.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 C=["["],A,E,B=this.length,D;function F(G){if(A){C.push(",")}C.push(G);A=true}for(E=0;E<B;E++){D=this[E];switch(typeof D){case"undefined":case"function":case"unknown":break;case"object":if(D){if(typeof D.toJSONString==="function"){F(D.toJSONString())}}else{F("null")}break;default:F(D.toJSONString())}}C.push("]");return C.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 B=["{"],A,D,C;function E(F){if(A){B.push(",")}B.push(D.toJSONString(),":",F);A=true}for(D in this){if(this.hasOwnProperty(D)){C=this[D];switch(typeof C){case"undefined":case"function":case"unknown":break;case"object":if(C){if(typeof C.toJSONString==="function"){E(C.toJSONString())}}else{E("null")}break;default:E(C.toJSONString())}}}B.push("}");return B.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){}}};
