/* Browser check */
IS_DOM = (document.getElementById) ? true : false;
IS_IE = (document.all) ? true : false;
IS_IE50 = (navigator.userAgent.indexOf("IE 5.0") != -1);
IS_Mac = (navigator.appVersion.indexOf("Mac") != -1);

function getThis(sId)
{
	var oObject;
	oObject = false;
	
	if (IS_DOM) {
		if (document.getElementById(sId)) {
			oObject = document.getElementById(sId);
		}
	}
	
	return oObject;
}

function changeStyle(oElement, sPropertyName, sNewValue)
{
	if (oElement != false) {
		// get element style attribute
		oStyle = oElement.style;
		// apply new style value to provided property
		eval("oStyle." + sPropertyName + " = '" + sNewValue + "'");
	}
}

function getStyle(oElement, sPropertyName)
{
	var sReturn = false;
	
	if (oElement != false) {
		oStyle = oElement.style;
		sReturn = eval("oStyle." + sPropertyName);
	}
	
	return sReturn;
}

function showContent(iHighlightId, sContentType, sContentContainer)
{
	showContentBox(iHighlightId, sContentType);
	rollColorBox(iHighlightId, sContentContainer);
}

function rollColorBox(iBoxId, sContentContainer)
{	
	iLinkPosition = iBoxId - 1;
	oLinkContainer = getThis(sContentContainer);
	oLinks = oLinkContainer.getElementsByTagName("a");
	
	if (oLinks != false) {
		for (i = 0; i < oLinks.length; i++) {
			oLinks[i].className = "regular";
		}
		oLinks[iLinkPosition].className = "selected";
	}
}

function showContentBox(iBucketId, sContentType)
{
	sBucketId = sContentType + iBucketId;
	clearContentBoxes(sContentType);
	oBox = getThis(sBucketId);
	
	if (oBox != false) {
		changeStyle(oBox, "display", "block");
	}
}

function clearColorBoxes()
{
	oBoxContainer = getThis(sContentContainer);
	
	if (oBoxContainer != false) {
		oBoxes = oBoxContainer.getElementsByTagName("a");
		
		for (i = 0; i < oBoxes.length; i++) {
			oBoxes[i].className = "regular";
		}
	}
}

function clearContentBoxes(sContentType)
{
	if (sContentType == "newsEvents") {
		if (document.getElementById) {
			for (i = 0; i < 3; i++) {
				sBox = "newsEvents" + i;
				oBox = document.getElementById(sBox).style;
				oBox.display = "none";
			}
		}
	} else {
		if (document.getElementById) {
			for (i = 0; i < 3; i++) {
				sBox = "highlight" + i;
				oBox = document.getElementById(sBox).style;
				oBox.display = "none";
			}
		}
	}
}

