 /*changecolor copywrite 2003 Techier.com. All rights reserved. You can put up a link to this site to use the color selector as a free service, but please don't copy this to other sites without permission. The menu itself is from cooljsmenu at http://javascript.cooldev.com/scripts/coolmenu/
*/
 
   function changeColor(selnewcol,ttarget) {
   document.Show[ttarget].value=selnewcol;
   tdselected = "td" + ttarget;
  document.getElementById(tdselected).style.backgroundColor=selnewcol;
   switch (ttarget)
{
	case "PageTop":
	document.getElementById("Toparea").style.backgroundColor=selnewcol;
	break;
		case "PageBar":
		document.getElementById("Topbararea").style.backgroundColor=selnewcol;
		document.getElementById("pagebottom").style.backgroundColor=selnewcol;
	break;
	case "PageName":
	document.getElementById("company").style.color=selnewcol;
	break;
	case "PageSide":
	document.getElementById("Sidearea").style.backgroundColor=selnewcol;
	break;
	case "Bodytextarea":
	document.getElementById("Bodytextarea3").style.backgroundColor=selnewcol;
	document.getElementById("Bodytextarea2").style.backgroundColor=selnewcol;
	break;
	case "PageBackground":
	document.body.style.backgroundColor=selnewcol;
	break;
	//Drop down menu control Level 0 follows	
	case "L1text":
				switch (brwser) {
				case "ie5":
					document.styleSheets[0].rules[0].style.color=selnewcol; break;
				case  "ns6":
				 document.styleSheets[0].cssRules[0].style.color=convertformat(red,green,blue); break;
					 case "opera":
					alert ("Dynamic text change editor  not supported in Opera yet, however  the menu is fully supported"); break;
					 case "X":
					alert ("dynamic text changes  for easy menu design  requires IE 5 + or Netscape 6 + .");
					 break;
					}
	break;
	case "L1back"://level 1 no mouseover background color
			for (i=0;i<IDLevel1n.length;i++){
		document.getElementById(IDLevel1n[i]).style.backgroundColor=selnewcol;
		}
	break;
	case "L1textmouse":
	switch (brwser) {
				case "ie5":
					document.styleSheets[0].rules[1].style.color=selnewcol; break;
				case  "ns6":
				 document.styleSheets[0].cssRules[1].style.color=convertformat(red,green,blue); break;
					 case "opera":
					alert ("Dynamic text change editor  not supported in Opera yet, however  the menu is fully supported"); break;
					 case "X":
					alert ("dynamic text changes  for easy menu design  requires IE 5 + or Netscape 6 + .");
					 break;
					}
	
	break;
	case "L1backmouse"://level 1 no mouseover background color
			for (i=0;i<IDLevel1o.length;i++){
document.getElementById(IDLevel1o[i]).style.backgroundColor=selnewcol;
	//document.getElementById(IDLevel1o[i]).HiBck = selnewcol;
		}
	break;
	case "L1border": //border is displayed via id 1, the background holder of all the cells
	for (i=0;i<IDLevel1b.length;i++){
document.getElementById(IDLevel1b[i]).style.backgroundColor=selnewcol;
}

	break;
	case "L1shadow": //border is displayed via id 1, the background holder of all the cells
	for (i=0;i<IDLevel1s.length;i++){
document.getElementById(IDLevel1s[i]).style.backgroundColor=selnewcol;
}

	break;
	
	//Level 1 below
	
	case "L2text":
	switch (brwser) {
				case "ie5":
					document.styleSheets[0].rules[2].style.color=selnewcol; break;
				case  "ns6":
				 document.styleSheets[0].cssRules[2].style.color=convertformat(red,green,blue); break;
					 case "opera":
					alert ("Dynamic text change editor  not supported in Opera yet, however  the menu is fully supported"); break;
					 case "X":
					alert ("dynamic text changes  for easy menu design  requires IE 5 + or Netscape 6 + .");
					 break;
					}
	break;
	case "L2back"://level 1 no mouseover background color
		for (i=0;i<IDLevel2n.length;i++){
		document.getElementById(IDLevel2n[i]).style.backgroundColor=selnewcol;
		}
	break;
	case "L2textmouse":
	
		switch (brwser) {
				case "ie5":
					document.styleSheets[0].rules[3].style.color=selnewcol; break;
				case  "ns6":
				 document.styleSheets[0].cssRules[3].style.color=convertformat(red,green,blue); break;
					 case "opera":
					alert ("Dynamic text change editor  not supported in Opera yet, however  the menu is fully supported"); break;
					 case "X":
					alert ("dynamic text changes  for easy menu design  requires IE 5 + or Netscape 6 + .");
					 break;
					}
	break;
	case "L2backmouse"://level 1 no mouseover background color
		for (i=0;i<IDLevel2o.length;i++){
		document.getElementById(IDLevel2o[i]).style.backgroundColor=selnewcol;
		}
	break;
	case "L2border": 
	//alert ("border L2");
for (i=0;i<IDLevel2b.length;i++){
		document.getElementById(IDLevel2b[i]).style.backgroundColor=selnewcol;
		document.getElementById(IDLevel2b[i]).style.borderLeftColor=selnewcol;
		}
	break;
	case "L2shadow": //border is displayed via id 1, the background holder of all the cells
	for (i=0;i<IDLevel2s.length;i++){
document.getElementById(IDLevel2s[i]).style.backgroundColor=selnewcol;
}
	
	//level 3 below
	
	case "L3text":
		switch (brwser) {
				case "ie5":
					document.styleSheets[0].rules[4].style.color=selnewcol; break;
				case  "ns6":
				 document.styleSheets[0].cssRules[4].style.color=convertformat(red,green,blue); break;
					 case "opera":
					alert ("Dynamic text change editor  not supported in Opera yet, however  the menu is fully supported"); break;
					 case "X":
					alert ("dynamic text changes  for easy menu design  requires IE 5 + or Netscape 6 + .");
					 break;
					}
	break;
	case "L3back"://level 1 no mouseover background color
		for (i=0;i<IDLevel3n.length;i++){
		document.getElementById(IDLevel3n[i]).style.backgroundColor=selnewcol;
		}
	break;
	case "L3textmouse":
	
		switch (brwser) {
				case "ie5":
					document.styleSheets[0].rules[5].style.color=selnewcol; break;
				case  "ns6":
				 document.styleSheets[0].cssRules[5].style.color=convertformat(red,green,blue); break;
					 case "opera":
					alert ("Dynamic text change editor  not supported in Opera yet, however  the menu is fully supported"); break;
					 case "X":
					alert ("dynamic text changes  for easy menu design  requires IE 5 + or Netscape 6 + .");
					 break;
					}
	break;
	case "L3backmouse"://level 1 no mouseover background color
			for (i=0;i<IDLevel3o.length;i++){
		document.getElementById(IDLevel3o[i]).style.backgroundColor=selnewcol;
		}
	break;
	case "L3border": //border is displayed via id 1, the background holder of all the cells
	for (i=0;i<IDLevel3b.length;i++){
		document.getElementById(IDLevel3b[i]).style.backgroundColor=selnewcol;
		}
	break;
	case "L3shadow": //border is displayed via id 1, the background holder of all the cells
	for (i=0;i<IDLevel3s.length;i++){
document.getElementById(IDLevel3s[i]).style.backgroundColor=selnewcol;
}
}
}  
function levelwhich(){
lvl=(document.Show.Idtarget.value=="L1")?0:(document.Show.Idtarget.value=="L2")?1:(document.Show.Idtarget.value=="L3")?2:3;//for who knows what reason, lvl=0 is level 1 etc...
return (lvl);
}
function borderSize() {
lvl = levelwhich();
bordersz=document.Show.bordersize.value;
if (lvl==0) document.Show.L1bordersize.value=bordersz;
	if (lvl==1) document.Show.L2bordersize.value=bordersz;
	if (lvl==2) document.Show.L3bordersize.value=bordersz;
}
function shadowSize() {
lvl = levelwhich();
shadowsz=document.Show.shadowsize.value;
if (lvl==0) document.Show.L1shadowsize.value=shadowsz;
	if (lvl==1) document.Show.L2shadowsize.value=shadowsz;
	if (lvl==2) document.Show.L3shadowsize.value=shadowsz;
}
function fontSize() {
//add netscape switch which reloads page
lvl = levelwhich();
if (lvl!=3) {
	levl=(lvl*2);// there are six style rules, L1 is 0,1, L2 is 2,3, L3 is 4,5
	levlo=(lvl*2)+1;
	fontvalue=document.Show.fontsize.value;
	if (lvl==0) document.Show.L1fontsize.value=fontvalue;
	if (lvl==1) document.Show.L2fontsize.value=fontvalue;
	if (lvl==2) document.Show.L3fontsize.value=fontvalue;
		switch (brwser) {
					case "ie5":
						document.styleSheets[0].rules[levl].style.fontSize=fontvalue;  
						document.styleSheets[0].rules[levlo].style.fontSize=fontvalue;  break;
					case  "ns6":
					 document.styleSheets[0].cssRules[levl].style.fontSize=fontvalue; 
					  document.styleSheets[0].cssRules[levlo].style.fontSize=fontvalue; break;
						 case "opera":
						alert ("Dynamic text change editor  not supported in Opera yet, however  the menu  itself is fully supported"); 
						break; 
						case "X":
						alert ("dynamic text changes  for easy menu design  requires IE 5 + or Netscape 6 + .");
						 break;
						}
		}
}
function fontname() {
lvl = levelwhich();

	fontnm=document.Show.font.value;
	if (lvl==0) document.Show.L1font.value=fontnm;
	if (lvl==1) document.Show.L2font.value=fontnm;
	if (lvl==2) document.Show.L3font.value=fontnm;
	if (lvl==3) alert ("Please choose a menu level to change first");
}
function fontWeight() {
lvl = levelwhich();
if (lvl!=3) {
	levl=(lvl*2);// there are six style rules, L1 is 0,1, L2 is 2,3, L3 is 4,5
	levlo=(lvl*2)+1;
	fontwait=document.Show.fontweight.value;
	if (lvl==0) document.Show.L1fontweight.value=fontwait;
	if (lvl==1) document.Show.L2fontweight.value=fontwait;
	if (lvl==2) document.Show.L3fontweight.value=fontwait;
	
		switch (brwser) {
					case "ie5":
						document.styleSheets[0].rules[levl].style.fontWeight=fontwait;  
						document.styleSheets[0].rules[levlo].style.fontWeight=fontwait;  break;
					case  "ns6":
					 document.styleSheets[0].cssRules[levl].style.fontWeight=fontwait; 
					  document.styleSheets[0].cssRules[levlo].style.fontWeight=fontwait; break;
						 case "opera":
						alert ("Dynamic text change editor  not supported in Opera yet, however  the menu  itself is fully supported"); 
						break; 
						case "X":
						alert ("dynamic text changes  for easy menu design  requires IE 5 + or Netscape 6 + .");
						 break;
						}
		}
}
		
var IDLevel1 = new Array(0,13);var list1n;var list3n
var  IDLevel1b = new Array();var  IDLevel1o = new Array();var  IDLevel1n = new Array();var  IDLevel1s = new Array();
for (i=0;i<IDLevel1.length;i++) {
 IDLevel1n[i]="cmimenu1_"+ IDLevel1[i]+"n";
 IDLevel1b[i]="cmimenu1_"+ IDLevel1[i]+"b";
 IDLevel1o[i]="cmimenu1_"+ IDLevel1[i]+"o";
 IDLevel1s[i]="cmimenu1_"+ IDLevel1[i]+"s";
list1n+="cmimenu1_"+ IDLevel1[i]+"n";
}

var  IDLevel2 = new Array(1,5,8,14,17,20,23);//
var  IDLevel2b = new Array();var  IDLevel2o = new Array();var  IDLevel2n = new Array();var  IDLevel2s = new Array();
for (i=0;i<IDLevel2.length;i++) {
 IDLevel2n[i]="cmimenu1_"+ IDLevel2[i]+"n";
 IDLevel2b[i]="cmimenu1_"+ IDLevel2[i]+"b";
 IDLevel2o[i]="cmimenu1_"+ IDLevel2[i]+"o";
 IDLevel2s[i]="cmimenu1_"+ IDLevel2[i]+"s";
}

var IDLevel3 = new Array(2,3,4,6,7,9,10,11,12,15,16,18,19,21,22,24);//
var IDLevel3b = new Array();var IDLevel3o = new Array();var IDLevel3n = new Array();var IDLevel3s = new Array();
for (i=0;i< IDLevel3.length;i++) {
IDLevel3n[i]="cmimenu1_"+IDLevel3[i]+"n";
IDLevel3b[i]="cmimenu1_"+IDLevel3[i]+"b";
IDLevel3o[i]="cmimenu1_"+IDLevel3[i]+"o";
IDLevel3s[i]="cmimenu1_"+IDLevel3[i]+"s";
list3n+="cmimenu1_"+IDLevel3[i]+"n";
}

function showhide() {
//alert ("showhide");
lvl=levelwhich();
if  (lvl<3) {
	//document.getElementById('targetvalues').style.visibility='visible';
	document.Show.targetval.style.backgroundColor="#FFFFFF";
	document.Show.targetval.style.color="#330099";
	document.Show.fontsize.style.backgroundColor="#FFFFFF";
	document.Show.fontsize.style.color="#330099";
	document.Show.font.style.backgroundColor="#FFFFFF";
	document.Show.font.style.color="#330099";
	document.Show.fontweight.style.backgroundColor="#FFFFFF";
	document.Show.fontweight.style.color="#330099";
	document.Show.bordersize.style.backgroundColor="#FFFFFF";
	document.Show.bordersize.style.color="#330099";
	document.Show.shadowsize.style.backgroundColor="#FFFFFF";
	document.Show.shadowsize.style.color="#330099";
			switch (brwser) {
						case "ie5":
							document.styleSheets[0].rules[10].style.color="#003366"; break;
						case  "ns6":
						 document.styleSheets[0].cssRules[10].style.color="blue"; break;
						 }
	} else  {
	//document.getElementById('targetvalues').style.visibility='hidden';
	document.Show.targetval.style.backgroundColor="#999999";
	document.Show.targetval.style.color="#666666";
	document.Show.fontsize.style.backgroundColor="#999999";
	document.Show.fontsize.style.color="#666666";
	document.Show.font.style.backgroundColor="#999999";
	document.Show.font.style.color="#666666";
	document.Show.fontweight.style.backgroundColor="#999999";
	document.Show.fontweight.style.color="#666666";
	document.Show.bordersize.style.backgroundColor="#999999";
	document.Show.bordersize.style.color="#666666";
	document.Show.shadowsize.style.backgroundColor="#999999";
	document.Show.shadowsize.style.color="#666666";
				switch (brwser) {
				case "ie5":
					document.styleSheets[0].rules[10].style.color="#FFFFFF"; break;
				case  "ns6":
				 document.styleSheets[0].cssRules[10].style.color="white"; break;
				 }
    }
}
function convertformat(red,green,blue) {
rgbstring="rgb(";
red255=HexToNum(red);
green255=HexToNum(green);
blue255=HexToNum(blue);
rgbstring+=red255+","+green255+","+blue255+")";
return rgbstring;
}
function HexToNum(numba) {

tens = MakeNum(numba.substring(0,1));
ones =  MakeNum(numba.substring(1,1));
rgbnumber=(tens*16) + ones;
return rgbnumber;
}

function MakeNum(str) {
if((str >= 0) && (str <= 9))
return str;
switch(str.toUpperCase()) {
case "A": return 10;
case "B": return 11;
case "C": return 12;
case "D": return 13;
case "E": return 14;
case "F": return 15;
default:  return 0;
   }
}
