Object.extend=function(A,C){for(var B in C){A[B]=C[B]}return A};Object.extend(Object,{clone:function(A){return Object.extend({},A)}});var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};var G=function(A){if(typeof A=="string"){A=document.getElementById(A)}return A};function hide(A){var A=G(A);if(A){A.style.display="none"}}function show(A){var A=G(A);if(A){A.style.display=""}}function goTop(){window.scrollTo(0,0)}function stopB(A){if(!A){A=window.event}A.cancelBubble=true}function gWidth(A){return G(A).offsetWidth}function returnFileType(B){var A="";switch(parseInt(B)){case 1:A="doc";break;case 2:A="ppt";break;case 3:A="txt";break;case 4:A="xls";break;case 5:A="pdf";break;case 6:A="rtf";break}return(A=="")?"":"<img src='/-/imgs/"+A+".gif'/>&nbsp;"}var $A=function(D){if(!D){return[]}if(D.toArray){return D.toArray()}else{var C=[];for(var B=0,A=D.length;B<A;B++){C.push(D[B])}return C}};Function.prototype.bind=function(){var A=this,C=$A(arguments),B=C.shift();return function(){return A.apply(B,C.concat($A(arguments)))}};Function.prototype.bindAsEventListener=function(B){var A=this;return function(C){A.call(B,C||window.event)}};function parsReplace(A){return A.replace(/%00/g,"%26%2300")}Object.extend(String.prototype,{Alltrim:function(){return this.replace(/(^[กก\s]+)|([กก\s]+$)/g,"")},byteLength:function(){return this.replace(/[^\u0000-\u007f]/g,"\u0061\u0061").length},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},escapeJS:function(){return this.replace(/'/g,"&#39;").replace(/"/g,"&#34;")},escapeHTML:function(){return this.replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){var A=document.createElement("div");A.innerHTML=this.stripTags();return A.childNodes[0]?A.childNodes[0].nodeValue:""}});Object.extend(Array.prototype,{indexOf:function(C){for(var B=0,A=this.length;B<A;B++){if(this[B]==C){return B}}return -1},contains:function(A){return(this.indexOf(A)>=0)},clear:function(){this.length=0},removeAt:function(A){this.splice(A,1)},remove:function(B){var A=this.indexOf(B);if(A>=0){this.removeAt(A)}},unique:function(){var C=new Array();var A=this.length;for(var B=0;B<A;B++){if(!C.contains(this[B])){C.push(this[B])}}return C}});if(!window.Event){var Event=new Object()}Object.extend(Event,{observe:function(B,D,C,A){var B=G(B);A=A||false;if(D=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||B.attachEvent)){D="keydown"}if(B.addEventListener){B.addEventListener(D,C,A)}else{if(B.attachEvent){B.attachEvent("on"+D,C)}}},element:function(A){return A.target||A.srcElement}});var encode=encodeURIComponent;var decode=decodeURIComponent;function getCookieVal(B){var A=document.cookie.indexOf(";",B);if(A==-1){A=document.cookie.length}return unescape(document.cookie.substring(B,A))}function getCookie(D){var B=D+"=",F=B.length,A=document.cookie.length,E=0;while(E<A){var C=E+F;if(document.cookie.substring(E,C)==B){return getCookieVal(C)}E=document.cookie.indexOf(" ",E)+1;if(E==0){break}}return null}function setCookie(B,A){var F=30*24*60*60*1000,D=new Date(),E="/",C="baidu.com";D.setTime(D.getTime()+F);document.cookie=B+"="+A+";expires="+D.toGMTString()+";path="+E+";domain="+C}var Try={these:function(){var D;for(var C=0,A=arguments.length;C<A;C++){var B=arguments[C];try{D=B();break}catch(E){}}return D}};var Ajax={getTransport:function(){return Try.these(function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest()})||false}};Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(A){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",parameters:""};Object.extend(this.options,A||{})},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300)},responseIsFailure:function(){return !this.responseIsSuccess()}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{initialize:function(B,A){this.transport=Ajax.getTransport();this.setOptions(A);this.request(B)},request:function(B){this.url=B;var C=this.options.parameters||"";if(C.length>0){C+="&_="}if(this.options.method=="get"&&C.length>0){this.url+=(this.url.match(/\?/)?"&":"?")+C}try{this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous){setTimeout(function(){this.respondToReadyState(1)}.bind(this),10)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();var A=this.options.postBody?this.options.postBody:C;this.transport.send(this.options.method=="post"?A:null)}catch(D){this.dispatchException(D)}},setRequestHeaders:function(){var C=["X-Requested-With","XMLHttpRequest"];if(this.options.method=="post"){var B=this.options.contentType;C.push("Content-type",B);if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){C.push("Connection","close")}}if(this.options.requestHeaders){C.push.apply(C,this.options.requestHeaders)}for(var A=0;A<C.length;A+=2){this.transport.setRequestHeader(C[A],C[A+1])}},onStateChange:function(){var A=this.transport.readyState;if(A!=1){this.respondToReadyState(this.transport.readyState)}},header:function(A){try{return this.transport.getResponseHeader(A)}catch(B){}},evalJSON:function(){try{return eval(this.header("X-JSON"))}catch(e){}},evalResponse:function(){try{return eval(this.transport.responseText)}catch(e){this.dispatchException(e)}},respondToReadyState:function(A){var C=Ajax.Request.Events[A];var E=this.transport,B=this.evalJSON();if(C=="Complete"){try{(this.options["on"+this.transport.status]||this.options["on"+(this.responseIsSuccess()?"Success":"Failure")]||function(){})(E,B)}catch(D){this.dispatchException(D)}if((this.header("Content-type")||"text/javascript").match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){this.evalResponse()}}try{(this.options["on"+C]||function(){})(E,B)}catch(D){this.dispatchException(D)}if(C=="Complete"){this.transport.onreadystatechange=function(){}}},dispatchException:function(A){(this.options.onException||function(){})(this,A)}});