function addEvent(obj, evType, fn)
{
	if (typeof obj == "string")
	{
		if (null == (obj = $(obj) ) )
		{
			throw new Error("Cannot add event listener: HTML Element not found.");
		}
	}
	if (obj.attachEvent)
	{
		return obj.attachEvent(("on" + evType), fn);
	}
	else if (obj.addEventListener)
	{
		return obj.addEventListener(evType, fn, true);
	}
	else
	{
		throw new Error("Your browser doesn't support event listeners.");
	}
}	

function iniciar()
{   
	var items = [], allItems = document.getElementsByTagName("a");
	var itemAtual;
	
	var itemVideo = document.getElementById('esquerda').getElementsByTagName("a");
	itemVideo[0].className = 'off';
	
	for (var i = 0; i < allItems.length; i++)
	{
		//Item Atual
		if( allItems[i].className == 'on' )
			itemAtual = allItems[i];
						
		allItems[i].onclick = function()
		{    
			for (var item = this.parentNode.firstChild; item; item = item.nextSibling)
			{        
				item.className = 'off';            
			}
			
			this.className = 'on';
			itemAtual = this;
		}
		
		allItems[i].onmouseover = function()
		{    
			for (var item = this.parentNode.firstChild; item; item = item.nextSibling)
			{        
				item.className = 'off';            
			}
			
			this.className = 'on';                
		}
		
		allItems[i].onmouseout = function()
		{    
			for (var item = this.parentNode.firstChild; item; item = item.nextSibling)
			{        
				item.className = 'off';            
			}
			
			itemAtual.className = 'on';
			itemVideo[0].className = 'on';

		}

	} 
	itemVideo[0].className = 'on';
}

addEvent(window, "load", iniciar);
