var MSIE=navigator.userAgent.indexOf("MSIE")>=0?true:false;var navigatorVersion=navigator.appVersion.replace(/.*?MSIE (\d\.\d).*/g,"$1")/1;var form_widget_amount_slider_handle="images/slider_handle.gif";var slider_handle_image_obj=false;var sliderObjectArray=new Array();var slider_counter=0;var slideInProgress=false;var handle_start_x;var event_start_x;var currentSliderIndex;function form_widget_cancel_event(){return false}function getImageSliderHeight(){if(!slider_handle_image_obj){slider_handle_image_obj=new Image();slider_handle_image_obj.src=form_widget_amount_slider_handle}if(slider_handle_image_obj.width>0){return}else{setTimeout("getImageSliderHeight()",50)}}function positionSliderImage(f,d,a){if(this){a=this}if(!d){d=a.getAttribute("sliderIndex")}var g=document.getElementById("slider_handle"+d);var c=sliderObjectArray[d]["width"]/(sliderObjectArray[d]["max"]-sliderObjectArray[d]["min"]);var b=sliderObjectArray[d]["formTarget"].value-sliderObjectArray[d]["min"];g.style.left=b*c+"px";setColorByRGB()}function adjustFormValue(c){var d=document.getElementById("slider_handle"+c);var b=sliderObjectArray[c]["width"]/(sliderObjectArray[c]["max"]-sliderObjectArray[c]["min"]);var a=d.style.left.replace("px","");sliderObjectArray[c]["formTarget"].value=Math.round(a/b)+sliderObjectArray[c]["min"]}function initMoveSlider(a){if(document.all){a=event}slideInProgress=true;event_start_x=a.clientX;handle_start_x=this.style.left.replace("px","");currentSliderIndex=this.id.replace(/[^\d]/g,"");return false}function startMoveSlider(e){if(document.all){e=event}if(!slideInProgress){return}var leftPos=handle_start_x/1+e.clientX/1-event_start_x;if(leftPos<0){leftPos=0}if(leftPos/1>sliderObjectArray[currentSliderIndex]["width"]){leftPos=sliderObjectArray[currentSliderIndex]["width"]}document.getElementById("slider_handle"+currentSliderIndex).style.left=leftPos+"px";adjustFormValue(currentSliderIndex);if(sliderObjectArray[currentSliderIndex]["onchangeAction"]){eval(sliderObjectArray[currentSliderIndex]["onchangeAction"])}}function stopMoveSlider(){slideInProgress=false}function form_widget_amount_slider(g,b,a,e,h,c){if(!slider_handle_image_obj){getImageSliderHeight()}slider_counter=slider_counter+1;sliderObjectArray[slider_counter]=new Array();sliderObjectArray[slider_counter]={width:a-9,min:e,max:h,formTarget:b,onchangeAction:c};b.setAttribute("sliderIndex",slider_counter);b.onchange=positionSliderImage;var d=document.createElement("DIV");d.style.width=a+"px";d.style.height="12px";d.style.position="relative";d.id="slider_container"+slider_counter;document.getElementById(g).appendChild(d);var f=document.createElement("DIV");f.className="form_widget_amount_slider";f.innerHTML="<span></span>";f.style.width=a+"px";f.id="slider_slider"+slider_counter;f.style.position="absolute";f.style.bottom="0px";d.appendChild(f);var i=document.createElement("IMG");i.style.position="absolute";i.style.left="0px";i.style.zIndex=5;i.src=slider_handle_image_obj.src;i.id="slider_handle"+slider_counter;i.onmousedown=initMoveSlider;if(document.body.onmouseup){if(document.body.onmouseup.toString().indexOf("stopMoveSlider")==-1){alert("You allready have an onmouseup event assigned to the body tag")}}else{document.body.onmouseup=stopMoveSlider;document.body.onmousemove=startMoveSlider}i.ondragstart=form_widget_cancel_event;d.appendChild(i);positionSliderImage(false,slider_counter)}var namedColors=new Array("AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","Darkorange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DodgerBlue","Feldspar","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateBlue","LightSlateGray","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","VioletRed","Wheat","White","WhiteSmoke","Yellow","YellowGreen");var namedColorRGB=new Array("#F0F8FF","#FAEBD7","#00FFFF","#7FFFD4","#F0FFFF","#F5F5DC","#FFE4C4","#000000","#FFEBCD","#0000FF","#8A2BE2","#A52A2A","#DEB887","#5F9EA0","#7FFF00","#D2691E","#FF7F50","#6495ED","#FFF8DC","#DC143C","#00FFFF","#00008B","#008B8B","#B8860B","#A9A9A9","#006400","#BDB76B","#8B008B","#556B2F","#FF8C00","#9932CC","#8B0000","#E9967A","#8FBC8F","#483D8B","#2F4F4F","#00CED1","#9400D3","#FF1493","#00BFFF","#696969","#1E90FF","#D19275","#B22222","#FFFAF0","#228B22","#FF00FF","#DCDCDC","#F8F8FF","#FFD700","#DAA520","#808080","#008000","#ADFF2F","#F0FFF0","#FF69B4","#CD5C5C","#4B0082","#FFFFF0","#F0E68C","#E6E6FA","#FFF0F5","#7CFC00","#FFFACD","#ADD8E6","#F08080","#E0FFFF","#FAFAD2","#D3D3D3","#90EE90","#FFB6C1","#FFA07A","#20B2AA","#87CEFA","#8470FF","#778899","#B0C4DE","#FFFFE0","#00FF00","#32CD32","#FAF0E6","#FF00FF","#800000","#66CDAA","#0000CD","#BA55D3","#9370D8","#3CB371","#7B68EE","#00FA9A","#48D1CC","#C71585","#191970","#F5FFFA","#FFE4E1","#FFE4B5","#FFDEAD","#000080","#FDF5E6","#808000","#6B8E23","#FFA500","#FF4500","#DA70D6","#EEE8AA","#98FB98","#AFEEEE","#D87093","#FFEFD5","#FFDAB9","#CD853F","#FFC0CB","#DDA0DD","#B0E0E6","#800080","#FF0000","#BC8F8F","#4169E1","#8B4513","#FA8072","#F4A460","#2E8B57","#FFF5EE","#A0522D","#C0C0C0","#87CEEB","#6A5ACD","#708090","#FFFAFA","#00FF7F","#4682B4","#D2B48C","#008080","#D8BFD8","#FF6347","#40E0D0","#EE82EE","#D02090","#F5DEB3","#FFFFFF","#F5F5F5","#FFFF00","#9ACD32");var color_picker_div=false;var color_picker_active_tab=false;var color_picker_form_field=false;var color_picker_active_input=false;function baseConverter(e,b,a){e=e+"";e=e.toUpperCase();var g="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";var h=0;for(var d=0;d<=e.length;d++){h+=(g.indexOf(e.charAt(d)))*(Math.pow(b,(e.length-d-1)))}e="";var f=Math.floor((Math.log(h))/(Math.log(a)));for(var d=f;d>=0;d--){var c=Math.floor(h/Math.pow(a,d));e=e+g.charAt(c);h-=c*(Math.pow(a,d))}if(e.length==0){e=0}return e}function colorPickerGetTopPos(a){var b=a.offsetTop;while((a=a.offsetParent)!=null){b+=a.offsetTop}return b}function colorPickerGetLeftPos(a){var b=a.offsetLeft;while((a=a.offsetParent)!=null){b+=a.offsetLeft}return b}function cancelColorPickerEvent(){return false}function showHideColorOptions(h,d){var b=this;if(d){var g=d.parentNode;b=d}else{var g=this.parentNode}var a=false;var i=g.getElementsByTagName("DIV")[0];counter=0;var j=10;var c=document.getElementById("color_picker_content").getElementsByTagName("DIV")[0];do{if(i.tagName=="DIV"&&i.className!="colorPickerCloseButton"){if(i==b){b.className="colorPickerTab_active";b.style.zIndex=50;var f=b.getElementsByTagName("IMG")[0];f.src="images/tab_right_active.gif";f.src=f.src.replace(/inactive/,"active");c.style.display="block";a=c}else{i.className="colorPickerTab_inactive";var f=i.getElementsByTagName("IMG")[0];f.src="images/tab_right_inactive.gif";if(a){i.style.zIndex=j-counter}else{i.style.zIndex=counter}c.style.display="none"}counter++}i=i.nextSibling;if(c.nextSibling){c=c.nextSibling}}while(i);document.getElementById("colorPicker_statusBarTxt").innerHTML="&nbsp;"}function createColorPickerTopRow(e){var i=["RGB","Named colors","Color slider"];var f=[37,90,70];var b=document.createElement("DIV");b.className="colorPicker_topRow";e.appendChild(b);var d=0;for(var j=0;j<i.length;j++){var h=document.createElement("DIV");h.onselectstart=cancelColorPickerEvent;h.ondragstart=cancelColorPickerEvent;if(j==0){suffix="active";color_picker_active_tab=this}else{suffix="inactive"}h.id="colorPickerTab"+j;h.onclick=showHideColorOptions;if(j==0){h.style.zIndex=50}else{h.style.zIndex=1+(i.length-j)}h.style.left=d+"px";h.style.position="absolute";h.className="colorPickerTab_"+suffix;var g=document.createElement("SPAN");g.innerHTML=i[j];h.appendChild(g);var a=document.createElement("IMG");a.src="images/tab_right_"+suffix+".gif";h.appendChild(a);b.appendChild(h);if(navigatorVersion<6&&MSIE){g.style.position="relative";a.style.position="relative";a.style.left="-3px";h.style.cursor="hand"}d=d+f[j]}var c=document.createElement("DIV");c.className="colorPickerCloseButton";c.innerHTML="x";c.onclick=closeColorPicker;c.onmouseover=toggleCloseButton;c.onmouseout=toggleOffCloseButton;b.appendChild(c)}function toggleCloseButton(){this.style.color="#FFF";this.style.backgroundColor="#317082"}function toggleOffCloseButton(){this.style.color="";this.style.backgroundColor=""}function closeColorPicker(){color_picker_div.style.display="none"}function createWebColors(e){var k=document.createElement("DIV");k.style.paddingTop="1px";e.appendChild(k);for(var a=15;a>=0;a-=3){for(var i=0;i<=15;i+=3){for(var j=0;j<=15;j+=3){var d=baseConverter(a,10,16)+"";var h=baseConverter(i,10,16)+"";var l=baseConverter(j,10,16)+"";var f="#"+d+d+h+h+l+l;var c=document.createElement("DIV");c.style.backgroundColor=f;c.innerHTML="<span></span>";c.className="colorSquare";c.title=f;c.onclick=chooseColor;c.setAttribute("rgbColor",f);c.onmouseover=colorPickerShowStatusBarText;c.onmouseout=colorPickerHideStatusBarText;k.appendChild(c)}}}}function createNamedColors(b){var c=document.createElement("DIV");c.style.paddingTop="1px";c.style.display="none";b.appendChild(c);for(var d=0;d<namedColors.length;d++){var a=namedColorRGB[d];var e=document.createElement("DIV");e.style.backgroundColor=a;e.innerHTML="<span></span>";e.className="colorSquare";e.title=namedColors[d];e.onclick=chooseColor;e.onmouseover=colorPickerShowStatusBarText;e.onmouseout=colorPickerHideStatusBarText;e.setAttribute("rgbColor",a);c.appendChild(e)}}function colorPickerHideStatusBarText(){document.getElementById("colorPicker_statusBarTxt").innerHTML="&nbsp;"}function colorPickerShowStatusBarText(){var a=this.getAttribute("rgbColor");if(this.title.indexOf("#")<0){a=a+" ("+this.title+")"}document.getElementById("colorPicker_statusBarTxt").innerHTML=a}function createAllColorDiv(b){var f=document.createElement("DIV");f.style.display="none";f.className="js_color_picker_allColorDiv";f.style.paddingLeft="3px";f.style.paddingTop="5px";f.style.paddingBottom="5px";b.appendChild(f);var e=document.createElement("DIV");e.className="colorSliderLabel";e.innerHTML="R";f.appendChild(e);var a=document.createElement("DIV");a.className="colorSlider";a.id="sliderRedColor";f.appendChild(a);var d=document.createElement("DIV");d.className="colorInput";var h=document.createElement("INPUT");h.id="js_color_picker_red_color";h.maxlength=3;h.style.width="48px";h.style.fontSize="11px";h.name="redColor";h.value=0;d.appendChild(h);f.appendChild(d);var e=document.createElement("DIV");e.className="colorSliderLabel";e.innerHTML="G";f.appendChild(e);var a=document.createElement("DIV");a.className="colorSlider";a.id="sliderGreenColor";f.appendChild(a);var d=document.createElement("DIV");d.className="colorInput";var h=document.createElement("INPUT");h.id="js_color_picker_green_color";h.maxlength=3;h.style.width="48px";h.style.fontSize="11px";h.name="GreenColor";h.value=0;d.appendChild(h);f.appendChild(d);var e=document.createElement("DIV");e.className="colorSliderLabel";e.innerHTML="B";f.appendChild(e);var a=document.createElement("DIV");a.className="colorSlider";a.id="sliderBlueColor";f.appendChild(a);var d=document.createElement("DIV");d.className="colorInput";var h=document.createElement("INPUT");h.id="js_color_picker_blue_color";h.maxlength=3;h.style.width="48px";h.style.fontSize="11px";h.name="BlueColor";h.value=0;d.appendChild(h);f.appendChild(d);var g=document.createElement("DIV");g.className="colorPreviewDiv";g.id="colorPreview";g.style.backgroundColor="#000000";g.innerHTML="<span></span>";g.title="Click on me to assign color";f.appendChild(g);g.onclick=chooseColorSlider;var i=document.createElement("DIV");i.className="colorCodeDiv";var h=document.createElement("INPUT");h.id="js_color_picker_color_code";i.appendChild(h);h.maxLength=7;h.style.fontSize="11px";h.style.width="48px";h.value="#000000";h.onchange=setPreviewColorFromTxt;h.onblur=setPreviewColorFromTxt;f.appendChild(i);var c=document.createElement("DIV");c.style.clear="both";f.appendChild(c);form_widget_amount_slider("sliderRedColor",document.getElementById("js_color_picker_red_color"),170,0,255,"setColorByRGB()");form_widget_amount_slider("sliderGreenColor",document.getElementById("js_color_picker_green_color"),170,0,255,"setColorByRGB()");form_widget_amount_slider("sliderBlueColor",document.getElementById("js_color_picker_blue_color"),170,0,255,"setColorByRGB()")}function setPreviewColorFromTxt(){if(this.value.match(/\#[0-9A-F]{6}/g)){document.getElementById("colorPreview").style.backgroundColor=this.value;var d=this.value.substr(1,2);var c=this.value.substr(3,2);var a=this.value.substr(5,2);document.getElementById("js_color_picker_red_color").value=baseConverter(d,16,10);document.getElementById("js_color_picker_green_color").value=baseConverter(c,16,10);document.getElementById("js_color_picker_blue_color").value=baseConverter(a,16,10);positionSliderImage(false,1,document.getElementById("js_color_picker_red_color"));positionSliderImage(false,2,document.getElementById("js_color_picker_green_color"));positionSliderImage(false,3,document.getElementById("js_color_picker_blue_color"))}}function chooseColor(){color_picker_form_field.value=this.getAttribute("rgbColor");color_picker_div.style.display="none"}function createStatusBar(b){var c=document.createElement("DIV");c.className="colorPicker_statusBar";var a=document.createElement("SPAN");a.id="colorPicker_statusBarTxt";c.appendChild(a);b.appendChild(c)}function chooseColorSlider(){color_picker_form_field.value=document.getElementById("js_color_picker_color_code").value;color_picker_div.style.display="none"}function showColorPicker(a,c){if(!color_picker_div){color_picker_div=document.createElement("DIV");color_picker_div.id="dhtmlgoodies_colorPicker";color_picker_div.style.display="none";document.body.appendChild(color_picker_div);createColorPickerTopRow(color_picker_div);var b=document.createElement("DIV");b.id="color_picker_content";color_picker_div.appendChild(b);createWebColors(b);createNamedColors(b);createAllColorDiv(b);createStatusBar(color_picker_div)}if(color_picker_div.style.display=="none"||color_picker_active_input!=a){color_picker_div.style.display="block"}else{color_picker_div.style.display="none"}color_picker_div.style.left=colorPickerGetLeftPos(a)+"px";color_picker_div.style.top=colorPickerGetTopPos(a)+a.offsetHeight+2+"px";color_picker_form_field=c;color_picker_active_input=a}function setColorByRGB(){var c=document.forms[0];var e=document.getElementById("js_color_picker_red_color").value.replace(/[^\d]/,"");var d=document.getElementById("js_color_picker_green_color").value.replace(/[^\d]/,"");var a=document.getElementById("js_color_picker_blue_color").value.replace(/[^\d]/,"");if(e/1>255){e=255}if(d/1>255){d=255}if(a/1>255){a=255}e=baseConverter(e,10,16)+"";d=baseConverter(d,10,16)+"";a=baseConverter(a,10,16)+"";if(e.length==1){e="0"+e}if(d.length==1){d="0"+d}if(a.length==1){a="0"+a}document.getElementById("colorPreview").style.backgroundColor="#"+e+d+a;document.getElementById("js_color_picker_color_code").value="#"+e+d+a};