// Global variable to identifying the current style template
var pageClass;

// Init events and template
function init() {
	// Set the ID of the body tag which is our overall class
	pageClass = document.getElementsByTagName('body').item(0).id;
	
	// Attach list icon hovering to linkLists
	var listBoxes = document.getElementsByTagName("div");
	for(i=0; i < listBoxes.length; i++) {
		if(listBoxes[i].className == "linkList") {
			// Get all links in list
			linkL = listBoxes[i].getElementsByTagName("a");
			
			// Attach events to the links
			for(j=0; j < linkL.length; j++) {
				YAHOO.util.Event.addListener(linkL[j], "mouseover", fnActivateArrow, linkL[j]);
				YAHOO.util.Event.addListener(linkL[j], "mouseout", fnDeactivateArrow, linkL[j]);
			}
		}
	}
}

// Set active arrow as image for this element's list item tag
function fnActivateArrow(evt, elt) {
	if(elt.parentNode.tagName == "LI") {
		elt.parentNode.style.listStyleImage = "url(/resources/images/arrow_" + pageClass + ".gif)";
	}
}

// Set grey arrow as image for this element's list item tag
function fnDeactivateArrow(evt, elt) {
	if(elt.parentNode.tagName == "LI") {
		elt.parentNode.style.listStyleImage = "url(/resources/images/arrow_grey.gif)";
	}
}

// Hilite the headlines in the side boxes on home page when hovering
function hiliteHomeBox(style, elt) {
	var img = elt.getElementsByTagName('IMG')[0];
	src = img.src.replace(/_normal.gif/, '');
	src = src.replace(/_hover.gif/, '');
	src = src + '_' + style + '.gif';
	//alert(src);
	img.src = src;	
}

function hiliteHomeBoxNew(elt) {
	elt.style.backgroundImage = "url(/resources/images/home_" + elt.id + "_over.jpg)";
}

function normalHomeBoxNew(elt) {
	elt.style.backgroundImage = "url(/resources/images/home_" + elt.id + "_off.jpg)";
}

function homeSideBoxColor(elt, color) {
	var headline = document.getElementById(elt.id + '_headline');
	//headline.style.color = color;
	elt.style.borderColor = color;
}