(function(a){a.extend(String,{leftPad:function(e,c,d){var b=new String(e);if(!d){d=" "}while(b.length<c){b=d+b}return b.toString()},format:function(c){var b=Array.prototype.slice.call(arguments,1);return c.replace(/\{(\d+)\}/g,function(d,e){return b[e]})},htmlEncode:function(b){return b.replace(/&/ig,"&amp;").replace(/"/ig,"&quot;").replace(/ /ig,"&nbsp;").replace(/</ig,"&lt;").replace(/>/ig,"&gt;").replace(/\r\n/ig,"<br />").replace(/\n/ig,"<br />")},htmlDecode:function(b){return b.replace(/<br \/>/ig,"\n").replace(/&gt;/ig,">").replace(/&lt;/ig,"<").replace(/&nbsp;/ig," ").replace(/&quot;/ig,'"').replace(/&amp;/ig,"&")}});a.extend(String.prototype,{trim:(function(){var c=/^\s+|\s+$/g;var b=/(^[\u3000]+)|([\u3000]+$)/g;return function(){return this.replace(c,"").replace(b,"")}})(),dLength:function(){var d=0;for(var b=0;b<this.length;b++){var e=this.charAt(b);if(/^[\u0000-\u00ff]$/.test(e)){d+=1}else{d+=2}}return d}});a.extend(Array.prototype,{indexOf:function(d){for(var c=0,b=this.length;c<b;c++){if(this[c]==d){return c}}return -1},remove:function(c){var b=this.indexOf(c);if(b!=-1){this.splice(b,1)}return this},each:function(d){for(var c=0,b=this.length;c<b;c++){d(this[c],c)}}});a.urlEncode=function(j){if(!j){return""}var d=[];for(var g in j){var f=j[g],c=encodeURIComponent(g);var h=typeof f;if(h=="undefined"){d.push(c,"=&")}else{if(h!="function"&&h!="object"){d.push(c,"=",encodeURIComponent(f),"&")}else{if(f&&typeof f.pop=="function"){if(f.length){for(var e=0,b=f.length;e<b;e++){d.push(c,"=",encodeURIComponent(f[e]===undefined?"":f[e]),"&")}}else{d.push(c,"=&")}}}}}d.pop();return d.join("")};a.urlDecode=function(j,h){if(!j||!j.length){return{}}var e={};var c=j.split("&");var d,b,k;for(var f=0,g=c.length;f<g;f++){d=c[f].split("=");b=decodeURIComponent(d[0]);k=decodeURIComponent(d[1]);if(h!==true){if(typeof e[b]=="undefined"){e[b]=k}else{if(typeof e[b]=="string"){e[b]=[e[b]];e[b].push(k)}else{e[b].push(k)}}}else{e[b]=k}}return e}})(jQuery);(function($){var useHasOwn=!!{}.hasOwnProperty;var pad=function(n){return n<10?"0"+n:n};var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};var encodeString=function(s){if(/["\\\x00-\x1f]/.test(s)){return'"'+s.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'"'+s+'"'};var encodeArray=function(o){var a=["["],b,i,l=o.length,v;for(i=0;i<l;i+=1){v=o[i];switch(typeof v){case"undefined":case"function":case"unknown":break;default:if(b){a.push(",")}a.push(v===null?"null":json.encode(v));b=true}}a.push("]");return a.join("")};var isArray=function(v){return v&&typeof v.pop=="function"};var isDate=function(v){return v&&typeof v.getFullYear=="function"};var json={};json.encodeDate=function(o){return'"'+o.getFullYear()+"-"+pad(o.getMonth()+1)+"-"+pad(o.getDate())+"T"+pad(o.getHours())+":"+pad(o.getMinutes())+":"+pad(o.getSeconds())+'"'};json.encode=function(o){if(typeof o=="undefined"||o===null){return"null"}else{if(isArray(o)){return encodeArray(o)}else{if(isDate(o)){return json.encodeDate(o)}else{if(typeof o=="string"){return encodeString(o)}else{if(typeof o=="number"){return isFinite(o)?String(o):"null"}else{if(typeof o=="boolean"){return String(o)}else{var a=["{"],b,i,v;for(i in o){if(!useHasOwn||o.hasOwnProperty(i)){v=o[i];switch(typeof v){case"undefined":case"function":case"unknown":break;default:if(b){a.push(",")}a.push(json.encode(i),":",v===null?"null":json.encode(v));b=true}}}a.push("}");return a.join("")}}}}}}};json.decode=function(json){return eval("("+json+")")};$.extend({json:json})})(jQuery);(function(a){a.extend({cookie:{set:function(b){var e=a.extend({name:null,value:"",expires:null,path:"/",domain:null,secure:false},b);if(!e.name){alert("the name of cookie required");return}var d=e.name+"="+encodeURIComponent(e.value);if(e.expires){d+=";expires="+e.expires.toGMTString()}d+=";path="+e.path;if(e.domain){d+=";domain="+e.domain}if(e.secure){d+=";secure=true"}document.cookie=d},get:function(c){var d=document.cookie.toString();var b=d.match(new RegExp(c+"=([^;]*)","i"));return b!=null?decodeURIComponent(b[1]):null},remove:function(b){this.set({name:b,expires:new Date(new Date().getTime()-86400000)})}}})})(jQuery);