/* "smb" eSilo Theme */

/* no loading website in frames */
if(top.location != self.location) 
	top.location = self.location

var MENU_PREFIX = "menu_";
var g_isOpera = window.navigator.userAgent.indexOf('Opera')!=-1;
var g_isIE = !g_isOpera && window.navigator.userAgent.indexOf('MSIE')!=-1;

function show_menu(menuId)
{
	var menu = document.getElementById(MENU_PREFIX + menuId);

	if(g_isOpera)
	{
		if(menu.style.visibility == 'visible')
			return false;

		menu.style.visibility = 'visible';
		toggle_menu_item(menuId, 1);
		return true;
	}

	if(menu.style.clip.indexOf('auto')!=-1)
		return false;

	menu.style.clip = 'rect(auto auto auto auto)';

	toggle_menu_item(menuId, 1);
	return true;
}

function hide_menu(evt, menuId)
{
	var menu = document.getElementById(MENU_PREFIX + menuId);

	if(window.event)
	{
		if((document.getElementById(menuId) == window.event.toElement) ||
		   (menu.contains(window.event.toElement)))
			return false;
	}
	else
	{
		var x = evt.clientX;
		var y = evt.clientY;
		var menuX = get_screen_left(menu);
		var menuY = get_screen_top(menu);
		if(x>menuX && x<menuX+menu.offsetWidth && y>menuY && y<menuY+menu.offsetHeight)
			return false;
	}

	if(g_isOpera)
		menu.style.visibility = 'hidden';
	else
		menu.style.clip = 'rect(0 0 0 0)';

	toggle_menu_item(menuId, 0);
	return true;
}


function toggle_menu_item(menuId, isHot)
{
	var elem = document.getElementById(menuId);

	if(elem == null)
		return;

	if(elem.className == 'lnav-expand')
	{
		elem.style.textDecoration = isHot ? 'underline' : '';
		document.getElementById('img_' + menuId).style.textDecoration =  elem.style.textDecoration;
		document.getElementById('name_' + menuId).style.textDecoration =  elem.style.textDecoration;
	}
	else
	{
		if(isHot)
		{
			bgcolor = "#d4e4f3";
			color = "#6a93ba";
		}
		else
		{
			bgcolor = '';
			color = '';
		}

		elem.style.color = color;
		elem.style.backgroundColor = bgcolor;

		e = document.getElementById('img_' + menuId);
		e.style.color = color;
		e.style.backgroundColor = bgcolor;

		e = document.getElementById('name_' + menuId);
		e.style.color = color;
		e.style.backgroundColor = bgcolor;
	}

	toggle_status(elem, isHot);
}

var g_protoHost = location.protocol + "//" + location.host;
function toggle_status(elem, isHot)
{
	winstatus = '';

	if(isHot)
	{
		val = elem.onclick.toString();
		if((iStart = val.indexOf('/')) != -1)
			if((iEnd = val.indexOf('\'', iStart)) != -1 || (iEnd = val.indexOf('"', iStart)) != -1)
				winstatus = g_protoHost + val.substring(iStart, iEnd);
	}

	window.status = winstatus;
}

function get_screen_top(elem)
{
	y = elem.offsetTop;
	tmp = elem.offsetParent;
	while(tmp != null)
	{
		y += tmp.offsetTop;
		tmp = tmp.offsetParent;
	}
	return y;
}

function get_screen_left(elem)
{
	x = elem.offsetLeft;
	tmp = elem.offsetParent;
	while(tmp != null)
	{
		x += tmp.offsetLeft;
		tmp = tmp.offsetParent;
	}
	return x;
}
