var TCP=new TColorPicker();function TCPopup(e,c){this.field=e;this.initPalette=!c||c>3?0:c;var b=194,d=240,a=screen?",left="+((screen.width-b)>>1)+",top="+((screen.height-d)>>1):"",f=window.open("picker.html",null,"help=no,status=no,scrollbars=no,resizable=no"+a+",width="+b+",height="+d+",dependent=yes",true);f.opener=window;f.focus()}function TCBuildCell(d,c,e,a,b){return'<td bgcolor="#'+this.dec2hex((d<<16)+(c<<8)+e)+'"><a href="javascript:P.S(\''+this.dec2hex((d<<16)+(c<<8)+e)+"')\" onmouseover=\"P.P('"+this.dec2hex((d<<16)+(c<<8)+e)+'\')"><img src="pixel.gif" width="'+a+'" height="'+b+'" border="0"></a></td>'}function TCSelect(a){this.field.value=""+a.toUpperCase();this.field.onchange();this.win.close()}function TCPaint(b,a){b=(a?"":"#")+b.toUpperCase();if(this.o_samp){this.o_samp.innerHTML="<font face=Tahoma size=2>"+b+" <font color=white>"+b+"</font></font>"}if(this.doc.layers){this.sample.bgColor=b}else{if(this.sample.backgroundColor!=null){this.sample.backgroundColor=b}else{if(this.sample.background!=null){this.sample.background=b}}}}function TCGenerateSafe(){var a="";for(j=0;j<12;j++){a+="<tr>";for(k=0;k<3;k++){for(i=0;i<=5;i++){a+=this.bldCell(k*51+(j%2)*51*3,Math.floor(j/2)*51,i*51,8,10)}}a+="</tr>"}return a}function TCGenerateWind(){var a="";for(j=0;j<12;j++){a+="<tr>";for(k=0;k<3;k++){for(i=0;i<=5;i++){a+=this.bldCell(i*51,k*51+(j%2)*51*3,Math.floor(j/2)*51,8,10)}}a+="</tr>"}return a}function TCGenerateMac(){var d="";var l=0,h=1;var f,e,a;for(j=0;j<15;j++){d+="<tr>";for(k=0;k<3;k++){for(i=0;i<=5;i++){if(j<12){d+=this.bldCell(255-(Math.floor(j/2)*51),255-(k*51+(j%2)*51*3),255-(i*51),8,10)}else{if(h<=14){f=255-(h*17);e=a=0}else{if(h>14&&h<=28){e=255-((h-14)*17);f=a=0}else{if(h>28&&h<=42){a=255-((h-28)*17);f=e=0}else{f=e=a=255-((h-42)*17)}}}d+=this.bldCell(f,e,a,8,10);h++}}}d+="</tr>"}return d}function TCGenerateGray(){var a="";for(j=0;j<=15;j++){a+="<tr>";for(k=0;k<=15;k++){g=Math.floor((k+j*16)%256);a+=this.bldCell(g,g,g,9,7)}a+="</tr>"}return a}function TCDec2Hex(a){a=a.toString(16);for(;a.length<6;a="0"+a){}return a}function TCChgMode(b){for(var a in this.divs){this.hide(a)}this.show(b)}function TColorPicker(a){this.build0=TCGenerateSafe;this.build1=TCGenerateWind;this.build2=TCGenerateGray;this.build3=TCGenerateMac;this.show=document.layers?function(b){this.divs[b].visibility="show"}:function(b){this.divs[b].visibility="visible"};this.hide=document.layers?function(b){this.divs[b].visibility="hide"}:function(b){this.divs[b].visibility="hidden"};this.C=TCChgMode;this.S=TCSelect;this.P=TCPaint;this.popup=TCPopup;this.draw=TCDraw;this.dec2hex=TCDec2Hex;this.bldCell=TCBuildCell;this.divs=[]}function TCDraw(e,d){this.win=e;this.doc=d;var f=d.layers?"layer visibility=hidden top=54 left=5 width=182":"div style=visibility:hidden;position:absolute;left:6px;top:54px;width:182px;height:0",a=d.layers?"layer top=32 left=6":"div",c=d.layers?"layer":"div";this.doc.write("<"+a+' id=sam name=sam><table cellpadding=0 cellspacing=0 border=1 width=181 align=center class=bd><tr><td align=center height=18><div id="samp"><font face=Tahoma size=2>sample <font color=white>sample</font></font></div></td></tr></table></'+c+">");this.sample=d.layers?d.layers.sam:d.getElementById?d.getElementById("sam").style:d.all.sam.style;for(var b=0;b<4;b++){this.doc.write("<"+f+' id="p'+b+'" name="p'+b+'"><table cellpadding=0 cellspacing=0 border=1 align=center>'+this["build"+b]()+"</table></"+c+">");this.divs[b]=d.layers?d.layers["p"+b]:d.all?d.all["p"+b].style:d.getElementById("p"+b).style}if(!d.layers&&d.body.innerHTML){this.o_samp=d.all?d.all.samp:d.getElementById("samp")}this.C(this.initPalette);if(this.field.value){this.P(this.field.value,true)}};