/* dhtml menus */
	
	var defaultMenuWidth="130px" 
	
		document.write('<div id="popitmenu"><iframe id="popitframe" name="popitframe" width="'+defaultMenuWidth+'" height="250" frameborder="0" src="about:blank" marginheight="0" marginwidth="0" scrolling="no" style="filter: alpha(opacity=0);"></iframe></div>')
		document.write('<div id="submenu" onMouseover="javascript: clearhidemenu();" onMouseout="javascript: dynamichide(event);"></div>')


function showmenu(parentobj, e, which, optWidth){
	if (!document.all&&!document.getElementById)
		return
	
	if (which==null)
		return
		
	clearhidemenu()

	menuobj=document.getElementById("popitmenu");
	document.getElementById("submenu").innerHTML=which;

	menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
	document.getElementById("submenu").style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth

	menuobj.contentwidth=menuobj.offsetWidth
	document.getElementById("submenu").contentwidth=document.getElementById("submenu").offsetWidth

	menuobj.contentheight=menuobj.offsetHeight
	document.getElementById("submenu").contentheight=document.getElementById("submenu").offsetHeight

	eventX=e.clientX
	eventY=e.clientY
	var newX = findPosX(parentobj);
	var newY = findPosY(parentobj);

	menuobj.style.top = newY + 22 + 'px';
	document.getElementById("submenu").style.top = newY + 22 + 'px';

	menuobj.style.left = newX + 'px';
	document.getElementById("submenu").style.left = newX + 'px';

	menuobj.style.visibility="visible"
	document.getElementById("submenu").style.visibility="visible"
	
	document.getElementById("popitframe").height=document.getElementById("submenu").offsetHeight; //resize frame
	
	return false
}


function hidemenu(){
	if (window.menuobj)
		menuobj.style.visibility="hidden"
	if (window.document.getElementById("submenu"))
		document.getElementById("submenu").style.visibility="hidden"
}

function dynamichide(e){
	delayhidemenu()
}

function delayhidemenu(){
	delayhide=setTimeout("hidemenu()",400)
}

function clearhidemenu(){
	if (window.delayhide)
		clearTimeout(delayhide)
}

document.onclick=hidemenu

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	var printstring = '';
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}