/*
@author	Richter, Aaron M
@filename	bigfresh_menu_div.js
@date	04NOV2009
*/

var timeoutID;

// set previous menu div visibility to hidden
// remove previous menu item styling
function hidePreviousDivs()
{
	clearTimeout(timeoutID);
	var menus=new Array('home','conferences','pubs','education','member','industry','careercenter','newsroom');
	for (menuitem in menus)
	{
		var id=menus[menuitem];
		if (document.layers) 
		{
			document.layers[id].visibility = "hide";
		}
		else if (document.getElementById) 
		{
			document.getElementById(id).style.visibility = "hidden";
			if(document.getElementById('li_'+id).className==id+'selected')
				document.getElementById('a_'+id).className = "navsel";
			else
				document.getElementById('a_'+id).className = "";
		}
	}
}

/**/
function toggleDiv(id,flagit)
{
	timeoutID=setTimeout("_toggleDiv('"+id+"','"+flagit+"')", 100);
}

// set current menu div to visible
function _toggleDiv(id,flagit) 
{
	if (flagit=="1") 
	{
		hidePreviousDivs(); 
		document.getElementById('a_'+id).className='navsel';
		// retrieve page contents via AJAX
		if(window.location.hostname.search(/design\./i)==-1)
			{
			ajaxpage("/prebuilt/menus/" + id + ".html", id);
			}
		else
			{
			ajaxpage("/xml/prebuilt/menus/" + id + ".html", id);
			}
		if (document.layers) 
		{
			document.layers[''+id+''].visibility = "show";
		}
		else if (document.getElementById) 
		{
			document.getElementById(''+id+'').style.visibility = "visible";
		}
	}
	else if (flagit=="0")
	{
		if (document.layers) 
		{
			document.layers[''+id+''].visibility = "hide";
		}
		else if (document.getElementById) 
		{
			document.getElementById(''+id+'').style.visibility = "hidden";
		} 
		document.getElementById('a_'+id).className='';
	}
	clearTimeout(timeoutID);
}

function MMDOnClick(url)
{
	NavOnClick(url,'Mega Drop-Down');
}


function NavOnClick(url,type)
{
	var dcsURL;
	if(url.search(/^http/i)==-1)
		{
		dcsURL='http://'+window.location.hostname+'/'+url;
		}
	else
		{
		dcsURL=url;
		}
	dcsMultiTrack('WT.es',dcsURL,'WT.dl','7','DCSext.navsec',type);
	window.location=dcsURL;
}