(function(e){function p(a){if(arguments.length!=1||a==null)return null;for(var i=a.offsetTop,b=a.offsetLeft,d=a.offsetWidth,g=a.offsetHeight;a=a.offsetParent;){i+=a.offsetTop;b+=a.offsetLeft}return{Top:i,Left:b,Width:d,Height:g}}var j={Top:-1,Left:-1,Width:-1,Height:-1};e.fn.colorPicker=function(a){var i=this;if(a){if(a.constructor!=Object)a={setBackground:a}}else a={};var b={setBackground:true,setValue:false,setColor:false,setText:false,align:"left"};e.extend(b,a);e.each(b,function(c,f){if(f!=false&&
c!="align")if(typeof f=="string"||typeof f=="object"&&f.nodeName)b[c]=e(f);else if(f==true)b[c]=i;else typeof f=="object"&&f.attr||(b[c]=false)});if(b.align.toLowerCase()!="left")b.align="right";var d=e("#fy_ColorPicker"),g=e("#fy_CP_Frame");if(d.length==0){d=e('<div id="fy_ColorPicker"></div>');d.css({position:"absolute","z-index":"10000","background-color":"#FFFFFF",border:"1px solid #CCCCCC",padding:"1px",cursor:"pointer",display:"none"});a=["FF","CC","99","66","33","00"];var q=0,k=0,m,n,o,r,l=
[];l[0]='<table cellspacing="1" cellpadding="0" style="table-layout:fixed"><tr>';for(m=0;m<6;m++)for(n=0;n<6;n++)for(o=0;o<6;o++){r=a[m]+a[n]+a[o];if(q%18==0&&q>0){l[k+1]="</tr><tr>";k++}l[k+1]='<td class="color" bgcolor="#'+r+'" height="10" width="10" style="width:10px"></td>';q++;k++}l[k+1]='</tr><tr><td height="10" colspan="16" id="fy_ColorPicker_Select" style="font-family:Tamoha;font-size:10px;text-align:center;cursor:default;"></td><td class="color" bgcolor="" height="10" colspan="1" title="Empty" align="center" style="font-family:Tamoha;font-size:10px">E</td><td class="color" bgcolor="transparent" height="10" colspan="1" title="Transparent" align="center" style="font-family:Tamoha;font-size:10px">T</td></tr></table>';
d.html(l.join(""));d.appendTo(document.body);if(e.browser.msie&&g.length==0){g=e('<iframe scrolling="no" frameborder="0" style="position:absolute;z-index:99;display:none" id="fy_CP_Frame"></iframe>');g.appendTo(document.body)}}a=p(i[0]);if(d.is(":visible")&&a.Top==j.Top&&a.Left==j.Left){d.hide();e.browser.msie&&g.hide()}else{j=a;d.css({left:a.Left+(b.align.toLowerCase()!="left"?a.Width:0)+"px",top:a.Top+a.Height+"px"});a=p(d[0]);g.css({left:a.Left,top:a.Top,width:a.Width,height:a.Height});d.show();
e.browser.msie&&g.show();var s=e(document).click(function(c){var f=c.target,h;if(h=d.is(":visible")){h=p(f);h=!(j.Top==h.Top&&j.Left==h.Left&&j.Width==h.Width&&j.Height==h.Height)&&f!=d[0]&&d.find("*").index(f)==-1}if(h){d.hide();e.browser.msie&&g.hide()}s.unbind("click",arguments.callee)});e(".color",d).unbind("mouseover").unbind("click").mouseover(function(){var c=this.bgColor.toUpperCase();c=c=="TRANSPARENT"?"transparent":c;e("#fy_ColorPicker_Select").css("background-color",c).text(c)}).click(function(){d.hide();
var c=this.bgColor.toUpperCase();c=c=="TRANSPARENT"?"transparent":c;b.setBackground!=false&&b.setBackground.css("background-color",c);b.setColor!=false&&b.setColor.css("color",c);b.setValue!=false&&b.setValue.val(c);b.setText!=false&&b.setText.text(c)})}};e.fn.titleColorPicker=function(a,i){var b=this;this.click(function(){b.colorPicker({setColor:a,setValue:i})})}})(jQuery);
