// Drop Down Menu JavaScript Document

//rewrite content and reposition margin-left value

var subMenu;
var childMenu;
var timer;
//var secs;


// HANDLES SUBMENUS
function ME_Over(pTYPE, pXPOS, pYPOS)
{
	//alert("ME_Over");
	// first hide all
	hideAllMenus();
	// detemine what menu we are supposed to display
	switch(pTYPE)
	{
		case 'archive':
			positionMenu(subMenu,pXPOS,pYPOS);
			subMenu.innerHTML = ''
				+ '<a href="index.php?page_id=410" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Celebrity &amp; Icons</a>'
				+ '<a href="index.php?page_id=357" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Film &amp; Hollywood</a>'
				+ '<a href="index.php?page_id=412" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Madison Avenue</a>'
				+ '<a href="index.php?page_id=356" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Music</a>'
				+ '<a href="index.php?page_id=413" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Politics</a>'
				+ '<a href="index.php?page_id=409" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Print &amp; Publishing</a>'
				+ '<a href="index.php?page_id=359" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Sports</a>'
				+ '<a href="index.php?page_id=415" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Technology</a>'
				+ '<a href="index.php?page_id=414" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Media</a>'
				+ '<a href="index.php?page_id=416" onmouseover="ME_SubOver();" onmouseout="ME_Out();">T.V.</a>'
				+ '<a href="index.php?page_id=417" onmouseover="ME_SubOver();" onmouseout="ME_Out();">Video</a>'
				;
			showMenu(subMenu);
		break;
		
		default:
			// if the menu has no children then hide any that are displayed
			//hideChildMenus();
		break;
	}
	resetTimer();
}

// HANDLES CHILD MENUS
function ME_SubOver(pTYPE, pXPOS, pYPOS)
{
	resetTimer();
	// detemine what menu we are supposed to display
	/*switch(pTYPE)
	{
		case 'child_menu':
			positionMenu(childMenu,pXPOS,pYPOS);
			//childMenu.innerHTML = ''
			//showMenu(childMenu);
		break;

		default:
			// if the menu has no children then hide any that are currently displayed
			//hideChildMenus();
		break;
	}*/
}

function ME_Out()
{
	//alert('ME_Out');
	timer = self.setTimeout('hideAllMenus()', 1000);
}

function showMenu(pID)
{
	// reset the timer
	resetTimer();
	pID.style.visibility = 'visible';
}

function hideAllMenus()
{
	// check the menus visible property and set accordingly
	//alert('hide');
	subMenu.style.visibility = 'hidden';
	//if(childMenu.style.visibility == 'visible') childMenu.style.visibility = 'hidden';
}
/*
function hideChildMenus()
{
	if(childMenu.style.visibility == 'visible') childMenu.style.visibility = 'hidden';
	resetTimer();
}
*/
function resetTimer()
{
	// clear timer
	window.clearTimeout(timer);
	timer=0;
}

function positionMenu(pID, pXPOS, pYPOS)
{
	pID.style.marginLeft = pXPOS+"px";
	pID.style.marginTop = pYPOS+"px";
}

// Sets up the initialization parameters of the menu system
function Init_Menu()
{
	//alert("init");
	// the amount of seconds to wait til the menus are hidden
	//secs = pSECS;
	// clear the timer
	resetTimer();
	// assign 
	subMenu = document.getElementById('subNav');
	//childMenu = document.getElementById('childNav');
	// clear any data
	subMenu.innerHTML = '';
	//childMenu.innerHTML = '';
	// hide the sub menu layers
	hideAllMenus();
}