var isIE = navigator.appName.indexOf("Microsoft") != -1;

function centerPageElement(divId, divWdt) {
	if (!divId) divId = "menuWrapper";
	if (!divWdt) divWdt = 766;
    var containerDiv = document.getElementById(divId);
    var bodyWidth = document.body.clientWidth;
    var leftMargin = (bodyWidth - divWdt) / 2;
    containerDiv.style.left = leftMargin + "px";
    containerDiv.style.display = "block";
}

// Functions to support navigation menus
var activeMenuId;
function showMenu(mid) {
	if (hideTimer) window.clearTimeout(hideTimer);
	if (mid != activeMenuId) {
		if (activeMenuId) hideMenu(activeMenuId);
		var menuDiv = document.getElementById(mid);
		menuDiv.style.display = "block";
		activeMenuId = mid;
	}
}

var hideTimer;
function initHideMenu(mid) {
	if (hideTimer) window.clearTimeout(hideTimer);
	hideTimer = window.setTimeout("hideMenu('" + mid + "')", 250);
}

function hideMenu(mid) {
	if (hideTimer) window.clearTimeout(hideTimer);
	var menuDiv = document.getElementById(mid);
	menuDiv.style.display = "none";
	activeMenuId = null;
}

var activeCell;
function menuItemOver(cellObj) {
	if (activeCell) menuItemOut();
	activeCell = cellObj;
	activeCell.style.backgroundColor = "#607DB9";
}

function menuItemOut() {
	if (activeCell) {
		activeCell.style.backgroundColor = "";
		activeCell = null;
	}
}

function writeFlashTag(id, src, height, width, varStr) {
	if (varStr == null) varStr = "";
	if (isIE) {
		document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"");
		document.write("  codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" ");
		document.write(" id=\"" + id + "\" width=\"" + width + "\" height=\"" + height + "\">");
		document.write(" <param name=\"allowScriptAccess\" value=\"sameDomain\" />");
		document.write(" <param name=\"movie\" value=\"" + src + "\">");
		document.write(" <param name=\"quality\" value=\"high\" /> ");
		document.write(" <param name=\"bgcolor\" value=\"#ffffff\" /> ");
		if (varStr && varStr != "")
			document.write(" <param name=\"FlashVars\" value=\"" + varStr + "\" /> "); 
		document.write("</object>");
	} else {
		document.write(" <embed src=\"" + src + "\" quality=\"high\" bgcolor=\"#ffffff\"  ");
		document.write(" width=\"" + width + "\" height=\"" + height + "\" name=\"" + id + "\"  ");
		document.write(" allowScriptAccess=\"sameDomain\"");
		if (varStr && varStr != "")		
			document.write(" flashvars=\"" + varStr + "\"");
		document.write(" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
	}
}

function toggleSectionVisible(headerDiv, toggleElemId, isInline) {
	if (!document.getElementById) return;
    var sectionDiv = document.getElementById(toggleElemId);
	if (!sectionDiv) return;
	var visibleState = isInline ? "inline" : "block";
	sectionDiv.style.display = (sectionDiv.style.display == "none") ? visibleState : "none";
	headerDiv.className = sectionDiv.style.display == visibleState ? "sectionHeadExp" : "sectionHeadCol";
}