st.menu = new function(oBase)
{
	this.oBase = oBase;
	this.loaded = false;
	this.iDelay = 500; // Menu delay, in milliseconds, was 500
	this.groups = new Object();
	this.add = function (sName,bCurrent)
	{
		this.groups[sName] = null;
		bCurrent = this.oBase.defvar(bCurrent,false);
		sCurrent = bCurrent?'c/':'';
		//this.oBase.img.add(sName,'nav.'+sName+sCurrent+'.out.gif','nav.'+sName+sCurrent+'.over.gif');
		this.oBase.img.add(sName,'nav-new/'+sCurrent+'out/'+sName+'.png','nav-new/'+sCurrent+'over/'+sName+'.png');
	}
	this.cleardelay = function(sName)
	{
		window.clearTimeout(this.groups[sName].iTimerID);
		this.groups[sName].iTimerID = 0;
	}
	this.callalldelayed = function()
	{
		for(sName in this.groups) if(this.groups[sName] && 0 != this.groups[sName].iTimerID) this.calldelayed(sName);
	}
	this.calldelayed = function(sName)
	{
		this.cleardelay(sName);
		this.delayedhide(sName);
	}
	this.hide = function(sName)
	{
		if(!this.loaded) return;
		this.groups[sName].iTimerID = window.setTimeout("st.menu.delayedhide('"+sName+"');",this.iDelay);
	}
	this.hideall = function()
	{
		for(sName in this.groups) this.realhide(sName);
	}
	this.delayedhide = function(sName)
	{
		this.realhide(sName);
		this.groups[sName].iTimerID = 0;
	}
	this.realhide = function(sName)
	{
		this.groups[sName].hide();
		this.oBase.img.out(sName);
	}
	this.show = function(sName)
	{
		if(!this.loaded) return;
		for(sOtherName in this.groups) if(sOtherName != sName && 0 != this.groups[sOtherName].iTimerID) this.calldelayed(sOtherName);
		if(0 != this.groups[sName].iTimerID) this.cleardelay(sName);
		else this.realshow(sName);
	}
	this.realshow = function(sName)
	{
		this.oBase.img.over(sName);
		this.groups[sName].show();
	}
	this.onload = function(sBrowserID)
	{
		switch(sBrowserID)
		{
			case 'IE5up':
			case 'Opera':
				for(sName in this.groups)
				{
					this.groups[sName] = window.document.getElementById('fm'+sName);
					this.groups[sName].sName = sName;
					this.groups[sName].bVisible = false;
					this.groups[sName].iTimerID = 0;
					this.groups[sName].show = function(){this.style.visibility = 'visible';}
					this.groups[sName].hide = function(){this.style.visibility = 'hidden';}
					this.groups[sName].onmouseout = function(){if(!this.contains(window.event.toElement)) st.menu.hide(this.sName);}
					this.groups[sName].onmouseover = function(){if(!this.contains(window.event.fromElement)) st.menu.show(this.sName);}
				}
				break;
			case 'Gecko':
				for(sName in this.groups)
				{
					this.groups[sName] = window.document.getElementById('fm'+sName);
					this.groups[sName].sName = sName;
					this.groups[sName].bVisible = false;
					this.groups[sName].iTimerID = 0;
					this.groups[sName].contains = function(oCheck)
					{
						while(oCheck != null)
						{
							if(oCheck == this) return true;
							oCheck = oCheck.parentNode;
						}
						return false;
					}
					this.groups[sName].show = function(){this.style.visibility = 'visible';}
					this.groups[sName].hide = function(){this.style.visibility = 'hidden';}
					this.groups[sName].onmouseout = function(event){if(!this.contains(event.relatedTarget)) st.menu.hide(this.sName);}
					this.groups[sName].onmouseover = function(event){if(!this.contains(event.relatedTarget)) st.menu.show(this.sName);}
				}
				break;
			case 'Safari':
			case 'Konqueror':
			default:
				for(sName in this.groups)
				{
					alert(sName);
					this.groups[sName] = window.document.getElementById('fm'+sName);
					this.groups[sName].sName = sName;
					this.groups[sName].bVisible = false;
					this.groups[sName].iTimerID = 0;
					this.groups[sName].show = function(){this.style.visibility = 'visible';}
					this.groups[sName].hide = function(){this.style.visibility = 'hidden';}
					this.groups[sName].contains = function(oCheck)
					{
						while(oCheck != null)
						{
							if(oCheck == this) return true;
							oCheck = oCheck.parentNode;
						}
						return false;
					}
					this.groups[sName].onmouseout = function(){if(!this.contains(event.toElement)) st.menu.hide(this.sName);}
					this.groups[sName].onmouseover = function(){if(!this.contains(event.fromElement)) st.menu.show(this.sName);}
				}
		}
		this.loaded = true;
	}

	return this;
}(st);

window.document.onclick = function(){st.menu.callalldelayed();/* st.menu.hideall();*/}

