Portal={version:"1.0"},Portal.ColorPicker=function(a){var c,b=this;this.isShow=!1,this.target=$(a),this.button=$("<input type='text' tabindex='10000' readonly='readonly' style='background-color:#fff;width:30px;border:1px solid #ccc;margin-left:2px;cursor:pointer'/>"),this.target.after(this.button),this.over=function(){$(this).css("border","1px solid #000")},this.out=function(){$(this).css("border","1px solid #fff")},this.click=function(){var a=$(this).attr("title");b.setColor(a),this.isShow=!1,b.picker.hide()},this.createPicker=function(){var e,f,g,a=["#FF8080","#FFFF80","#80FF80","#00FF80","#80FFFF","#0080FF","#FF80C0","#FF80FF","#FF0000","#FFFF00","#80FF00","#00FF40","#00FFFF","#0080C0","#8080C0","#FF00FF","#804040","#FF8040","#00FF00","#008080","#004080","#8080FF","#800040","#FF0080","#800000","#FF8000","#008000","#008040","#0000FF","#0000A0","#800080","#8000FF","#400000","#804000","#004000","#004040","#000080","#000040","#400040","#400080","#000000","#808000","#808040","#808080","#408080","#C0C0C0","#400040","#FFFFFF"],c="<table border='0' cellpadding='0' cellspacing='5' style='display:none;position:absolute;margin-top:0px;border:1px solid #ccc;background-color:#fff'><tr height='15'>",d=8;for(e=0,f=a.length;f>e;e++)c+="<td width='15'><div class='c' style='width:13px;height:13px;z-index：9999border:1px solid #fff;cursor:pointer;background-color:"+a[e]+"' title='"+a[e]+"'>&nbsp;<div></td>",e+1!=a.length&&0==(e+1)%d&&(c+="</tr><tr height='15'>");return c+="</tr></table>",g=$(c),g.find(".c").each(function(){$(this).bind("mouseover",b.over),$(this).bind("mouseout",b.out),$(this).bind("click",b.click)}),$(document.body).append(g),g},this.setColor=function(a){b.target.val(a),""==a&&(a="#fff");try{b.button.css({backgroundColor:a})}catch(c){alert("color error: "+a),b.target.focus().select()}},this.picker=this.createPicker(),this.showPicker=function(){b.isShow||(b.isShow=!0,b.picker.showBy(b.target),$(document).bind("mousedown",function(){$(document).unbind("mousedown"),setTimeout(function(){b.isShow=!1,b.picker.hide(),b.target.val(),b.setColor(b.target.val())},200)}))},this.button.bind("click",b.showPicker),this.target.bind("blur",function(){b.setColor(b.target.val())}),c=this.target.val(),""!=c&&this.setColor(c)},$.fn.extend({colorPicker:function(){new Portal.ColorPicker(this)}});