var menuParent = null;

function openPopup(index, parent) {
	var p = document.getElementById("PopupElement");
	var c = document.getElementById("PopupChild");
	var d = document.getElementById("DocumentElement");

	retainPopup();

	if (p.style.visibility == "visible" && p.activeIndex == index)
		return;

	p.style.visibility = "hidden";
	p.style.top = 119;
	p.style.left = 2+d.offsetLeft+parent.offsetLeft;
	p.activeIndex = index;

	if (menuParent)
		menuParent.className='MENUITEM_TOP';

	parent.className='MENUITEM_TOP_HOVER';
	menuParent = parent;
	
	if (index < popupObj.length) {
		var popupContent = "<TABLE cellSpacing=0 cellPadding=0 border=0 width=\"100%\">";
		
		for(var i = 0;i < popupObj[index].length;i ++)
			popupContent += "<TR><TD vAlign=\"TOP\" width=\"100%\"><TABLE cellSpacing=0 cellPadding=0 border=0 width=\"100%\"><TR><TD class=\"POPUP_ITEM\" onMouseOver=\"this.className='POPUP_ITEM_HOVER';\" onMouseOut=\"this.className='POPUP_ITEM';\" onClick=\"window.location='"+unescape(popupObj[index][i][1])+"';\"><A hRef=\""+unescape(popupObj[index][i][1])+"\" class=\"POPUP\"><NOBR>"+unescape(popupObj[index][i][0])+"</A></TD></TR>";
		popupContent += "</TABLE>";
	
		if (isIE) {
			p.filters[0].apply();
			p.filters[0].motion = "forward";
		}
		
		c.innerHTML = popupContent;
		p.style.visibility = "visible";
		
		if (isIE)
			p.filters[0].play();
	}
}

function closePopup() {
	PopupElement.timeout = window.setTimeout("if(menuParent&&typeof(menuParent.isSelected)!='string'){menuParent.className='MENUITEM_TOP';menuParent=null;}if(isIE){PopupElement.filters[0].apply();PopupElement.filters[0].motion='reverse';}PopupElement.style.visibility='hidden';if(isIE)PopupElement.filters[0].play();", 600);
}

function retainPopup() {
	if (PopupElement.timeout)
		window.clearTimeout(PopupElement.timeout);
}