function show_menu(id)
{
	var x, y;
	
	if (document.getElementById('submenu_' + id).style.display == 'inline')
	{
		document.getElementById('submenu_' + id).style.display = 'none';
	}
	else
	{
		document.getElementById('submenu_money').style.display = 'none';
		document.getElementById('submenu_solutions').style.display = 'none';
		document.getElementById('submenu_lifestyle').style.display = 'none';
		document.getElementById('submenu_community').style.display = 'none';
		document.getElementById('submenu_education').style.display = 'none';
		
		if (window.innerWidth) //if browser supports window.innerWidth
		{
			var width = window.innerWidth;
			var height = window.innerHeight;
		}
		else if (document.all) //else if browser supports document.all (IE 4+)
		{
			var width = document.body.clientWidth;
			var height = document.body.clientHeight;
		}
		width = width - 20;
		height = height - 10;

		document.getElementById('screen_overlay').style.display = 'block';
		document.getElementById('screen_overlay').style.left = '0px';
		document.getElementById('screen_overlay').style.top = '0px';
		document.getElementById('screen_overlay').style.width = width + 'px';
		document.getElementById('screen_overlay').style.height = height + 'px';
		document.getElementById('overlay_link').style.width = width + 'px';
		document.getElementById('overlay_link').style.height = height + 'px';
		
		var is_ie6 = (
			window.external &&
			typeof window.XMLHttpRequest == "undefined"
		);

	    placement = findPos(document.getElementById('menu_'  + id));
	    if (id == 'lifestyle')
	    	x = placement[0] - 250;
	    else if (id == 'community')
	    	x = placement[0] - 450;
	    else if (id == 'education')
	    {
    		if (is_ie6)
	    		x = placement[0] - 112;
	    	else
	    		x = placement[0] - 112;
	    }
	    else
	    	x = placement[0];
	    y = placement[1] + 19;
	    
	    document.getElementById('submenu_' + id).style.left = x + "px";
	    document.getElementById('submenu_' + id).style.top = y + "px";
	    document.getElementById('submenu_' + id).style.display = 'inline'
	}
}

function hide_menus()
{
	document.getElementById('submenu_money').style.display = 'none';
	document.getElementById('submenu_solutions').style.display = 'none';
	document.getElementById('submenu_lifestyle').style.display = 'none';
	document.getElementById('submenu_community').style.display = 'none';
	document.getElementById('submenu_education').style.display = 'none';
	document.getElementById('screen_overlay').style.display = 'none';
}

/*
screen.getDocumentHeight = function() {
var body = screen.getBody();
var innerHeight =
(defined(self.innerHeight)&&!isNaN(self.innerHeight))?self.innerHeight:0;
if (!document.compatMode || document.compatMode=="CSS1Compat") {
var topMargin = parseInt(CSS.get(body,'marginTop'),10) || 0;
var bottomMargin = parseInt(CSS.get(body,'marginBottom'), 10) || 0;
return Math.max(body.offsetHeight + topMargin + bottomMargin,
document.documentElement.clientHeight,
document.documentElement.scrollHeight, screen.zero(self.innerHeight));
}
return Math.max(body.scrollHeight, body.clientHeight,
screen.zero(self.innerHeight));
};*/

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}