(function(d){var k=function(){var a=d("script:last").attr("src"),b=a.indexOf("?"),c={};if(b==-1)b=a.length;c.query=a.substr(b);a=a.substring(0,b);b=a.lastIndexOf("/");c.path=a.substring(0,b+1);return c}();d.jcan={version:0.3,path:k.path,query:k.query};d.browser.ie6=d.browser.msie&&parseInt(d.browser.version)<7;String.prototype.trim=function(){return this.replace(/^[\u3000\s]*|[\u3000\s]*$/g,"")};String.prototype.ltrim=function(){return this.replace(/^[\u3000\s]*/g,"")};String.prototype.rtrim=function(){return this.replace(/[\u3000\s]*$/g,
"")};String.prototype.width=function(){return this.replace(/[^\x00-\xff]/g,"**").length};String.prototype.left=function(a){var b=this.replace(/[^\x00-\xff]/g,"%^");a=b.substr(0,a).replace(/\%\^/g,"^").replace(/\%$/,"").length;return this.substr(0,a)};String.prototype.concatQuery=function(a){return this+(this.indexOf("?")==-1?"?":"&")+a};String.prototype.repeat=function(a){return(new Array(a+1)).join(this)};String.prototype.equal=function(a){return a.replace(/\r/g,"")==this.replace(/\r/g,"")};Array.prototype.unique=
function(){for(var a={},b=[],c=0;c<this.length;c++)a[this[c]]=this[c];for(var e in a)b[b.length]=a[e];return b};Number.prototype.format=function(a,b){var c=this.toString();if(a==null)a=3;if(b==null)b=",";for(a=new RegExp("(\\d+)(\\d{"+a+"})");c.match(a);)c=c.replace(a,"$1"+b+"$2");return c};var l=window.setTimeout;window.setTimeout=function(a,b){if(typeof a=="function"){var c=Array.prototype.slice.call(arguments,2),e=function(){a.apply(null,c)};return l(e,b)}return l(a,b)};d.extend({regexp:{email:/^[0-9a-z\-\_\.]{1,40}@([0-9a-z\-]{1,40}\.){1,4}[a-z]{2,5}$/i,
image:/\.(gif|p?jpe?g|png|bmp)$/i,phone:/^[0-9\-\40]{0,40}$/i,date:/^\d{2}\/\d{2}\/\d{4}$/i},uid:function(){return((new Date).getTime()*1E4+Math.random(1)*1E4).toString(32)},getJsFile:function(a){if(a.indexOf("/")!=-1)a=d.jcan.path+a;return a+d.jcan.query},includeJs:function(a,b,c){if(a&&d.isFunction(a))b&&b();else{if(a){c=b;b=a}if(typeof b=="string")b=[b];a=b.length;var e="_"+d.uid();d[e]=a;if(d.loadingPlugins==undefined)d.loadingPlugins=0;d.loadingPlugins+=a;for(var h=0;h<a;h++)d.ajax({url:d.getJsFile(b[h]),
cache:true,global:false,dataType:"script",success:function(){d.loadingPlugins--;!--d[e]&&c&&c()}})}},run:function(a){d.loadingPlugins?setTimeout(arguments.callee,20,a):a()},loadRun:function(a){d(function(){d.run(a)})},dump:function(a,b,c){var e={separator:"\t",iteration:10};d.extend(e,b||{});if(c==undefined)c=0;if(typeof a=="object"){var h=e.separator.repeat(c);for(var f in a){console.log(h,f,e.separator,a[f]);typeof a[f]=="object"&&c+1<e.iteration&&arguments.callee(a[f],e,c+1)}}else console.log(a)},
compareColor:function(a,b){if(!a||!b)return false;if(a==b)return true;var c=function(e){if(e.substr(0,1)=="#"){if(e.length==4)e=e.replace(/([\da-f])/g,"$1$1");e="rgb("+parseInt(e.substr(1,2),16)+", "+parseInt(e.substr(3,2),16)+", "+parseInt(e.substr(5,2),16)+")"}return e};return c(a)==c(b)}});d.extend({intval:function(a){a=parseInt(a);if(isNaN(a))a=0;return a},redirect:function(a,b){b?d('<form action="'+a+'" method="post" style="display:none"><input type="hidden" name="__confirm" value="1"/></form>').appendTo("body").submit().remove():
d('<form action="'+a+'" method="get" style="display:none"/>').appendTo("body").submit().remove()},check:function(a,b,c){if(a){if(b)d.isFunction(b)?b():d.tip(b);if(c)d.isFunction(c)?c():c.focus()}return!a},_ajaxLight:function(a,b,c,e){var h=this;if(!a||d.isFunction(a)){e=c;c=b;b=a}if(typeof a=="string")a={url:a};var f={url:this.href,global:false,type:"post",data:"__confirm=1",cache:false};d.extend(f,a||{});f.success=c===undefined?b:function(g){switch(g){case "1":b&&b.call(h,g);break;case "0":c&&c.call(h,
g);break;case "-1":default:e&&e.call(h,g);break}};d.ajax(f);return this}});d.fn.extend({hoverClass:function(a){this.each(function(){d(this).hover(function(){d(this).addClass(a)},function(){d(this).removeClass(a)})});return this},toggleValue:function(a,b,c){if(b==undefined)b=true;return this.each(function(){var e=this;if(c)var h=c;else{h=this.title;d(this).removeAttr("title")}b&&d(this).parents("form:first").submit(function(){e.value.equal(h)&&d(e).triggerHandler("focus")});d(this).focus(function(){if(this.value.equal(h)){this.value=
"";a&&d(this).removeClass(a)}}).blur(function(){if(this.value==""||this.value.equal(h)){this.value=h;a&&d(this).addClass(a)}}).triggerHandler("blur")})},ajaxLight:function(a,b,c,e){return this.each(function(){d(this).click(function(){d._ajaxLight.call(this,a,b,c,e);return false})})},confirmLink:function(a,b,c,e){if(c&&!e){e=c;c=null}return this.each(function(){d(this).click(function(){var h=this,f;if(d.isFunction(a))a=a.call(this);f=b===undefined?function(){d.redirect(h.href,true)}:function(){d._ajaxLight.call(h,
b,c,e)};d.confirm(a,f);return false})})}});d.fn.note=function(a,b,c){if(a===false){$$=this;!this.find("> div")[d.fn.note=="fade"?"fadeOut":"slideUp"](function(){$$.empty()}).length&&$$.empty();return $$}b=b||"error";c=(c=c===false?false:true)?'<span class="close">close</span>':"";var e=d('<div class="'+b+'">'+c+'<div class="tip">'+a+"</div></div>").hide();c=e.find("span.close");c.click(function(){e[d.fn.note.fx=="fade"?"fadeOut":"slideUp"]("fast")});this.empty().prepend(e);e[d.fn.note.fx=="fade"?
"fadeIn":"slideDown"]("fast");return this};d.fn.note.fx="fade";d.fn.disabled=function(a){a===false?this.removeAttr("disabled").removeClass("disabled"):this.attr("autocomplete","off").attr("disabled","disabled").addClass("disabled");return this};d.fn.loading=function(){return this.note("Loading ...","loading",false)};d.fn.check=function(a,b,c){if(a){this.note(b);if(d.isFunction(c))c();else c&&c.focus();return false}return true};d.fn.ajaxForm=function(a,b,c){var e=this,h=e.find(":submit").disabled();
a.loading();d.ajax({type:e.attr("method"),url:e.attr("action"),data:e.serialize(),dataType:"json",success:function(f){if(b){b(f);h.disabled(false)}else{if(f.redirect==undefined){f.msg&&a.note(f.msg,f.status);h.disabled(false)}else{var g=function(){switch(f.redirect){case "reload":window.location=window.location.href;break;case "referer":if(document.referrer)window.location=document.referrer;else history.go(-1);break;case "back":history.go(-1);h.disabled(false);break;default:window.location=f.redirect;
break}};if(f.msg){a.note(false);d.alert(f.msg,g);h.disabled(false)}else g()}c&&c(f);if(f.data){f=f.data;for(var j in f){g=eval(j);var i=f[j];if(typeof g=="undefined")return;if(g&&g.length&&g.is(":input")){g.val(i);g[0].defaultValue=i}else g!==null&&g.html(i)}}}}})};d.fn.ajaxAuto=function(a,b){var c=d.extend({url:window.location.href,type:"POST",dataType:"json"},a),e=c.success,h=function(f){if(f.redirect==undefined)f.msg?b.note(f.msg,f.status):b.note(false);else{var g=function(){switch(f.redirect){case "reload":window.location=
window.location.href;break;case "referer":if(document.referrer)window.location=document.referrer;else history.go(-1);break;case "back":history.go(-1);break;default:window.location=f.redirect;break}};if(f.msg){b.note(false);d.alert(f.msg,g)}else g()}if(f.data){f=f.data;for(var j in f){g=eval(j);var i=f[j];if(typeof g!="undefined")if(g&&g.length&&g.is(":input")){g.val(i);g[0].defaultValue=i}else g!==null&&g.html(i)}}};return this.each(function(){var f=this;c.success=function(g){h.call(f,g);e&&e.call(f,
g)};b.loading();d.ajax(c)})}})(jQuery);
