// Set up page to do multiple loads //
function addLoadEvent(func) {

	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} 
	else 
	{
		window.onload = function() {
		  if (oldonload) {
			oldonload();
		  }
		  func();
		}
	}
	
}

function openList(){
   var d = document.getElementById("staff_view");
   var d2 = document.getElementById("staff_list");
	
   d.innerHTML = (d.innerHTML == 'View Editorial List <img src="/images/icon_arrowdown.gif">') ? 'Hide Editorial List <img src="/images/icon_arrowup.gif">' : 'View Editorial List <img src="/images/icon_arrowdown.gif">';
   d2.style.display = (d2.style.display == "none") ? "" : "none";
}

function styleNav(){
	var ul = document.getElementById("kidsnav").getElementsByTagName('ul')[0];
	var li = ul.getElementsByTagName('li');
	for (i=0; i < li.length; i++)  {
		switch(i){
			case 0:li[i].className="Red"; break;
			case 1:li[i].className="Orange"; break;
			case 2:li[i].className="Yellow"; break;
			case 3:li[i].className="Green"; break;
			case 4:li[i].className="Blue"; break;
			case 5:li[i].className="Indigo"; break;
			case 6:li[i].className="Brown"; break;
			default:; break;
		}
	}
	//document.getElementById("kidsnav").getElementsByTagName('li')[0].getElementsByTagName('a')[0].innerHTML ="<img src=\"/images/kidsbakka.gif\" alt=\"kidsBakka\"/>";
}

function initNav(){
    var n = document.getElementById("nav");
	for (i=0; i < n.childNodes.length; i++)  {
		node = n.childNodes[i];
		if (node.nodeName == "LI") {
			node.onmouseover = function() {
				this.className = "over";
			}
			node.onmouseout = function() {
				this.className = this.className.replace("over", "");
			}
		}
	}
    var n2 = document.getElementById("kidsnav");
	for (i=0; i < n2.childNodes.length; i++)  {
		node = n2.childNodes[i];
		if (node.nodeName == "LI") {
			node.onmouseover = function() {
				this.className = "over";
			}
			node.onmouseout = function() {
				this.className = this.className.replace("over", "");
			}
		}
	}
	styleNav();
}

function openBox(id)
{
   var d=document.getElementById(id);
   d.style.display = (d.style.display == 'none') ? "" : "none";
}

// LOAD EVENTS //
addLoadEvent(function() 
	{ 
	    if (document.getElementById("nav"))
		{
			initNav();
		}
	}
); 