function initPage()
{	
	initNav();	
	initInputs()	;	
}

function initNav()
{
	var nav = document.getElementById("nav");	
	if (nav)
	{
		var nodes = nav.getElementsByTagName("li");
		var activeNode = -1;
		for (var i = 0; i < nodes.length; i++)
		{			
			if (nodes[i].className == "active" && nodes[i].id)
			{
				activeNode = i;
			}
		}
		
			
		for (var i = 0; i < nodes.length; i++)
		{
			if (nodes[i].parentNode.id == "nav")
			{
				if (activeNode> -1 && activeNode != i && nodes[i].id)
				{
					nodes[i].onmouseover = function () 
					{						
						if (this.className.indexOf("hover") == -1)
						{
							this.className = " hover";
							nodes[activeNode].className = "";
						}
					}
					nodes[i].onmouseout = function ()
					{						
						this.className = this.className.replace("hover", "");						
						nodes[activeNode].className = "active";
					}
				}
				else
				{
					nodes[i].onmouseover = function () 
					{
						if (this.className.indexOf("hover") == -1)
						{
							this.className += " hover";							
						}
					}
					nodes[i].onmouseout = function ()
					{						
						this.className = this.className.replace("hover", "");
					}					
				}
			}
		}
	}	
}

function initInputs()
{
	var login = document.getElementById("login");	
	var login_changed = false;
	
	var login_event = function ()
	{		
		if (!login_changed){
			this.value = "";
			login_changed = true;			
		}
	};
	
	if (login)
	{
		login.onclick = login_event;
		login.onkeydown = login_event;
	}
	
	var pass = document.getElementById("password");	
	var pass_changed = false;
	
	var pass_focus = function()
	{
		document.getElementById("password").focus();
	}
	
	var pass_event = function ()
	{		
		if (!pass_changed){
						
			pass_changed = true;			
			if (!isIE())
			{				
				pass.type = "password";
				pass.focus();
			}
			else
			{
				var np=pass.cloneNode(true);
				np.type = 'password';			
				pass.parentNode.replaceChild(np,pass);
				setTimeout(pass_focus, 0);			
			}
			document.getElementById("password").value = "";
		}
	};
	
	if (pass)
	{
		pass.onclick = pass_event;
		pass.onkeydown = pass_event;
	}
	
}

/*if (window.attachEvent && !window.opera)
	window.attachEvent("onload", initPage);*/
if (window.addEventListener){
 window.addEventListener("load", initPage, false);
}
else if (window.attachEvent){
 window.attachEvent("onload", initPage);
}
	
function initLeader()
{
	var nav = document.getElementById("leadership-photos");
	if (nav)
	{
		var nodes = nav.getElementsByTagName("li");			
		var activeNode = -1;
		for (var i = 0; i < nodes.length; i++)
		{			
			if (nodes[i].className == "active")
			{
				activeNode = i;
			}
		}	
	
		
		for (var i = 0; i < nodes.length; i++)
		{		

			if (nodes[i].parentNode.id == "leadership-photos")
			{
				if (activeNode> -1 && activeNode != i)
				{
					nodes[i].onmouseover = function () 
					{						
						if (this.className.indexOf("hover") == -1)
						{
							this.className = " hover";
							nodes[activeNode].className = "";
						}
					}
					nodes[i].onmouseout = function ()
					{						
						this.className = this.className.replace("hover", "");						
						nodes[activeNode].className = "active";
					}
				}
				else
				{
					nodes[i].onmouseover = function () 
					{
						if (this.className.indexOf("hover") == -1)
						{
							this.className += " hover";							
						}
					}
					nodes[i].onmouseout = function ()
					{						
						this.className = this.className.replace("hover", "");
					}					
				}
			}
		}
	}
}

/*if (window.attachEvent && !window.opera)
	window.attachEvent("onload", initLeader);
*/	

if (window.addEventListener){
 window.addEventListener("load", initLeader, false);
}
else if (window.attachEvent){
 window.attachEvent("onload", initLeader);
}

 function isIE() {
		return typeof(document.all) != "undefined" && typeof(window.opera) == "undefined";
}