CKEDITOR.dialog.add("uicolor",function(r){var q,p,o,n=r.getUiColor(),m="cke_uicolor_picker"+CKEDITOR.tools.getNextNumber();function l(a){if(/^#/.test(a)){a=window.YAHOO.util.Color.hex2rgb(a.substr(1))}p.setValue(a,true);p.refresh(m)}function k(b,a){if(a||q._.contents.tab1.livePeview.getValue()){r.setUiColor(b)}q._.contents.tab1.configBox.setValue('config.uiColor = "#'+p.get("hex")+'"')}o={id:"yuiColorPicker",type:"html",html:"<div id='"+m+"' class='cke_uicolor_picker' style='width: 360px; height: 200px; position: relative;'></div>",onLoad:function(d){var c=CKEDITOR.getUrl("plugins/uicolor/yui/");p=new window.YAHOO.widget.ColorPicker(m,{showhsvcontrols:true,showhexcontrols:true,images:{PICKER_THUMB:c+"assets/picker_thumb.png",HUE_THUMB:c+"assets/hue_thumb.png"}});if(n){l(n)}p.on("rgbChange",function(){q._.contents.tab1.predefined.setValue("");k("#"+p.get("hex"))});var b=new CKEDITOR.dom.nodeList(p.getElementsByTagName("input"));for(var a=0;a<b.count();a++){b.getItem(a).addClass("cke_dialog_ui_input_text")}}};var j=true;return{title:r.lang.uicolor.title,minWidth:360,minHeight:320,onLoad:function(){q=this;this.setupContent();if(CKEDITOR.env.ie7Compat){q.parts.contents.setStyle("overflow","hidden")}},contents:[{id:"tab1",label:"",title:"",expand:true,padding:0,elements:[o,{id:"tab1",type:"vbox",children:[{id:"livePeview",type:"checkbox",label:r.lang.uicolor.preview,"default":1,onLoad:function(){j=true},onChange:function(){if(j){return}var b=this.getValue(),a=b?"#"+p.get("hex"):n;k(a,true)}},{type:"hbox",children:[{id:"predefined",type:"select","default":"",label:r.lang.uicolor.predefined,items:[[""],["Light blue","#9AB8F3"],["Sand","#D2B48C"],["Metallic","#949AAA"],["Purple","#C2A3C7"],["Olive","#A2C980"],["Happy green","#9BD446"],["Jezebel Blue","#14B8C4"],["Burn","#FF893A"],["Easy red","#FF6969"],["Pisces 3","#48B4F2"],["Aquarius 5","#487ED4"],["Absinthe","#A8CF76"],["Scrambled Egg","#C7A622"],["Hello monday","#8E8D80"],["Lovely sunshine","#F1E8B1"],["Recycled air","#B3C593"],["Down","#BCBCA4"],["Mark Twain","#CFE91D"],["Specks of dust","#D1B596"],["Lollipop","#F6CE23"]],onChange:function(){var a=this.getValue();if(a){l(a);k(a);CKEDITOR.document.getById("predefinedPreview").setStyle("background",a)}else{CKEDITOR.document.getById("predefinedPreview").setStyle("background","")}},onShow:function(){var a=r.getUiColor();if(a){this.setValue(a)}}},{id:"predefinedPreview",type:"html",html:'<div id="cke_uicolor_preview" style="border: 1px solid black; padding: 3px; width: 30px;"><div id="predefinedPreview" style="width: 30px; height: 30px;">&nbsp;</div></div>'}]},{id:"configBox",type:"text",label:r.lang.uicolor.config,onShow:function(){var a=r.getUiColor();if(a){this.setValue('config.uiColor = "'+a+'"')}}}]}]}],buttons:[CKEDITOR.dialog.okButton]}});