// JavaScript Document


function InitNav(Color){
	if (typeof(OnCellID) == 'undefined' || Rev_GetObj(OnCellID) == false){return}
	
	BgColor = Color;
	RightCell = getRightCell(OnCellID);
	TheCell = Rev_GetObj(OnCellID);
	if (!TheCell.childNodes){return}
	
	TheCell.style.backgroundColor = BgColor;
	TheCell.style.backgroundImage = 'none'
	TheCell.style.color  = '#ffffff';
	
		for (i=0;i<TheCell.childNodes.length;i++){
			if (TheCell.childNodes[i].tagName == "A") {
				TheCell.childNodes[i].style.color = '#ffffff';
			}
		}
	
	if(RightCell){ 
		RightCell.style.backgroundImage  = 'none';
	}
}


function getRightCell(CellID){
	rightCell = 'Nav' + (parseInt(CellID.substring(3)) + 1)
	return Rev_GetObj(rightCell)
}

function Rev_GetObj(ID) {
/*abstraction layer to deal with the IE vs NN object model */

	if (typeof(ID) != 'undefined' && ID.length != 0){
		if (document.all){	
			if (typeof(eval('document.all.' + ID)) != 'undefined' ){
				return eval('document.all.' + ID)
			}
		}
		else if (document.getElementById){
			if (typeof(document.getElementById(ID))!= 'undefined' && document.getElementById(ID) != null){
				return document.getElementById(ID)
			}
		}
	}
	return false
}


function ToggleNav(Cell, direction, color) {
	if (!window.OnCellID){OnCellID = ""}
	if (OnCellID == Cell.id) {return;} //don't touch the current on cell
	
	RightCell = getRightCell(Cell.id);

	ColorOn = color;
	ColorOff = 'transparent';
	fontColorOn = '#FFFFFF';
	fontColorOff = '#333333';
	ImgOn = 'none';
	ImgOff = 'url(/images/global/nav_divider.gif)';
	
	BgImg = eval('Img' + direction);
	BgColor = eval('Color' + direction);
	fontColor = eval('fontColor' + direction);

	if (document.all || document.getElementById){
		Cell.style.backgroundColor = BgColor;
		if (Cell.childNodes) {
			for (i=0;i<Cell.childNodes.length;i++){
				if (Cell.childNodes[i].tagName == "A") {
					Cell.childNodes[i].style.color = fontColor;
				}
			}
		}

		if (Cell.id != 'Nav1' && Cell != getRightCell(OnCellID)){Cell.style.backgroundImage = BgImg;}
		if(RightCell && RightCell.id != OnCellID) {
			RightCell.style.backgroundImage   = BgImg;
		}
	}
}

