//====================================================
//Last Mod: 1/3/2005
//By: Sigfrido Chirinos
//Description: Functions to control styler module
//===================================================


//================================================
//changeElement - changes the displayed form field
//element stylers.
//================================================
function changeElement(elem){
	if(elem == "link"){
		document.getElementById("styler-link").style.display = "block";
		document.getElementById("styler-main").style.display = "none";
	}
	else if(elem == "main"){
		document.getElementById("styler-link").style.display = "none";
		document.getElementById("styler-main").style.display = "block";
	}
}//end changeElement function


//================================================
//recattrib - records change to hidden element
//================================================
function recattrib(elemid, value){

	//record attribute to hidden element
	document.getElementById(elemid).value = value;

}//end recattrib function


//================================================
//cattrib - changes the style based on arguements
//================================================
function cattrib(elem, attrib, value){

	if(attrib == 'font'){
		if(elem == "link"){
			document.getElementById("link1").style.fontFamily = value;
			document.getElementById("link2").style.fontFamily = value;
			document.getElementById("link3").style.fontFamily = value;
			recattrib("link-font", value);
		}
	}
	else if(attrib == 'fontsize'){
		if(elem == "link"){
			document.getElementById("link1").style.fontSize = value+"px";
			document.getElementById("link2").style.fontSize = value+"px";
			document.getElementById("link3").style.fontSize = value+"px";
			recattrib("link-fontsize", value+"px");
		}
	}
	else if(attrib == 'bwidth'){
		if(elem == "main"){
			document.getElementById("linkzu").style.borderWidth = value+"px";
			recattrib("main-borderwidth", value+"px");
		}
	}
}//end cattrib function


//================================================
//pickColor - changes color of element
//================================================
function pickColor(colorvalue){

	if (document.getElementById("font-color").checked == true){
		document.getElementById("link1").style.color = colorvalue;
		document.getElementById("link3").style.color = colorvalue;
		recattrib("link-fontcolor", colorvalue);
	}
	else if(document.getElementById("back-color").checked == true){
		document.getElementById("link1").style.backgroundColor = colorvalue;
		document.getElementById("link3").style.backgroundColor = colorvalue;
		recattrib("link-backcolor", colorvalue);	
	}
	else if(document.getElementById("fonthover-color").checked == true){
		document.getElementById("link2").style.color = colorvalue;
		recattrib("link-fonthovercolor", colorvalue);	
	}
	else if(document.getElementById("backhover-color").checked == true){
		document.getElementById("link2").style.backgroundColor = colorvalue;
		recattrib("link-backhovercolor", colorvalue);	
	}	
	else if(document.getElementById("border-color").checked == true){
		document.getElementById("linkzu").style.borderColor = colorvalue;
		recattrib("main-borderleftcolor", colorvalue);
		recattrib("main-bordertopcolor", colorvalue);
		recattrib("main-borderrightcolor", colorvalue);
		recattrib("main-borderbottomcolor", colorvalue);	
	}
	else if(document.getElementById("border-left-color").checked == true){
		document.getElementById("linkzu").style.borderLeftColor = colorvalue;
		recattrib("main-borderleftcolor", colorvalue);	
	}
	else if(document.getElementById("border-right-color").checked == true){
		document.getElementById("linkzu").style.borderRightColor = colorvalue;
		recattrib("main-borderrightcolor", colorvalue);	
	}
	else if(document.getElementById("border-top-color").checked == true){
		document.getElementById("linkzu").style.borderTopColor = colorvalue;
		recattrib("main-bordertopcolor", colorvalue);	
	}
	else if(document.getElementById("border-bottom-color").checked == true){
		document.getElementById("linkzu").style.borderBottomColor = colorvalue;
		recattrib("main-borderbottomcolor", colorvalue);	
	}
}//end pickColor


