// JavaScript Document


// check for current news items. If there isn't anything new then don display the "What's new" column
function CheckNews() {
	var items = document.getElementsByClassName("news-latest-item");
	var news = Sat_GetObj("News");
	if (news!=undefined) {
		if (items==undefined || items.length==0) {
			news.style.display="none";
		} else {
			news.style.display="";
		}
	}
}

function InitNav(){

	if (typeof(OnCellID) == 'undefined' || Sat_GetObj(OnCellID) == false){return}

	BgColor = '#F87035';

	RightCell = getRightCell(OnCellID);

	

	Sat_GetObj(OnCellID).style.backgroundColor = BgColor;

	Sat_GetObj(OnCellID).style.backgroundImage = 'none'

	

	if(RightCell){ 

		RightCell.style.backgroundImage  = 'none';

	}

}

function getRightCell(CellID){

	rightCell = 'Nav' + (parseInt(CellID.substring(3)) + 1)

	return Sat_GetObj(rightCell)

}



function Sat_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) {

	if (!window.OnCellID){OnCellID = ""}

	if (OnCellID == Cell.id) {return;} //don't touch the current on cell

	

	RightCell = getRightCell(Cell.id);

	

	ColorOn = '#E15C22';

	ColorOff = 'transparent';

	ImgOn = 'none';

	ImgOff = 'url(fileadmin/templates/images/topnav_divider.gif)';

	

	BgImg = eval('Img' + direction);

	BgColor = eval('Color' + direction);



	if (document.all || document.getElementById){

		Cell.style.backgroundColor = BgColor;

		

		if (Cell.id != 'Nav1' && Cell != getRightCell(OnCellID)){Cell.style.backgroundImage = BgImg;}

		if(RightCell && RightCell.id != OnCellID) {

			RightCell.style.backgroundImage   = BgImg;

		}

		

	}

}


