var _cl_version="1.1";String.prototype.trim=function(){return this.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g,"")};String.prototype.ltrim=function(){return this.replace(/(^[ \t\n\r]*)/g,"")};String.prototype.rtrim=function(){return this.replace(/([ \t\n\r]*$)/g,"")};String.prototype.byteLength=function(){var c=0;if(this.length==0){return 0}for(var a=0;a<this.length;a++){var b=escape(this.charAt(a));if(b.length==1){c++}else{if(b.indexOf("%u")!=-1){c+=2}else{if(b.indexOf("%")!=-1){c+=b.length/3}}}}return c};String.prototype.utf8Length=function(){var b=0;if(this.length==0){return 0}for(var a=0;a<this.length;a++){b+=_cl_charByteSize(this.charAt(a))}return b};if(!document.getElementsByClassName){document.getElementsByClassName=function(d){d=d.trim();var b=document.getElementsByTagName("*");var f=[];for(var c=0;c<b.length;c++){var e=b[c].className.split(" ");for(var a=0;a<e.length;a++){if(d==e[a].trim()){f.push(b[c]);break}}}return f}}function _cl_charByteSize(b){if(b==null||b.length==0){return 0}var a=b.charCodeAt(0);if(a<=127){return 1}else{if(a<=2047){return 2}else{if(a<=65535){return 3}else{return 4}}}}function isArray(a){return Object.prototype.toString.call(a)==="[object Array]"}function inArray(c,d){for(var a=0,b=d.length;a<b;a++){if(d[a]===c){return a}}return -1}function _cl_formutil(){this.version="1.0";this._fnGetValue={input:this.getInputValue,checkbox:this.getCheckboxValue,radio:this.getRadioValue,select:this.getSelectValue,textarea:this.getTextareaValue};this._fnSetValue={input:this.setInputValue,checkbox:this.setCheckboxValue,radio:this.setRadioValue,select:this.setSelectValue,textarea:this.setTextareaValue};this._fnAddValue={input:this.addInputValue,checkbox:this.addCheckboxValue,select:this.addSelectValue,textarea:this.addTextareaValue}}_cl_formutil.prototype.getType=function(b){var a=b.type;if(a==undefined){return"string"}switch(a){case"text":case"hidden":case"button":return"input";case"checkbox":return"checkbox";case"radio":return"radio";case"select-one":case"select-multiple":return"select";case"textarea":return"textarea";default:return undefined}};_cl_formutil.prototype.$=function(b){var a=document.getElementById(b);if(a==null){return this.$name(b)[0]}return a};_cl_formutil.prototype.$name=function(a){return document.getElementsByName(a)};_cl_formutil.prototype.getValue=function(c){var b=this.getType(c);var a="";if(b=="string"){a=c;c=this.$(c);b=this.getType(c)}if(b=="checkbox"||b=="radio"){c=this.$name(a)}if(b==undefined){return undefined}return this._fnGetValue[b](c)};_cl_formutil.prototype.getInputValue=function(a){return a.value};_cl_formutil.prototype.getCheckboxValue=function(c){var b=new Array();for(var a=0;a<c.length;a++){if(c[a].checked){b.push(c[a].value)}}return b};_cl_formutil.prototype.getRadioValue=function(b){for(var a=0;a<b.length;a++){if(b[a].checked){return b[a].value}}return""};_cl_formutil.prototype.getSelectValue=function(a){return a.value};_cl_formutil.prototype.getTextareaValue=function(a){return a.value};_cl_formutil.prototype.setValue=function(c,d){var b=this.getType(c);var a="";if(b=="string"){a=c;c=this.$(c);b=this.getType(c)}if(b=="checkbox"||b=="radio"){c=this.$name(a)}if(b==undefined){return undefined}return this._fnSetValue[b](c,d)};_cl_formutil.prototype.setInputValue=function(a,b){a.value=b};_cl_formutil.prototype.setCheckboxValue=function(b,c){for(var a=0;a<b.length;a++){b[a].checked=false}if(isArray(c)){for(var a=0;a<b.length;a++){if(inArray(b[a].value,c)!=-1){b[a].checked=true}}}else{for(var a=0;a<b.length;a++){if(b[a].value==c){b[a].checked=true}}}};_cl_formutil.prototype.setRadioValue=function(b,c){for(var a=0;a<b.length;a++){if(b[a].value==c){b[a].checked=true}}};_cl_formutil.prototype.setSelectValue=function(b,c){for(var a=0;a<b.length;a++){b[a].selected=false}if(isArray(c)){for(var a=0;a<b.length;a++){if(inArray(b[a].value,c)!=-1){b[a].selected=true}}}else{for(var a=0;a<b.length;a++){if(b[a].value==c){b[a].selected=true}}}};_cl_formutil.prototype.setTextareaValue=function(a,b){a.value=b};_cl_formutil.prototype.addValue=function(c,d){var b=this.getType(c);var a="";if(b=="string"){a=c;c=this.$(c);b=this.getType(c)}if(b=="checkbox"){c=this.$name(a)}else{if(b=="radio"){return undefined}}if(b==undefined){return undefined}return this._fnAddValue[b](c,d)};_cl_formutil.prototype.addInputValue=function(a,b){a.value+=b};_cl_formutil.prototype.addCheckboxValue=function(b,c){if(isArray(c)){for(var a=0;a<b.length;a++){if(inArray(b[a].value,c)!=-1){b[a].checked=true}}}else{for(var a=0;a<b.length;a++){if(b[a].value==c){b[a].checked=true}}}};_cl_formutil.prototype.addSelectValue=function(b,c){if(isArray(c)){for(var a=0;a<b.length;a++){if(inArray(b[a].value,c)!=-1){b[a].selected=true}}}else{for(var a=0;a<b.length;a++){if(b[a].value==c){b[a].selected=true}}}};_cl_formutil.prototype.addTextareaValue=function(a,b){a.value+=b};function _cl_ajax(){this.version="1.0"}_cl_ajax.prototype.connect=function(b){var h=b.url;var g=(b.data==undefined?"":b.data);var d=(b.type==undefined?"POST":b.type);var a=(b.async==undefined?true:b.async);var c=this.getConnection();var f=false;c.onreadystatechange=e;function e(i){if(c.readyState==4){if(!f){f=true;if(b.success){b.success(c)}}}}this.open(c,d,h,a);this.send(c,g);if(!a){e()}};_cl_ajax.prototype.update=function(b){var f=b.url;var e=(b.data==undefined?"":b.data);var d=(b.type==undefined?"POST":b.type);var a=(b.async==undefined?true:b.async);var c=this.getConnection();c.onreadystatechange=function(g){if(c.readyState==4){FormUtil.$(b.target).innerHTML=c.responseText}};this.open(c,d,f,a);this.send(c,e)};_cl_ajax.prototype.configure=function(a){a.setRequestHeader("content-type","application/x-www-form-urlencoded")};_cl_ajax.prototype.getConnection=function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()};_cl_ajax.prototype.open=function(d,c,a,b){d.open(c,a,b);this.configure(d)};_cl_ajax.prototype.send=function(b,a){b.send(a)};function _cl_common(){this.version="1.0";this.strDefaultPrefix="__pfx_cl_default_"}_cl_common.prototype.nvl=function(b,c){try{return(b==null||b==undefined||b.length==0)?c:b}catch(a){return c}};_cl_common.prototype.imageResize=function(d,a,c){var h=((a==undefined||a<=0)?100:a);var f=((c==undefined||c<=0)?80:c);var i=d.width;var j=d.height;var b=((f*i)/j);d.style.width=null;d.style.height=null;if(b>h){d.style.width=h.toString()+"px";var e=((h*j)/i);var g=parseInt((f-e)/2);d.style.marginTop=g.toString()+"px";g+=(g%2);d.style.marginBottom=g.toString()+"px"}else{d.style.height=f.toString()+"px"}};_cl_common.prototype.popup=function(g){var a=g.url;var k=this.nvl(g.width,300);var l=this.nvl(g.height,400);var j=this.nvl(g.scroll,false);var e=this.nvl(g.status,false);var m=this.nvl(g.center,true);var i=this.nvl(g.name,"");var c=this.nvl(g.focus,true);var d=(screen.width-k)/2;var f=(screen.height-l)/2;var h="width="+k+", height="+l+", scrollbars="+(j?"yes":"no")+", status="+(e?"yes":"no");if(m){h+=", top="+f+", left="+d}var b=window.open(a,i,h);if(c){b.focus()}return b};_cl_common.prototype.bindOnload=function(b){var a=window.onload;if(typeof window.onload!="function"){window.onload=b}else{window.onload=function(c){a();b()}}};_cl_common.prototype.autoFocus=function(){var b=document.getElementsByTagName("input");for(var a=0;a<b.length;a++){if(b[a].type=="text"){b[a].focus();break}}};_cl_common.prototype.getRandomId=function(b){var d=this.nvl(b.prefix,this.strDefaultPrefix);var c=this.nvl(b.size,20);var a=null;do{a=d+(Math.random()*((c-d.length)*10).toString())}while(document.getElementById(a)!=null);return a};function Map(){this.version="1.0";this.map={}}Map.prototype.set=function(a,b){this.map[a]=b};Map.prototype.get=function(a){return this.map[a]};Map.prototype.unset=function(a){delete this.map[a]};Map.prototype.each=function(b){for(var a in this.map){b(a,this.map[a])}};Map.prototype.keys=function(){var a=[];this.each(function(b,c){a.push(b)});return a};Map.prototype.values=function(){var a=[];this.each(function(b,c){a.push(c)});return a};Map.prototype.toQueryString=function(){var a=[];this.each(function(b,c){a.push(b+"="+encodeURIComponent(c))});return a.join("&")};Map.prototype.toXML=function(){var a=["<map>"];this.each(function(b,c){a.push('\t<item key="'+b+'"><![CDATA['+c+"]]></item>")});a.push("</map>");return a.join("\r\n")};var FormUtil=new _cl_formutil();var Ajax=new _cl_ajax();var Common=new _cl_common();





