jQuery.fn.farbtastic=function(d){$.farbtastic(this,d);return this};jQuery.farbtastic=function(d,k){d=$(d).get(0);return d.farbtastic||(d.farbtastic=new jQuery._farbtastic(d,k))};
jQuery._farbtastic=function(d,k){var a=this;$(d).html('
');var j=$(".farbtastic",d);a.wheel=$(".wheel",d).get(0);a.radius=84;a.square=100;a.width=194;navigator.appVersion.match(/MSIE [0-6]\./)&&$("*",j).each(function(){if(this.currentStyle.backgroundImage!="none"){var b=this.currentStyle.backgroundImage,b=this.currentStyle.backgroundImage.substring(5,
b.length-2);$(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+b+"')"})}});a.linkTo=function(b){typeof a.callback=="object"&&$(a.callback).unbind("keyup",a.updateValue);a.color=null;if(typeof b=="function")a.callback=b;else if(typeof b=="object"||typeof b=="string")a.callback=$(b),a.callback.bind("keyup",a.updateValue),a.callback.get(0).value&&a.setColor(a.callback.get(0).value);return this};a.updateValue=function(){this.value&&
this.value!=a.color&&a.setColor(this.value)};a.setColor=function(b){var g=a.unpack(b);if(a.color!=b&&g)a.color=b,a.rgb=g,a.hsl=a.RGBToHSL(a.rgb),a.updateDisplay();return this};a.setHSL=function(b){a.hsl=b;a.rgb=a.HSLToRGB(b);a.color=a.pack(a.rgb);a.updateDisplay();return this};a.widgetCoords=function(b){var g,c,d=b.target||b.srcElement,e=a.wheel;if(typeof b.offsetX!="undefined"){for(var f={x:b.offsetX,y:b.offsetY},b=d;b;)b.mouseX=f.x,b.mouseY=f.y,f.x+=b.offsetLeft,f.y+=b.offsetTop,b=b.offsetParent;
b=e;for(e={x:0,y:0};b;){if(typeof b.mouseX!="undefined"){g=b.mouseX-e.x;c=b.mouseY-e.y;break}e.x+=b.offsetLeft;e.y+=b.offsetTop;b=b.offsetParent}for(b=d;b;)b.mouseX=void 0,b.mouseY=void 0,b=b.offsetParent}else f=a.absolutePosition(e),g=(b.pageX||0*(b.clientX+$("html").get(0).scrollLeft))-f.x,c=(b.pageY||0*(b.clientY+$("html").get(0).scrollTop))-f.y;return{x:g-a.width/2,y:c-a.width/2}};a.mousedown=function(b){if(!document.dragging)$(document).bind("mousemove",a.mousemove).bind("mouseup",a.mouseup),
document.dragging=!0;var g=a.widgetCoords(b);a.circleDrag=Math.max(Math.abs(g.x),Math.abs(g.y))*2>a.square;a.mousemove(b);return!1};a.mousemove=function(b){b=a.widgetCoords(b);a.circleDrag?(b=Math.atan2(b.x,-b.y)/6.28,b<0&&(b+=1),a.setHSL([b,a.hsl[1],a.hsl[2]])):a.setHSL([a.hsl[0],Math.max(0,Math.min(1,-(b.x/a.square)+0.5)),Math.max(0,Math.min(1,-(b.y/a.square)+0.5))]);return!1};a.mouseup=function(){$(document).unbind("mousemove",a.mousemove);$(document).unbind("mouseup",a.mouseup);document.dragging=
!1};a.updateDisplay=function(){var b=a.hsl[0]*6.28;$(".h-marker",j).css({left:Math.round(Math.sin(b)*a.radius+a.width/2)+"px",top:Math.round(-Math.cos(b)*a.radius+a.width/2)+"px"});$(".sl-marker",j).css({left:Math.round(a.square*(0.5-a.hsl[1])+a.width/2)+"px",top:Math.round(a.square*(0.5-a.hsl[2])+a.width/2)+"px"});$(".color",j).css("backgroundColor",a.pack(a.HSLToRGB([a.hsl[0],1,0.5])));typeof a.callback=="object"?($(a.callback).css({backgroundColor:a.color,color:a.hsl[2]>0.5?"#000":"#fff"}),$(a.callback).each(function(){if(this.value&&
this.value!=a.color)this.value=a.color})):typeof a.callback=="function"&&a.callback.call(a,a.color)};a.absolutePosition=function(b){var g={x:b.offsetLeft,y:b.offsetTop};b.offsetParent&&(b=a.absolutePosition(b.offsetParent),g.x+=b.x,g.y+=b.y);return g};a.pack=function(b){var a=Math.round(b[0]*255),c=Math.round(b[1]*255),b=Math.round(b[2]*255);return"#"+(a<16?"0":"")+a.toString(16)+(c<16?"0":"")+c.toString(16)+(b<16?"0":"")+b.toString(16)};a.unpack=function(b){if(b.length==7)return[parseInt("0x"+b.substring(1,
3))/255,parseInt("0x"+b.substring(3,5))/255,parseInt("0x"+b.substring(5,7))/255];else if(b.length==4)return[parseInt("0x"+b.substring(1,2))/15,parseInt("0x"+b.substring(2,3))/15,parseInt("0x"+b.substring(3,4))/15]};a.HSLToRGB=function(b){var a,c=b[0];a=b[1];b=b[2];a=b<=0.5?b*(a+1):b+a-b*a;b=b*2-a;return[this.hueToRGB(b,a,c+0.33333),this.hueToRGB(b,a,c),this.hueToRGB(b,a,c-0.33333)]};a.hueToRGB=function(b,a,c){c=c<0?c+1:c>1?c-1:c;if(c*6<1)return b+(a-b)*c*6;if(c*2<1)return a;if(c*3<2)return b+(a-b)*
(0.66666-c)*6;return b};a.RGBToHSL=function(b){var a,c,d,e,f=b[0],h=b[1],i=b[2];a=Math.min(f,Math.min(h,i));b=Math.max(f,Math.max(h,i));c=b-a;e=(a+b)/2;d=0;e>0&&e<1&&(d=c/(e<0.5?2*e:2-2*e));a=0;c>0&&(b==f&&b!=h&&(a+=(h-i)/c),b==h&&b!=i&&(a+=2+(i-f)/c),b==i&&b!=f&&(a+=4+(f-h)/c),a/=6);return[a,d,e]};$("*",j).mousedown(a.mousedown);a.setColor("#000000");k&&a.linkTo(k)};