function addLeftNavBehavior(context)
{

	for(var i=0; i < context.childNodes.length; i++)
	{
		var n = context.childNodes[i];

		if(n.nodeName == "LI")
		{
			var mainNav = new mainMenu(n);
		}
	}
}

function subMainMenu(context)
{
	this.context=context;
	var me = this;
	var AL = new AddListener(this.context, "mouseover", function()
	{	
		me.context.className = "hover";			
	});

	var AL = new AddListener(this.context, "mouseout", function()
	{	
		me.context.className = "none";			
	});
}

function mainMenu(context)
{
	this.context = context;

	var me = this;
	var AL = new AddListener(this.context, "mouseover", function()
	{	
		for(var i=0; i < me.context.childNodes.length; i++)
		{
			var n=me.context.childNodes[i];
			if(n.nodeName == "UL")
			{
				n.className = "show";
			}
			else if(n.nodeName == "A")
			{
				for(var x=0; x < n.childNodes.length; x++)
				{

					var n2 = n.childNodes[x];
					if(n2.nodeName == "IMG")
					{
						n2.src = "images/" + me.context.id + "_hover.gif";
					}
				}
			}	
		}		 
				
	});

	var AL = new AddListener(this.context, "mouseout", function()
	{

		for(var i=0; i < me.context.childNodes.length; i++)
		{
			var n=me.context.childNodes[i];
			if(n.nodeName == "UL")
			{
				n.className = "hide";
			}
			else if(n.nodeName == "A")
			{
				for(var x=0; x < n.childNodes.length; x++)
				{

					var n2 = n.childNodes[x];
					if(n2.nodeName == "IMG")
					{
						n2.src = "images/" + me.context.id + ".gif";
					}
				}
			}
		}			 
				
	});

	for(var x=0; x< this.context.childNodes.length; x++)
	{
		var n = this.context.childNodes[x];
		if(n.nodeName == "UL")
		{
			for(var i=0; i< n.childNodes.length; i++)
			{
				var n2 = n.childNodes[i];
				if(n2.nodeName == "LI")
				{
					var subMenu = new subMainMenu(n2);

				}
			}
		}

	}

}



var AL = new AddListener(window, "load", function()
{ 
	addLeftNavBehavior(document.getElementById("leftNav"));
});
