// 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(
		"FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF",
		"F7F7F7","F4F2EE","F1ECE5","F1E9E0","F1E6DA","F7E5DC","FDE5DD","FDEADF","FEF1E1","FFFDE5","F0F7E6","E8F4E6","E0F2E6","DEF2F1","DAF3FD","DEE9F5","E0E4F2","E1DFEE","E7E1EF","EEE2EF","FCE6EF","FCE5E6",
		"EEEEEE","E9E4DD","E3D9CC","E3D3C1","E3CEB6","EFCCB9","FBCBBC","FCD6C0","FEE3C4","FFFBCC","E2EFCD","D1E9CE","C1E5CE","BDE6E4","B6E7FB","BED3EC","C1C9E5","C3C0DE","D0C3DF","DEC6DF","FACDE0","FACCCE",
		"E3E3E3","DCD4CB","D5C5B3","D4BDA2","D4B592","E6B396","F8B09B","FBC2A1","FED4A7","FFF9B3","D3E7B4","B9DEB5","A1D7B5","9BD9D6","92DBF8","9EBDE2","A2AED7","A5A1CE","B9A4CE","CDA9CF","F7B3D1","F8B2B6",
		"D7D7D7","CFC5B8","C7B299","C6A783","C69C6D","DE9973","F69679","F9AD81","FDC689","FFF799","C4DF9B","A2D39C","82CA9C","7ACCC8","6DCFF6","7DA7D8","8393CA","8781BD","A186BE","BC8CBF","F49AC1","F5989D",
		"C9C9C9","C3B9AD","BCA891","BD9E7C","BE9567","DA8D6B","F6866E","F9A475","FDC07B","FFF785","BEDD8F","95D091","70C693","6AC9C3","5FCCF6","6DA1D6","728BC6","7C77B8","9A7AB9","B77FB9","F485BB","F58694",
		"BBBBBB","B4ABA0","AD9A85","B19271","B48A5D","D57C5E","F66F5F","F99763","FDB867","FFF767","B5DB7E","82CD82","57C185","52C4BD","49C8F6","5498D3","5880C1","6B68B2","8F6AB2","B16CB2","F466B2","F56C89",
		"ADADAD","A59B92","9C8977","A28365","A87E53","CF6950","F6554D","F9894E","FDAF4F","FFF744","ABD86B","6CC871","3ABB75","37BEB5","31C2F6","388ECF","3B74BB","5757AA","8357A9","A956A9","F444A8","F54F7B",
		"9E9E9E","948B84","8A7869","937558","9C7247","C95640","F63B3A","F97A3A","FDA538","FFF724","9FD357","55C260","1EB465","1CB7AC","19BBF6","1D82C9","1E66B4","4446A1","7743A0","A0409F","F4229D","F5336D",
		"909090","857D76","79695C","85684C","90673D","C14634","F2252B","F76C29","FC9A25","FFF709","93CC46","41BA50","08AB57","07AEA2","07B3F4","0877C1","085AAB","343697","6B3295","962D94","F10891","F21B60",
		"828282","776F6A","6C5C52","7A5D43","875D35","B7392A","E7161F","EB601C","F18E18","F8EB00","87C03A","32AF44","00A04B","00A397","00A8E9","006DB6","004FA1","282A8C","60268A","8C2089","E50085","E60D55",
		"737373","69625E","5E5149","6E533A","7D542C","A83021","D30D16","D75413","DB7F0F","E3D700","77AF30","249F3A","009241","009589","0099D5","0060A6","004492","201F7E","551B7D","7E167B","D10078","D20649",
		"636363","5B5552","524640","634932","744C24","972A19","BA080E","BD480C","C16F09","C8BD00","679A28","198C32","008138","008379","0087BD","005493","003981","191570","4A126E","6F0E6C","B90069","B9023F",
		"525252","4D4845","473D38","5A412A","6C441D","862412","A00408","A23D07","A56005","ACA200","578521","0E7A2B","007131","007269","0075A4","00477F","002F70","140D61","400B60","60085E","A0005B","9F0135",
		"424242","403C3A","3D3532","513924","653D17","771F0D","890204","8B3503","8D5202","938A00","49731C","066925","00622A","00635B","00668E","003D6E","002761","100555","380553","540451","8A004E","89012C",
		"313131","302D2B","2E2825","3D2B1B","4C2E11","59170A","670103","682802","6A3D01","6E6700","375615","044F1C","00491F","004A44","004C6A","002E52","001D49","0C0440","2A043E","3F033D","67003A","670121",
		"222222","201E1E","1E1A19","281C12","321E0B","3B0F06","440102","451A01","462901","494500","24390E","033412","003115","00312D","003347","001E37","001330","08022A","1C0229","2A0228","450027","440016",
		"141414","121111","0F0D0D","140E09","190F06","1E0803","220101","230D01","231501","252300","121D07","021A09","00190B","001917","001A24","000F1C","000A18","040115","0E0115","150114","230014","22000B",
		"000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000"
	)

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="_inc/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="22" 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 < 19; i++) {
	document.write('<tr>');
	// create tale cell
	for (var td=0; td < 22; 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="_inc/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, '');
	}
}
