// JavaScript Document

var animation = false;
var menus = new Array();
menus['sp_menu'] = 'close';
menus['lp_menu'] = 'close';
menus['bu_menu'] = 'close';
menus['hs_menu'] = 'close';
menus['st_menu'] = 'close';
menus['pr_menu'] = 'close';
menus['bv_menu'] = 'close';

tt_setOpacity('sp_menu', 0);
tt_setOpacity('lp_menu', 0);
tt_setOpacity('bu_menu', 0);
tt_setOpacity('hs_menu', 0);
tt_setOpacity('st_menu', 0);
tt_setOpacity('pr_menu', 0);
tt_setOpacity('bv_menu', 0);

function openMenu(id, commander)
{
	if(!(commander == 'menu' && menus[id] == 'close_ne'))
	{
		menus[id] = 'open';
		if(! animation)
			animate();
	}
}

function closeMenu(id)
{
	if(menus[id] != 'close_ne')
	{
		menus[id] = 'close';	
		if(! animation)
			animate();
	}
}

function closeMenus()
{
	for (i in menus)
	{
		menus[i] = 'close_ne' 
	}
    if(! animation)
    	animate();	
}

function animate()
{
	animation = true;
		
	for(id in menus)
	{
		state = menus[id];

		if(state == 'open')
		{
			document.getElementById(id).style.display = 'block';
			
			if(tt_getOpacity(id) <= 100)
				tt_setOpacity(id, tt_getOpacity(id) + 10);	
		}
		if(state == 'close' || state == 'close_ne' ) 
		{
			if(tt_getOpacity(id) > 0)
				tt_setOpacity(id, tt_getOpacity(id) - 10);	
			else
			{
				try
				{
					document.getElementById(id).style.display = 'none';				
				}
				catch(ex){}
			}
		}
	}
	
	setTimeout('animate()',10);
}

//Set transparancy property (in Int) for an element
function tt_setOpacity(id, opacity)
{
	if(opacReady())
	{
		var e = document.getElementById(id);
	
		if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5))
			e.style.MozOpacity=opacity/100;
		else if ((navigator.appName.indexOf("Microsoft")!= -1) && (parseInt(navigator.appVersion)>=4))
			e.filters.alpha.opacity=opacity;
	}

}

function tt_getOpacity(id)
{
	if(opacReady())
	{
		
		if(e = document.getElementById(id))
		{
			if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5))
				return e.style.MozOpacity * 100;
			else if ((navigator.appName.indexOf("Microsoft")!= -1) && (parseInt(navigator.appVersion)>=4))
				return e.filters.alpha.opacity;
			else
				return -1;
		}
	}
}

function opacReady()
{
	
	
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
	 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 if (ieversion>=7)
	 	return true;
	 else
	  	return false;
	}
	else if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
		return true;
	else
		return false;
}


