
/*
Dynamic menu for Indosat Website
Copyright (c)2003 kemangnet.com e-solutions
Browser: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
*/

// Browser-specific functions

function getElement(sElementName) {
	var oElement = eval("document.all." + sElementName);
	return oElement;
}

function show(sElementName) {
	var oElement = getElement(sElementName);
	if (oElement != null) oElement.style.visibility = "visible";
}

function hide(sElementName) {
	var oElement = getElement(sElementName);
	if (oElement != null) oElement.style.visibility = "hidden";
}

function highlightCell(iCellID) {
	var oElement = getElement("c" + iCellID);
	if (oElement != null) {
		oElement.style.backgroundColor = "#3377bb";
		oElement.style.borderTop = "#3377bb 1px solid";
		oElement.style.borderBottom = "#3377bb 1px solid";
	}
}

function unhighlightCell(iCellID) {
	var oElement = getElement("c" + iCellID);
	if (oElement != null) {
		oElement.style.backgroundColor = "#3388CC";
		oElement.style.borderTop = "#6699ff 1px solid";
		oElement.style.borderBottom = "#3355aa 1px solid";
	}
}

function highlightMainMenu(iMenuID) {
	var oElement = getElement("m" + iMenuID);
	if (oElement != null) oElement.style.backgroundColor = "#3377bb";
}

function unhighlightMainMenu(iMenuID) {
	var oElement = getElement("m" + iMenuID);
	if (oElement != null) oElement.style.backgroundColor = "#3388CC";
}
// End browser-specific functions

function showGroup(iGroupID) {
	show("g" + iGroupID);
	aSelected[iGroupID] = true;
}

function hideGroup(iGroupID) {
	hide("g" + iGroupID);
	aSelected[iGroupID] = false;
}

function mOver(iMenuID) {
	cancelClearTime();
	//highlightMainMenu(iMenuID);
	showGroup(iMenuID);
	eval("clearOtherMenus(t" + iMenuID + ")");
}

function mOut(iMenuID) {
	setClearTime();
}

function gOver(iGroupID) {
	cancelClearTime();
	eval("clearOtherMenus(t" + iGroupID + ")");
}

function gOut(iGroupID) {
	setClearTime();
}

function cOver(iCellID, iChildID, iParentID) {
	highlightCell(iCellID);
	if (iChildID != null) {
		eval("clearOtherMenus(t" + iChildID + ")");
		setTimeout("showGroup(" + iChildID + ")", 10);
	}
	else {
		if (iParentID != null) eval("clearOtherMenus(t" + iParentID + ")");
	}
}


function cOut(iCellID, iChildID, iParentID) {
	unhighlightCell(iCellID);
}

function clearMenus() {
	for (var i = 0; i < aSelected.length; i++) {
		if (aSelected[i] == true) {
			hideGroup(i);
			//unhighlightMainMenu(i);
		}
	}
}

function clearOtherMenus(aGroupIDs) {
	var bDontClear;
	var sMessage;
	for (var i = 0; i < aSelected.length; i++) {
		bDontClear = false;
		
		for (var j = 0; j < aGroupIDs.length; j++) { if (aGroupIDs[j] == i) bDontClear = true;	}
		
		if (bDontClear == false && aSelected[i] == true) {
			hideGroup(i);
			//unhighlightMainMenu(i);
		}
	}
}

function setClearTime() {
	if (oGroupTimer) clearTimeout(oGroupTimer);
	oGroupTimer = null;
	oGroupTimer = setTimeout("clearMenus()",600);
}

function cancelClearTime() {
	if (oGroupTimer) clearTimeout(oGroupTimer);
	oGroupTimer = null;
}

function go(sURL, iMenuID) {
	if (sURL.indexOf("?") > 0) document.location.href = sURL;
	else document.location.href = sURL + '?mid=' + iMenuID;
}