// Do not edit this file.
	var CSS = "<style type='text/css'>"
	CSS = CSS + "<!--";
	CSS = CSS + ".ezColorPickerInput {float:left;clear:none;}";
	CSS = CSS + ".ezColorPickerIconArea {width:34px;height:17px;position:relative;float:left;margin-right:2px;margin-left:4px;padding:0px;margin-top:0px;margin-bottom:0px;cursor:pointer;}";
	CSS = CSS + ".ezColorPickerTable {position:absolute;background-color:#ffffff;width:auto;height:auto;margin:0px;padding:0px;}";
	CSS = CSS + ".ezColorPickerTableTD {margin:0px;padding:0px;height:10px;width:10px;cursor:pointer;}";
	CSS = CSS + ".ezColorPickerTransitionArea {width:63px;height:20px;float:left;border:1px solid #000000;margin:1px;padding:0px;}";
	CSS = CSS + ".ezColorPickerCodeValueArea {float:left;font-family:Arial, Helvetica, sans-serif;font-size:11px;padding:4px;cursor:default;}";
	CSS = CSS + ".ezColorPickerClose {float:right;font-family:Arial, Helvetica, sans-serif;font-size:12px;color:#ffffff;text-decoration:none;padding:4px 8px;cursor:pointer;}";
	CSS = CSS + "-->";
	CSS = CSS + "</style>";
	document.write(CSS);
	var strCode = new Array(
		"e51d9a","e51d9b","e51d9c","e51d9d","e51d9e","e51d9f","e51d8a","e51d8b","e51d8c","e51d8d","e51d8e","e51d8f","e51d7a","e51d7b","e51d7c","e51d7d","e51d7e","e51d7f","e51d6a","e51d6b","e51d7c",
	"f32831","f32832","f32833","f32834","f32835","f32836","f32837","f32838","f32839","f32810","f32821","f32822","f32823","f32824","f32825","f32826","f32827","f32828","f32829","f3282a","f3282b",
	"0063aa","0063ab","0063ac","0063ad","0063ae","0063af","0063ba","0063bb","0063bc","0063bd","0063be","0063bf","0063ca","0063cb","0063cc","0063cd","0063ce","0063cf","0063c9","0063b9","0063a9",
	"009a10","009a11","009a12","009a13","009a14","009a15","009a16","009a17","009a18","009a19","009a1a","009a1b","009a21","009a22","009a23","009a24","009a25","009a26","009a27","009a28","009a29",
	"4814a0","4814a1","4814a2","4814a3","4814a4","4814a5","4814a6","4814a7","4814a8","4814a9","4814aa","4814ab","4814b0","4814b1","4814c2","4814b3","4814c4","4814b5","4814b6","4814b7","4814b8",
	"9325a1","9325a2","9325a3","9325a4","9325a5","9325a6","9325a7","9325a7","9325a9","9325aa","9325ab","9325b1","9325b2","9325b3","9325b4","9325b5","9325b6","9325b7","9325b7","9325b9","9325ba",
	"e34e11","e34e12","e34e13","e34e14","e34e15","e34e16","e34e17","e34e18","e34e19","e34e1a","e34e1b","e34e21","e34e21","e34e22","e34e23","e34e24","e34e25","e34e26","e34e27","e34e28","e34e29"
		)

function colorpickerpro_v1(FormName, TextFieldName, ElementNumber, ShowPoundSign, DefaultColor, AutoHideDropDowns, TextFieldClass, totalCountOnPage, ApplyToDOM) {
	//alert('colorpickerpro_v1');
	if (arguments.length != 9 ) {alert("Sorry, there are not enough parameters being passed.");return false;}
	var cp_formName = FormName;
	var cp_textFieldName = TextFieldName;
	var cp_elementNumber = ElementNumber;
	var cp_showPoundSign = ShowPoundSign;
	var cp_defaultColor = DefaultColor;
	var cp_autoHideDropDowns = AutoHideDropDowns;
	var cp_textFieldClass = TextFieldClass;
	var cp_applyToDOM = ApplyToDOM;
	var cp_totalCountOnPage = totalCountOnPage; // How many total color pickers will be on the page. Helps to speed up loops	
	ezcolorpicker_build(cp_elementNumber, cp_textFieldName, cp_autoHideDropDowns, cp_formName, cp_showPoundSign, cp_defaultColor, cp_applyToDOM, cp_totalCountOnPage, cp_textFieldClass);
}


function ezColorPickerToggle(oid, oInput, autoHide, oForm, oTotalCount) { // ezColorPickerTable ID, text input name, auto hide <select>'s: (1,0), oForm: form name 
	//alert('ezColorPickerToggle');
	//alert("oid: " + oid);
	//alert("oInput: " + oInput);
	//alert("autoHide: " + autoHide);
	//alert("oForm: " + oForm);
	//alert("oTotalCount: " + oTotalCount);
	var stripOut = /#/g; // regEx to strip out any pound signs (#)
	if (document.getElementById('ezColorPickerTable' + oid).style.visibility == 'hidden') { // open color picker
		if (autoHide == "yes") {
			autoHideDropDowns('hide', oForm);
		}
		closeAllOtherColorPickers(oid, oTotalCount); // Close all other color picker when you open one 
		ezcolorpicker_ChangeZindex(oid, oTotalCount); // change the z-index of all other icons, so that they won't show through the colorTable 
		document.getElementById('ezColorPickerTable' + oid).style.display = 'inline';
		document.getElementById('ezColorPickerTable' + oid).style.visibility = 'visible';
		var inputColor = document.getElementById(oInput).value; // check text input
		if (inputColor.length) { // if input has a value, transfer to color pallete 
			document.getElementById('ezColorPickerTransitionArea' + oid).style.backgroundColor = "#" + inputColor.replace(stripOut, '');
			document.getElementById('ezColorPickerIconArea' + oid).style.backgroundColor = "#" + inputColor.replace(stripOut, '');
			document.getElementById('ezColorPickerCodeValueArea' + oid).innerHTML = "#" + inputColor.replace(stripOut, ''); // strip off # if in input
		} else { // if input has no value, clear transition and code value areas 
			document.getElementById('ezColorPickerTransitionArea' + oid).style.backgroundColor = '';
			document.getElementById('ezColorPickerCodeValueArea' + oid).innerHTML = '';
		}
	} else { // close color picker
		document.getElementById('ezColorPickerTable' + oid).style.display = 'none';
		document.getElementById('ezColorPickerTable' + oid).style.visibility = 'hidden';
		autoHideDropDowns('show', oForm);
	}
}


function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function colorPick(oid, color, oInput, autoHide, oForm, showPound, oDOM) {
	if (autoHide == "yes") {
		autoHideDropDowns('show', oForm); // show form other form drop-downs
	}
	
	//Sammo's bit
	var DOMString = unescape(oDOM);
	if(DOMString.indexOf('getElementsByClass') != -1){
		var splitDOM = DOMString.split("'");
		var className = splitDOM[1];
		var elementArray = getElementsByClass(className)
		for (var i=0; i < elementArray.length; i++) 
			elementArray[i].style.backgroundColor = "#" + color;
	}else{	
		/* Original code for doing single elements */
		if (oDOM.length) {
			oDOM = unescape(oDOM) + '="#' + color + '"' // unescape is necessary because the oDOM was escaped
			eval(oDOM); // apply color to any object: document.myform.myinput.style.backgroundColor
		}
		/******************************************/
	}
	
	document.getElementById('ezColorPickerIconArea' + oid).style.backgroundColor = "#" + color;
	document.getElementById('ezColorPickerTransitionArea' + oid).style.backgroundColor = color;
	document.getElementById('ezColorPickerTable' + oid).style.display = 'none';
	document.getElementById('ezColorPickerTable' + oid).style.visibility = 'hidden';
	if (showPound == "yes") {
		document.getElementById(oInput).value = "#" + color;
	} else {
		document.getElementById(oInput).value = color;
	}		
}
function colorChanger(oid, color) {
	document.getElementById('ezColorPickerCodeValueArea' + oid).innerHTML = color;
	document.getElementById('ezColorPickerTransitionArea' + oid).style.backgroundColor = color;
}

function ezColorPickerClose(oid, oInput, autoHide, oForm, oDOM) { // this will close and clear the text input value and color settings	
	if (autoHide == "yes") {
		autoHideDropDowns('show', oForm);
	}
	if (oDOM.length) { // clear oDOM
		oDOM = unescape(oDOM) + '=""';
		eval(oDOM);
	}
	document.getElementById('ezColorPickerTransitionArea' + oid).style.backgroundColor = '';
	document.getElementById('ezColorPickerIconArea' + oid).style.backgroundColor = '';
	document.getElementById('ezColorPickerCodeValueArea' + oid).innerHTML = '';
	document.getElementById(oInput).value = '';
	document.getElementById('ezColorPickerTable' + oid).style.display = 'none';
	document.getElementById('ezColorPickerTable' + oid).style.visibility = 'hidden';
}

function autoHideDropDowns(visibility, oForm) { // Automatically hide or show other form drop-downs
	for (var i=0; i < document.forms[oForm].length; i++) {
		if (document.forms[oForm].elements[i].type.toString().charAt(0) == "s" & document.forms[oForm].elements[i].type.toString() != "submit") {	
			if (visibility == 'show') {				
				document.forms[oForm].elements[i].style.display='inline';
				document.forms[oForm].elements[i].style.visibility='visible';
			} else {
				document.forms[oForm].elements[i].style.display='none';
				document.forms[oForm].elements[i].style.visibility='hidden';
			}
		}		
	}
}

function closeAllOtherColorPickers(oid, oTotalCount) { // close all other color picker's
	var donotclose=oid
	var totalCount = oTotalCount + 1; 
	for (var i=0; i < totalCount; i++) {
		if (i != donotclose) { // will not always exist
			try {
				document.getElementById('ezColorPickerTable' + i).style.display = 'none';
				document.getElementById('ezColorPickerTable' + i).style.visibility = 'hidden';			
			} catch (e) {}
		}
	}	
}

function ezcolorpicker_ChangeZindex(oid, oTotalCount) { // change z-index so that icons don't show through color picker table	
	//alert('ezcolorpicker_ChangeZindex');
	var increaseZindex=oid;
	document.getElementById('ezColorPickerTable' + oid).style.zIndex = '1'; // increase z-index for the once you picked
	for (var i=0; i < oTotalCount; i++) {
		if (i != increaseZindex) { // will not always exist
			try {
				document.getElementById('ezColorPickerTable' + i).style.zIndex = '0';	// decrease z-index for all others
			} catch (e) {}
		}
	}	
}

function ezcolorpicker_build(oid, oInput, autoHide, oForm, showPound, defaultColor, oDOM, oTotalCount, oClass) {
	//alert("ezcolorpicker_build");
	//alert("oid: " + oid);
	//alert("oInput: " + oInput);
	//alert("autoHide: " +autoHide);
	//alert("oForm: " + oForm);
	//alert("showPound: " + showPound);
	//alert(defaultColor);
	//alert(oDOM);
	//alert(oClass);
	if (showPound == "yes") {pound = '#';} else {pound = '';} // pound: for # sign. showPound: for yes and no stings.
	var cc=0;
	document.write('<div class="ezColorPickerInput" id="ezColorPickerInput' + oid + '"><input name="' + oInput + '" type="text" size="7" maxlength="7" id="' + oInput + '" value="' + pound + defaultColor + '" class="' + oClass + '" /></div>');
	document.write('<div class="ezColorPickerIconArea" id="ezColorPickerIconArea' + oid + '" onclick="javascript:ezColorPickerToggle(' + oid + ', \'' + oInput + '\', \'' + autoHide + '\', \'' + oForm + '\', \'' + oTotalCount + '\')"><img src="_theme/images/colorpickericon.gif" alt="click to select color" width="34" height="17" border="0" align="absmiddle" id="ezColorPickerImage" /></div>');
	document.write('<table class="ezColorPickerTable" id="ezColorPickerTable' + oid + '" border="0" align="center" cellpadding="0" cellspacing="1" style="position:absolute;display:none;visibility:hidden;z-index:0">');
	document.write('<tr><td bgcolor="#ECE9D8" colspan="21" height="24">');
	document.write('<div class="ezColorPickerTransitionArea" id="ezColorPickerTransitionArea' + oid + '">&nbsp;</div>');
	document.write('<div class="ezColorPickerCodeValueArea" id="ezColorPickerCodeValueArea' + oid + '"></div><div class="ezColorPickerCodeValueArea"></div>');
	document.write('<div class="ezColorPickerClose" onclick="javascript:ezColorPickerClose(' + oid + ', \'' + oInput + '\', \'' + autoHide + '\', \'' + oForm + '\', \'' + oDOM + '\');">x</div>');
	document.write('</td></tr>');
	// start table row
	for (var i=0; i < 12; i++) {
	document.write('<tr>');
	// create tale cell
	for (var td=0; td < 21; td++) { 
	document.write('<td class="ezColorPickerTableTD" width="10" height="10" bgcolor=#' + strCode[cc] + ' onclick="javascript:colorPick(' + oid + ', \'' + strCode[cc] + '\', \'' + oInput + '\', \'' + autoHide + '\', \'' + oForm + '\', \'' + showPound + '\', \'' + oDOM + '\')" onmouseover="javascript:colorChanger(' + oid + ', \'#' + strCode[cc] + '\')"><img src="_theme/images/i.gif" width="10" height="10"></td>'); // trans image is for Opera fix 
		cc++;
	}
	document.write('</tr>');
	}
	document.write('</table>');
	// if default value was given change color in icon area to that color
	var stripOut = /#/g; // regEx to strip out any pound signs (#)
	var thisColor = defaultColor
	if (thisColor.length >= 6) { 
		document.getElementById('ezColorPickerIconArea' + oid).style.backgroundColor="e51d9d" + thisColor.replace(stripOut, '');
	}
}