hoverClass = 'selected';
currentClass = '';
window.onload = initMenus;

function initMenus()
{
	initMenu('menu');
	initMenu('submenu');
	resize();
}

function initMenu(menuId)
{
	var menu,listPoint,listPoints,currentClass,hoverClass;
	try
	{
		menu = document.getElementById(menuId);
		listPoints = menu.getElementsByTagName('li');
				
		for (var i=0;i<listPoints.length;i++)
		{
			listPoints[i].onmouseover = aMouseOver;
			
			listPoints[i].childNodes[1].style.width = 180-listPoints[i].childNodes[0].clientWidth + 'px';
			if (checkIt('MSIE 6')) listPoints[i].childNodes[1].style.marginLeft = listPoints[i].childNodes[0].clientWidth - 10 + 'px';
			else listPoints[i].childNodes[1].style.marginLeft = listPoints[i].childNodes[0].clientWidth + 'px';
			
			listPoints[i].onmouseout = aMouseout;
		}
	}	
	catch (e) {
		
	}
}

function aMouseOver() 
{
	currentClass = this.className;
	if (currentClass == 'undefined') currentClass = '';
	if (currentClass.indexOf('selected') == -1) {
		this.className = currentClass + ' selected';
	}
}

function aMouseout() 
{
	this.className = currentClass;
};

	function checkIt(string)
	{
		var detect = navigator.userAgent.toLowerCase();
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
	
function resize()
{
    try
    {
        var left,content,submenu;    
        left = document.getElementById("submenu");
        content = document.getElementById("content");    
        
        if (content.offsetHeight < left.offsetHeight) {       
        content.style.height = left.offsetHeight + "px";
        }
        
        else if (content.offsetHeight > left.offsetHeight){
            left.style.height = content.offsetHeight - 25 + "px";           
        }
    }
    catch(e)
    {
    }
}
