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(D,I,L,C,F,E,J){I=this.parseParams(I);C=typeof(C)==="string"&&C.toUpperCase()==="GET"?"GET":"POST";if(C==="GET"){var G=new Date();D+=I?(D.indexOf("?")===-1?"?":"&")+I:"";D=encodeURI(D)+(D.indexOf("?")===-1?"?":"&")+G.getTime()+G.getMilliseconds();I=null}F=typeof(F)==="string"&&((F=F.toUpperCase())==="JSON"||F==="XML")?F:"TEXT";E=E===false?false:true;var H=this.createXMLHttpRequest();try{var B=this;if(typeof(B.onRunning)==="function"&&!J){B.onRunning()}H.open(C,D,E);if(C==="POST"){H.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}if(E){H.onreadystatechange=function(){if(H.readyState==4){switch(H.status){case 0:case 200:if(typeof(B.onComplete)==="function"){B.onComplete()}if(typeof(L)==="function"){L.call(B,B.parseResult(F,H),H.responseText)}break;case 304:break;case 400:alert("XmlHttpRequest status: [400] Bad Request");break;case 404:alert("XmlHttpRequest status: [404] \nThe requested URL "+D+" was not found on this server.");break;case 409:break;case 503:alert("XmlHttpRequest status: [503] Service Unavailable");break;default:alert("XmlHttpRequest status: ["+H.status+"] Unknow status.")}H=null}};if(H!=null){H.send(I)}}else{if(typeof(B.onRunning)==="function"){B.onRunning()}H.send(I);var K=B.parseResult(F,H);if(typeof(B.onComplete)==="function"){B.onComplete()}if(typeof(L)==="function"){L.call(B,K,H.responseText)}return K}}catch(A){if(typeof(B.onComplete)==="function"){B.onComplete()}alert(this.filename+"/run() error:"+A.description)}},displayDebuggingInfo:function(D,C){if(!this.debugging.debuggingMode){alert(D)}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 A=div.getElementsByTagName("DIV");if(C==="param"){A[0].innerHTML=D}else{A[1].innerHTML=D}}},createXMLHttpRequest:function(){var C=null;if(window.ActiveXObject){var A=["Microsoft.XMLHTTP","MSXML6.XMLHTTP","MSXML5.XMLHTTP","MSXML4.XMLHTTP","MSXML3.XMLHTTP","MSXML2.XMLHTTP","MSXML.XMLHTTP"];for(var B=0;B<A.length;B++){try{C=new ActiveXObject(A[B]);break}catch(D){continue}}}else{C=new XMLHttpRequest()}return C},onXMLHttpRequestError:function(B,A){throw"URL: "+A+"\nreadyState: "+B.readyState+"\nstate: "+B.status+"\nheaders: "+B.getAllResponseHeaders()},parseParams:function(A){var B="";A=A?A:"";if(typeof(A)==="string"){B=A}else{if(typeof(A)==="object"){try{B="JSON="+A.toJSONString()}catch(E){alert("Can't stringify JSON!");return false}}else{alert("Invalid parameters!");return false}}if(this.debugging.isDebugging){var D=this.debugging.linefeed,C="[Original Parameters]"+D+A+D+D+"[Parsed Parameters]"+D+B;this.displayDebuggingInfo(C,"param")}return B},preFilter:function(A){return A.replace(/\xEF\xBB\xBF/g,"")},parseResult:function(C,E){var A=null;switch(C){case"JSON":A=this.preFilter(E.responseText);try{A=A.parseJSON()}catch(F){throw this.filename+"/parseResult() error: can't parse to JSON.\n\n"+E.responseText}break;case"XML":A=E.responseXML;break;case"TEXT":A=this.preFilter(E.responseText);break;default:throw this.filename+"/parseResult() error: unknown response type:"+C}if(this.debugging.isDebugging){var D=this.debugging.linefeed,B="[Response Result of "+C+" Format]"+D+A;if(C==="JSON"){B="[Response Result of TEXT Format]"+D+E.responseText+D+D+B}this.displayDebuggingInfo(B,"result")}return A}};var Ajax=Transport;Ajax.call=Transport.run;if(!Object.prototype.toJSONString){Array.prototype.toJSONString=function(){var B=["["],C,D,F=this.length,A;function E(G){if(C){B.push(",")}B.push(G);C=true}for(D=0;D<F;D++){A=this[D];switch(typeof A){case"undefined":case"function":case"unknown":break;case"object":if(A){if(typeof A.toJSONString==="function"){E(A.toJSONString())}}else{E("null")}break;default:E(A.toJSONString())}}B.push("]");return B.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"};(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){}}};
