/* Copyright © Cutrope.com. All Rights Reserved. */
var hue_pos_img=ART.IMG();hue_pos_img.galleryImg=false;hue_pos_img.width=35;hue_pos_img.height=11;hue_pos_img.src='http://images.spicypage.com/cp_pos_35x11.png';hue_pos_img.style.position='absolute';var hue_selector_img=ART.IMG();hue_selector_img.galleryImg=false;hue_selector_img.width=35;hue_selector_img.height=200;hue_selector_img.src='http://images.spicypage.com/cp_slider_35x200.png';hue_selector_img.style.display='block';var sat_val_img=ART.IMG();sat_val_img.galleryImg=false;sat_val_img.width=200;sat_val_img.height=200;sat_val_img.src='http://images.spicypage.com/cp_sv_200x200.png';sat_val_img.style.display='block';var cross_hairs_img=ART.IMG();cross_hairs_img.galleryImg=false;cross_hairs_img.width=21;cross_hairs_img.height=21;cross_hairs_img.src='http://images.spicypage.com/cp_crosshairs_21x21.png';cross_hairs_img.style.position='absolute';if(!CP){var CP={fix_png:function(myImage){if((gBrowser.version>=5.5)&&(gBrowser.version<7)&&(document.body.filters)){var node=ART.SPAN();node.id=myImage.id;node.className=myImage.className;node.title=myImage.title;node.style.cssText=myImage.style.cssText;node.style.setAttribute('filter',"progid:DXImageTransform.Microsoft.AlphaImageLoader"+"(src=\'"+myImage.src+"\', sizingMethod='scale')");node.style.fontSize='0';node.style.width=myImage.width.toString()+'px';node.style.height=myImage.height.toString()+'px';node.style.display='inline-block';return node;}else return myImage.cloneNode(false);},track_drag:function(node,handler){var fix_coords=function(x,y){var node_page_coords=ART.absolute_pos(node);x=(x-node_page_coords.x)+ART.get_body().scrollLeft;y=(y-node_page_coords.y)+ART.get_body().scrollTop;if(x<0)x=0;if(y<0)y=0;if(x>node.offsetWidth-1)x=node.offsetWidth-1;if(y>node.offsetHeight-1)y=node.offsetHeight-1;return{x:x,y:y};};var mouse_down=function(ev){var coords=fix_coords(ev.clientX,ev.clientY);var lastX=coords.x;var lastY=coords.y;handler(coords.x,coords.y);var move_handler=function(ev){var coords=fix_coords(ev.clientX,ev.clientY);if(coords.x!=lastX||coords.y!=lastY){lastX=coords.x;lastY=coords.y;handler(coords.x,coords.y);}};var up_handler=function(ev){ART.REV(document,'mouseup',up_handler);ART.REV(document,'mousemove',move_handler);ART.AEV(node,'mousedown',mouse_down);};ART.AEV(document,'mouseup',up_handler);ART.AEV(document,'mousemove',move_handler);ART.REV(node,'mousedown',mouse_down);if(ev.preventDefault)ART.prevent_default(ev);};ART.AEV(node,'mousedown',mouse_down);node.onmousedown=function(e){return false;};node.onselectstart=function(e){return false;};node.ondragstart=function(e){return false;};},make_color_selector:function(_input_box,fn){if(!fn)var fn=null;var input_box=ART.GE(_input_box);var rgb,hsv;var color_changed=function(){var hex=ART.rgb_2_hex(rgb.r,rgb.g,rgb.b);var hueRgb=ART.hsv_2_rgb(hsv.h,1,1);var hueHex=ART.rgb_2_hex(hueRgb.r,hueRgb.g,hueRgb.b);preview_div.style.background=hex;input_box.value=hex;sat_val_div.style.background=hueHex;cross_hairs.style.left=((hsv.v*199)-10).toString()+'px';cross_hairs.style.top=(((1-hsv.s)*199)-10).toString()+'px';huePos.style.top=((hsv.h*199)-5).toString()+'px';if(fn&&ART.GE(_input_box))fn();};var rgb_changed=function(){hsv=ART.rgb_2_hsv(rgb.r,rgb.g,rgb.b);color_changed();};var hsv_changed=function(){rgb=ART.hsv_2_rgb(hsv.h,hsv.s,hsv.v);color_changed();};var color_selector_div=ART.DIV();color_selector_div.style.padding='15px';color_selector_div.style.position='relative';color_selector_div.style.height='275px';color_selector_div.style.width='250px';var sat_val_div=ART.DIV();sat_val_div.style.position='relative';sat_val_div.style.width='200px';sat_val_div.style.height='200px';var new_sat_val_img=CP.fix_png(sat_val_img);ART.ACN(sat_val_div,new_sat_val_img);var cross_hairs=cross_hairs_img.cloneNode(false);ART.ACN(sat_val_div,cross_hairs);var sat_val_dragged=function(x,y){hsv.s=1-(y/199);hsv.v=(x/199);hsv_changed();};CP.track_drag(sat_val_div,sat_val_dragged);ART.ACN(color_selector_div,sat_val_div);var hue_div=ART.DIV();hue_div.style.position='absolute';hue_div.style.left='230px';hue_div.style.top='15px';hue_div.style.width='35px';hue_div.style.height='200px';var huePos=CP.fix_png(hue_pos_img);ART.ACN(hue_div,hue_selector_img.cloneNode(false));ART.ACN(hue_div,huePos);var hue_dragged=function(x,y){hsv.h=y/199;hsv_changed();};CP.track_drag(hue_div,hue_dragged);ART.ACN(color_selector_div,hue_div);var preview_div=ART.DIV();preview_div.style.height='50px';preview_div.style.width='50px';preview_div.style.position='absolute';preview_div.style.top='225px';preview_div.style.left='15px';preview_div.style.border='1px solid black';ART.ACN(color_selector_div,preview_div);var input_box_changed=function(){rgb=ART.hex_2_rgb(input_box.value,{r:0,g:0,b:0});rgb_changed();};ART.AEV(input_box,'change',input_box_changed);input_box.size=8;input_box.style.position='absolute';input_box.style.right='15px';input_box.style.top=(225+(25-(input_box.offsetHeight/2))).toString()+'px';ART.ACN(color_selector_div,input_box);input_box_changed();return color_selector_div;}};}