var jscolor={dir:"",bindClass:"color",binding:!0,preloading:!0,install:function(){jscolor.addEvent(window,"load",jscolor.init)},init:function(){jscolor.binding&&jscolor.bind();jscolor.preloading&&jscolor.preload()},getDir:function(){if(!jscolor.dir){var b=jscolor.detectDir();jscolor.dir=!1!==b?b:"jscolor/"}return jscolor.dir},detectDir:function(){for(var b=location.href,d=document.getElementsByTagName("base"),c=0;c<d.length;c+=1)d[c].href&&(b=d[c].href);d=document.getElementsByTagName("script");for(c=
0;c<d.length;c+=1)if(d[c].src&&/(^|\/)jscolor\.js([?#].*)?$/i.test(d[c].src))return b=(new jscolor.URI(d[c].src)).toAbsolute(b),b.path=b.path.replace(/[^\/]+$/,""),b.query=null,b.fragment=null,b.toString();return!1},bind:function(){for(var b=RegExp("(^|\\s)("+jscolor.bindClass+")\\s*(\\{[^}]*\\})?","i"),d=document.getElementsByTagName("input"),c=0;c<d.length;c+=1){var l;if(!d[c].color&&d[c].className&&(l=d[c].className.match(b))){if(l[3])try{eval("prop="+l[3])}catch(v){}d[c].color=new jscolor.color(d[c],
{})}}},preload:function(){for(var b in jscolor.imgRequire)jscolor.imgRequire.hasOwnProperty(b)&&jscolor.loadImage(b)},images:{pad:[181,101],sld:[16,101],cross:[15,15],arrow:[7,11]},imgRequire:{},imgLoaded:{},requireImage:function(b){jscolor.imgRequire[b]=!0},loadImage:function(b){jscolor.imgLoaded[b]||(jscolor.imgLoaded[b]=new Image,jscolor.imgLoaded[b].src=jscolor.getDir()+b)},fetchElement:function(b){return"string"===typeof b?document.getElementById(b):b},addEvent:function(b,d,c){b.addEventListener?
b.addEventListener(d,c,!1):b.attachEvent&&b.attachEvent("on"+d,c)},fireEvent:function(b,d){if(b)if(document.createEvent){var c=document.createEvent("HTMLEvents");c.initEvent(d,!0,!0);b.dispatchEvent(c)}else if(document.createEventObject)c=document.createEventObject(),b.fireEvent("on"+d,c);else if(b["on"+d])b["on"+d]()},getElementPos:function(b){var d=b,c=0,l=0;if(d.offsetParent){do c+=d.offsetLeft,l+=d.offsetTop;while(d=d.offsetParent)}for(;(b=b.parentNode)&&"BODY"!==b.nodeName.toUpperCase();)c-=
b.scrollLeft,l-=b.scrollTop;return[c,l]},getElementSize:function(b){return[b.offsetWidth,b.offsetHeight]},getRelMousePos:function(b){var d=0,c=0;b||(b=window.event);"number"===typeof b.offsetX?(d=b.offsetX,c=b.offsetY):"number"===typeof b.layerX&&(d=b.layerX,c=b.layerY);return{x:d,y:c}},getViewPos:function(){return"number"===typeof window.pageYOffset?[window.pageXOffset,window.pageYOffset]:document.body&&(document.body.scrollLeft||document.body.scrollTop)?[document.body.scrollLeft,document.body.scrollTop]:
document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[0,0]},getViewSize:function(){return"number"===typeof window.innerWidth?[window.innerWidth,window.innerHeight]:document.body&&(document.body.clientWidth||document.body.clientHeight)?[document.body.clientWidth,document.body.clientHeight]:document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?
[document.documentElement.clientWidth,document.documentElement.clientHeight]:[0,0]},URI:function(b){function d(c){for(var b="";c;)if("../"===c.substr(0,3)||"./"===c.substr(0,2))c=c.replace(/^\.+/,"").substr(1);else if("/./"===c.substr(0,3)||"/."===c)c="/"+c.substr(3);else if("/../"===c.substr(0,4)||"/.."===c)c="/"+c.substr(4),b=b.replace(/\/?[^\/]*$/,"");else if("."===c||".."===c)c="";else var d=c.match(/^\/?[^\/]*/)[0],c=c.substr(d.length),b=b+d;return b}this.authority=this.scheme=null;this.path=
"";this.fragment=this.query=null;this.parse=function(c){c=c.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);this.scheme=c[3]?c[2]:null;this.authority=c[5]?c[6]:null;this.path=c[7];this.query=c[9]?c[10]:null;this.fragment=c[12]?c[13]:null;return this};this.toString=function(){var c="";null!==this.scheme&&(c=c+this.scheme+":");null!==this.authority&&(c=c+"//"+this.authority);null!==this.path&&(c+=this.path);null!==this.query&&(c=c+"?"+this.query);null!==
this.fragment&&(c=c+"#"+this.fragment);return c};this.toAbsolute=function(c){var c=new jscolor.URI(c),b=new jscolor.URI;if(null===c.scheme)return!1;null!==this.scheme&&this.scheme.toLowerCase()===c.scheme.toLowerCase()&&(this.scheme=null);null!==this.scheme?(b.scheme=this.scheme,b.authority=this.authority,b.path=d(this.path),b.query=this.query):(null!==this.authority?(b.authority=this.authority,b.path=d(this.path),b.query=this.query):(""===this.path?(b.path=c.path,b.query=null!==this.query?this.query:
c.query):("/"===this.path.substr(0,1)?b.path=d(this.path):(b.path=null!==c.authority&&""===c.path?"/"+this.path:c.path.replace(/[^\/]+$/,"")+this.path,b.path=d(b.path)),b.query=this.query),b.authority=c.authority),b.scheme=c.scheme);b.fragment=this.fragment;return b};b&&this.parse(b)},color:function(b,d){function c(a,c,b){if(null===a)return[b,b,b];var e=Math.floor(a),d=b*(1-c),a=b*(1-c*(e%2?a-e:1-(a-e)));switch(e){case 6:case 0:return[b,a,d];case 1:return[a,b,d];case 2:return[d,b,a];case 3:return[d,
a,b];case 4:return[a,d,b];case 5:return[b,d,a]}}function l(a){return[2*a.pickerInset+2*a.pickerFace+jscolor.images.pad[0]+(a.slider?2*a.pickerInset+2*jscolor.images.arrow[0]+jscolor.images.sld[0]:0),a.pickerClosable?4*a.pickerInset+3*a.pickerFace+jscolor.images.pad[1]+a.pickerButtonHeight:2*a.pickerInset+2*a.pickerFace+jscolor.images.pad[1]]}function v(){switch(n){case 0:var a=1;break;case 1:a=2}var b=Math.round(e.hsv[0]/6*(jscolor.images.pad[0]-1)),a=Math.round((1-e.hsv[a])*(jscolor.images.pad[1]-
1));jscolor.picker.padM.style.backgroundPosition=e.pickerFace+e.pickerInset+b-Math.floor(jscolor.images.cross[0]/2)+"px "+(e.pickerFace+e.pickerInset+a-Math.floor(jscolor.images.cross[1]/2))+"px";b=jscolor.picker.sld.childNodes;switch(n){case 0:for(var d=c(e.hsv[0],e.hsv[1],1),a=0;a<b.length;a+=1)b[a].style.backgroundColor="rgb("+100*d[0]*(1-a/b.length)+"%,"+100*d[1]*(1-a/b.length)+"%,"+100*d[2]*(1-a/b.length)+"%)";break;case 1:var h,k=[e.hsv[2],0,0],a=Math.floor(e.hsv[0]),g=a%2?e.hsv[0]-a:1-(e.hsv[0]-
a);switch(a){case 6:case 0:d=[0,1,2];break;case 1:d=[1,0,2];break;case 2:d=[2,0,1];break;case 3:d=[2,1,0];break;case 4:d=[1,2,0];break;case 5:d=[0,2,1]}for(a=0;a<b.length;a+=1)h=1-1/(b.length-1)*a,k[1]=k[0]*(1-h*g),k[2]=k[0]*(1-h),b[a].style.backgroundColor="rgb("+100*k[d[0]]+"%,"+100*k[d[1]]+"%,"+100*k[d[2]]+"%)"}}function y(){switch(n){case 0:var a=2;break;case 1:a=1}a=Math.round((1-e.hsv[a])*(jscolor.images.sld[1]-1));jscolor.picker.sldM.style.backgroundPosition="0 "+(e.pickerFace+e.pickerInset+
a-Math.floor(jscolor.images.arrow[1]/2))+"px"}function u(){return jscolor.picker&&jscolor.picker.owner===e}function B(){h!==b&&e.importColor()}function z(a){var b=jscolor.getRelMousePos(a),a=b.x-e.pickerFace-e.pickerInset,b=b.y-e.pickerFace-e.pickerInset;switch(n){case 0:e.fromHSV(a*(6/(jscolor.images.pad[0]-1)),1-b/(jscolor.images.pad[1]-1),null,p);break;case 1:e.fromHSV(a*(6/(jscolor.images.pad[0]-1)),null,1-b/(jscolor.images.pad[1]-1),p)}}function A(a){a=jscolor.getRelMousePos(a).y-e.pickerFace-
e.pickerInset;switch(n){case 0:e.fromHSV(null,null,1-a/(jscolor.images.sld[1]-1),w);break;case 1:e.fromHSV(null,1-a/(jscolor.images.sld[1]-1),null,w)}}this.adjust=this.required=!0;this.hash=!1;this.slider=this.caps=!0;this.styleElement=this.valueElement=b;this.hsv=[0,0,1];this.rgb=[1,1,1];this.pickerOnfocus=!0;this.pickerMode="HSV";this.pickerPosition="bottom";this.pickerButtonHeight=20;this.pickerClosable=!1;this.pickerCloseText="Close";this.pickerButtonColor="ButtonText";this.pickerFace=10;this.pickerFaceColor=
"ThreeDFace";this.pickerBorder=1;this.pickerBorderColor="ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight";this.pickerInset=1;this.pickerInsetColor="ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow";this.pickerZIndex=1E4;for(var o in d)d.hasOwnProperty(o)&&(this[o]=d[o]);this.hidePicker=function(){u()&&(delete jscolor.picker.owner,document.getElementsByTagName("body")[0].removeChild(jscolor.picker.boxB))};this.showPicker=function(){if(!u()){var a=jscolor.getElementPos(b),c=jscolor.getElementSize(b),
d=jscolor.getViewPos(),i=jscolor.getViewSize(),k=l(this),g,f,m;switch(this.pickerPosition.toLowerCase()){case "left":g=1;f=0;m=-1;break;case "right":g=1;f=0;m=1;break;case "top":g=0;f=1;m=-1;break;default:g=0,m=f=1}var j=(c[f]+k[f])/2,a=[-d[g]+a[g]+k[g]>i[g]?-d[g]+a[g]+c[g]/2>i[g]/2&&0<=a[g]+c[g]-k[g]?a[g]+c[g]-k[g]:a[g]:a[g],-d[f]+a[f]+c[f]+k[f]-j+j*m>i[f]?-d[f]+a[f]+c[f]/2>i[f]/2&&0<=a[f]+c[f]-j-j*m?a[f]+c[f]-j-j*m:a[f]+c[f]-j+j*m:0<=a[f]+c[f]-j+j*m?a[f]+c[f]-j+j*m:a[f]+c[f]-j-j*m];g=a[g];f=a[f];
if(!jscolor.picker){jscolor.picker={box:document.createElement("div"),boxB:document.createElement("div"),pad:document.createElement("div"),padB:document.createElement("div"),padM:document.createElement("div"),sld:document.createElement("div"),sldB:document.createElement("div"),sldM:document.createElement("div"),btn:document.createElement("div"),btnS:document.createElement("span"),btnT:document.createTextNode(e.pickerCloseText)};for(a=0;a<jscolor.images.sld[1];a+=4)c=document.createElement("div"),
c.style.height="4px",c.style.fontSize="1px",c.style.lineHeight="0",jscolor.picker.sld.appendChild(c);jscolor.picker.sldB.appendChild(jscolor.picker.sld);jscolor.picker.box.appendChild(jscolor.picker.sldB);jscolor.picker.box.appendChild(jscolor.picker.sldM);jscolor.picker.padB.appendChild(jscolor.picker.pad);jscolor.picker.box.appendChild(jscolor.picker.padB);jscolor.picker.box.appendChild(jscolor.picker.padM);jscolor.picker.btnS.appendChild(jscolor.picker.btnT);jscolor.picker.btn.appendChild(jscolor.picker.btnS);
jscolor.picker.box.appendChild(jscolor.picker.btn);jscolor.picker.boxB.appendChild(jscolor.picker.box)}a=jscolor.picker;a.box.onmouseup=a.box.onmouseout=function(){b.focus()};a.box.onmousedown=function(){r=!0};a.box.onmousemove=function(a){if(s||t)s&&z(a),t&&A(a),document.selection?document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges()};a.padM.onmouseup=a.padM.onmouseout=function(){s&&(s=!1,jscolor.fireEvent(h,"change"))};a.padM.onmousedown=function(a){s=!0;z(a)};
a.sldM.onmouseup=a.sldM.onmouseout=function(){t&&(t=!1,jscolor.fireEvent(h,"change"))};a.sldM.onmousedown=function(a){t=!0;A(a)};c=l(e);a.box.style.width=c[0]+"px";a.box.style.height=c[1]+"px";a.boxB.style.position="absolute";a.boxB.style.clear="both";a.boxB.style.left=g+"px";a.boxB.style.top=f+"px";a.boxB.style.zIndex=e.pickerZIndex;a.boxB.style.border=e.pickerBorder+"px solid";a.boxB.style.borderColor=e.pickerBorderColor;a.boxB.style.background=e.pickerFaceColor;a.pad.style.width=jscolor.images.pad[0]+
"px";a.pad.style.height=jscolor.images.pad[1]+"px";a.padB.style.position="absolute";a.padB.style.left=e.pickerFace+"px";a.padB.style.top=e.pickerFace+"px";a.padB.style.border=e.pickerInset+"px solid";a.padB.style.borderColor=e.pickerInsetColor;a.padM.style.position="absolute";a.padM.style.left="0";a.padM.style.top="0";a.padM.style.width=e.pickerFace+2*e.pickerInset+jscolor.images.pad[0]+jscolor.images.arrow[0]+"px";a.padM.style.height=a.box.style.height;a.padM.style.cursor="crosshair";a.sld.style.overflow=
"hidden";a.sld.style.width=jscolor.images.sld[0]+"px";a.sld.style.height=jscolor.images.sld[1]+"px";a.sldB.style.display=e.slider?"block":"none";a.sldB.style.position="absolute";a.sldB.style.right=e.pickerFace+"px";a.sldB.style.top=e.pickerFace+"px";a.sldB.style.border=e.pickerInset+"px solid";a.sldB.style.borderColor=e.pickerInsetColor;a.sldM.style.display=e.slider?"block":"none";a.sldM.style.position="absolute";a.sldM.style.right="0";a.sldM.style.top="0";a.sldM.style.width=jscolor.images.sld[0]+
jscolor.images.arrow[0]+e.pickerFace+2*e.pickerInset+"px";a.sldM.style.height=a.box.style.height;try{a.sldM.style.cursor="pointer"}catch(o){a.sldM.style.cursor="hand"}a.btn.style.display=e.pickerClosable?"block":"none";a.btn.style.position="absolute";a.btn.style.left=e.pickerFace+"px";a.btn.style.bottom=e.pickerFace+"px";a.btn.style.padding="0 15px";a.btn.style.height="18px";a.btn.style.border=e.pickerInset+"px solid";f=e.pickerInsetColor.split(/\s+/);a.btn.style.borderColor=2>f.length?f[0]:f[1]+
" "+f[0]+" "+f[0]+" "+f[1];a.btn.style.color=e.pickerButtonColor;a.btn.style.font="12px sans-serif";a.btn.style.textAlign="center";try{a.btn.style.cursor="pointer"}catch(q){a.btn.style.cursor="hand"}a.btn.onmousedown=function(){e.hidePicker()};a.btnS.style.lineHeight=a.btn.style.height;switch(n){case 0:var p="/jscolor/hs.png";break;case 1:p="/jscolor/hv.png"}a.padM.style.backgroundImage="url('"+jscolor.getDir()+"/jscolor/cross.gif')";a.padM.style.backgroundRepeat="no-repeat";a.sldM.style.backgroundImage="url('"+jscolor.getDir()+
"/jscolor/arrow.gif')";a.sldM.style.backgroundRepeat="no-repeat";a.pad.style.backgroundImage="url('"+jscolor.getDir()+p+"')";a.pad.style.backgroundRepeat="no-repeat";a.pad.style.backgroundPosition="0 0";v();y();jscolor.picker.owner=e;document.getElementsByTagName("body")[0].appendChild(a.boxB)}};this.importColor=function(){h?this.adjust?!this.required&&/^\s*$/.test(h.value)?(h.value="",i.style.backgroundColor=i.jscStyle.backgroundColor,i.style.color=i.jscStyle.color,this.exportColor(q|x)):this.fromString(h.value)||
this.exportColor():this.fromString(h.value,q)||(i.style.backgroundColor=i.jscStyle.backgroundColor,i.style.color=i.jscStyle.color,this.exportColor(q|x)):this.exportColor()};this.exportColor=function(a){if(!(a&q)&&h){var b=this.toString();this.caps&&(b=b.toUpperCase());this.hash&&(b="#"+b);h.value=b}!(a&x)&&i&&(i.style.backgroundColor="#"+this.toString(),i.style.color=0.5>0.213*this.rgb[0]+0.715*this.rgb[1]+0.072*this.rgb[2]?"#FFF":"#000");!(a&w)&&u()&&v();!(a&p)&&u()&&y()};this.fromHSV=function(a,
b,d,e){0>a&&(a=0)||6<a&&(a=6);0>b&&(b=0)||1<b&&(b=1);0>d&&(d=0)||1<d&&(d=1);this.rgb=c(null===a?this.hsv[0]:this.hsv[0]=a,null===b?this.hsv[1]:this.hsv[1]=b,null===d?this.hsv[2]:this.hsv[2]=d);this.exportColor(e)};this.fromRGB=function(a,b,c,d){0>a&&(a=0)||1<a&&(a=1);0>b&&(b=0)||1<b&&(b=1);0>c&&(c=0)||1<c&&(c=1);var a=null===a?this.rgb[0]:this.rgb[0]=a,b=null===b?this.rgb[1]:this.rgb[1]=b,e=null===c?this.rgb[2]:this.rgb[2]=c,g=Math.min(Math.min(a,b),e),c=Math.max(Math.max(a,b),e),f=c-g;0===f?a=[null,
0,c]:(a=a===g?3+(e-b)/f:b===g?5+(a-e)/f:1+(b-a)/f,a=[6===a?0:a,f/c,c]);null!==a[0]&&(this.hsv[0]=a[0]);0!==a[2]&&(this.hsv[1]=a[1]);this.hsv[2]=a[2];this.exportColor(d)};this.fromString=function(a,b){var c=a.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);return c?(6===c[1].length?this.fromRGB(parseInt(c[1].substr(0,2),16)/255,parseInt(c[1].substr(2,2),16)/255,parseInt(c[1].substr(4,2),16)/255,b):this.fromRGB(parseInt(c[1].charAt(0)+c[1].charAt(0),16)/255,parseInt(c[1].charAt(1)+c[1].charAt(1),16)/
255,parseInt(c[1].charAt(2)+c[1].charAt(2),16)/255,b),!0):!1};this.toString=function(){return(256|Math.round(255*this.rgb[0])).toString(16).substr(1)+(256|Math.round(255*this.rgb[1])).toString(16).substr(1)+(256|Math.round(255*this.rgb[2])).toString(16).substr(1)};var e=this,n="hvs"===this.pickerMode.toLowerCase()?1:0,r=!1,h=jscolor.fetchElement(this.valueElement),i=jscolor.fetchElement(this.styleElement),s=!1,t=!1,q=1,x=2,w=4,p=8;jscolor.addEvent(b,"focus",function(){e.pickerOnfocus&&e.showPicker()});
jscolor.addEvent(b,"blur",function(){r?r=!1:window.setTimeout(function(){r||(h===b&&e.importColor(),e.pickerOnfocus&&e.hidePicker());r=!1},0)});h&&(o=function(){e.fromString(h.value,q)},jscolor.addEvent(h,"keyup",o),jscolor.addEvent(h,"input",o),jscolor.addEvent(h,"blur",B),h.setAttribute("autocomplete","off"));i&&(i.jscStyle={backgroundColor:i.style.backgroundColor,color:i.style.color});switch(n){case 0:jscolor.requireImage("/jscolor/hs.png");break;case 1:jscolor.requireImage("/jscolor/hv.png")}jscolor.requireImage("/jscolor/cross.gif");
jscolor.requireImage("/jscolor/arrow.gif");this.importColor()}};jscolor.install();