(function(){var b;var a=function(){if(b){return b}var c={WM:["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],aN:["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],XM:["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79","#990000","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47","#660000","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]};var d='<div class="goog-palette"><table cellspacing="0" cellpadding="0"  class="goog-palette-table"><tbody class="goog-palette-body">';var f="</tbody></table></div>";var e="";$H(c).each(function(g,h){e+=d;g.each(function(i,k){var j=i.hexToRgb();if(k==0){e+='<tr class="goog-palette-row">'}e+='<td class="goog-palette-cell"><div title="'+j+'" style="background-color: '+j+';" class="goog-palette-colorswatch"/></td>';if((k+1)%8==0){if((k+1)==g.length){e+="</tr>"}else{e+='</tr><tr class="goog-palette-row">'}}});e+=f});b=e;return e};GoogColorPicker=new Class({Implements:[Events,Options],options:{onSelect:Class.empty,onShow:Class.empty,offsets:{x:10,y:10}},initialize:function(d,c){this.setOptions(c);this.el=$(d);this.showing=false;var e=this;this.el.addEvents({click:function(f){e.showPanel(f)},mouseleave:function(){e.selecting=false;e.blurEl()},mouseenter:function(){e.selecting=true}})},onSelect:function(c,d){this.fireEvent("select",[d,c,this.el]);this.selecting=false;this.hidePanel()},blurEl:function(){this.hd=this.hidePanel.delay(850,this)},position:function(f){var d=window.getSize(),c=window.getScroll();var g={x:this.gcp_panel.offsetWidth,y:this.gcp_panel.offsetHeight};var e={x:"left",y:"top"};for(var h in e){var i=f.page[h]+this.options.offsets[h];if((i+g[h]-c[h])>d[h]){i=f.page[h]-this.options.offsets[h]-g[h]}this.gcp_panel.setStyle(e[h],i)}},hidePanel:function(){if(this.selecting){return}if(this.gcp_panel){this.gcp_panel.setStyle("visibility","hidden")}},showPanel:function(e){var d=this;var c=this.el.uid||Native.UID++;if(!$("gcp_panel"+c)){var f=this.gcp_panel=$("gcp_panel"+c)||new Element("div",{id:"gcp_panel"+c,"class":"goog-palette-panel"}).setHTML(a()).inject($("tabernacle"));f.addEvents({mousemove:function(){d.selecting=true},mouseleave:function(){d.selecting=false;d.blurEl()}});$ES(".goog-palette-cell",f).addEvents({mouseover:function(g){this.addClass("goog-palette-cell-hover")},mouseleave:function(g){this.removeClass("goog-palette-cell-hover")},click:function(i){var g=this.getElement(".goog-palette-colorswatch").get("title");var h=g.rgbToHex();d.onSelect(g,h)}})}this.position(e);this.fireEvent("show",this.el,this);this.gcp_panel.setStyle("visibility","visible")}})})();