// 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:#000000;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:#000000;text-decoration:none;padding:4px 8px;cursor:pointer;}";
	CSS = CSS + "-->";
	CSS = CSS + "</style>";
	document.write(CSS);
	var strCode = new Array(
			"FF0000","FFFF00","00FF00","00FFFF","0000FF","FF00FF","FFFFFF","EBEBEB","E1E1E1","D7D7D7","CCCCCC","C2C2C2","B7B7B7","ACACAC","A0A0A0","959595",
			"ED1C24","FFF200","00A650","00ADEF","2E3092","EC008C","898989","7C7C7C","707070","626262","545454","464646","363636","252525","111111","000000",
			"F69679","F9AD81","FDC689","FFF799","C4DF9B","A2D39C","82CA9C","7ACCC8","6DCFF6","7DA7D8","8393CA","8781BD","A186BE","BC8CBF","F49AC1","F5989D",
			"F26C4F","F68E56","FBAF5D","FFF468","ACD373","7CC576","3CB878","1CBBB4","00BFF3","448CCA","5574B9","605CA8","8560A8","A863A8","F06EA9","F26D7D",
			"ED1C24","F26522","F7941D","FFF200","8DC63F","39B44A","00A650","00A99D","00ADEF","0072BC","0054A6","2E3092","662D91","92278F","EC008C","ED145A",
			"9D0A0E","A0410D","A36109","ABA000","598527","197A30","007236","00736A","0076A3","004A80","003471","1B1464","440E62","620460","9E005D","9D0039",
			"790000","7B2E00","7D4900","827A00","3F6618","005E20","005825","005951","005B7F","003663","002157","0D004C","32004B","4B0049","7B0046","790026",
			"C7B299","988675","736257","534741","362F2D","C69C6D","A57C52","8C6239","754C24","603913","ECE9D8","ECE9D8","ECE9D8","ECE9D8","ECE9D8","ECE9D8"
	)

function colorpickerpro_v1(FormName, TextFieldName, ElementNumber, ShowPoundSign, DefaultColor, AutoHideDropDowns, TextFieldClass, totalCountOnPage, ApplyToDOM) {
	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 
	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	
	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) {
	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="/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="16" 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 < 8; i++) {
	document.write('<tr>');
	// create tale cell
	for (var td=0; td < 16; 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="/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="#" + thisColor.replace(stripOut, '');
	}
}