//variable that says which timeout is going to fire
var timeoutId = new Array();

function showEasyMenu(item) {
	setTimeout('showEasyMenuHelper(\''+item.id+'\')', 1);
	if(timeoutId[item.id]) {
		clearTimeout(timeoutId[item.id]);
		timeoutId[item.id] = false;
	}
}

function hideMenu(item) {
	timeoutId[item.id] = setTimeout('hideMenuHelper(\''+item.id+'\')', 1);
}

function showEasyMenuHelper(itemId) {
	var item = $(itemId);
	
	//fall back just in case we might recreate the menu if its already showing
	if(item.childNodes[1].style.display == 'block')
		return;

	var i = item.childNodes[1];
	
	i.style.display = "block";
	i.style.zIndex = "1000";

	//IE HACK so the menus get a strong backing behind them to push them forward
	//iframe's causes refreshing in IE7 and the strong backing works with divs
	if(navigator.appVersion.match("MSIE")) {
		if(navigator.appVersion.match("MSIE 6.0"))
			var shim = document.createElement('iframe');
		else 
			var shim = document.createElement('div');
		shim.setAttribute('name','easymenu_shim');
		shim.setAttribute('height',i.offsetHeight);
		shim.setAttribute('width',i.offsetWidth);
		shim.setAttribute('position','absolute');
		shim.setAttribute('z-index',1000);
		shim.setAttribute('src','about:blank');
		shim.setAttribute('frameborder','no');
		shim.setAttribute('scroll','no');
		shim.style.position="absolute";
		shim.style.left=i.offsetLeft;
		shim.style.top=i.offsetTop;
		item.appendChild(shim);
	}
}



function hideMenuHelper(itemId)
{
	var item = $(itemId);
	var cMenu = document.getElementById("EasyMenuContext");
	if(cMenu==null)
	{
		item.childNodes[1].style.display = "none";
		if(item.lastChild.tagName == 'IFRAME')
			item.removeChild(item.lastChild);	
	}
}



function showDrag(item)
{
	item.childNodes[0].style.display = "inline";

}

function hideDrag(item)
{
	item.childNodes[0].style.display = "none";

}

