function DynamMenu(inobj) {

	//	baseid = the base name of the drop down menu, this will be appended with 'whch' to determine display id
	//	def = the default identifying number to use, this will be display when no other submenus are needed
	var def = inobj.def;
	var bid = inobj.baseid;
	var typ = 'horizontal';
	var menudropdown_timeout;
	var menudropdown_current = 0;
	var envelopes = Array();

	this.mouseOver = function(e,who) {
		if(!(e == 'initial'))
		{
			e = e ? e : window.event;
			if(e.stopPropagation)
				e.stopPropagation();
			else
				e.cancelBubble = true;
			_clearTimeout(e);
		}
		if(menudropdown_current == who)
		{
			return;
		}
		else if(menudropdown_current > 0)
		{
			try{
				$('#' + bid + menudropdown_current).slideUp(5);
				menudropdown_current = 0;
			} catch(e){
			}
		}
		menudropdown_current = who;
		var found = false;
		try{
			for(var x = 0; x < envelopes.length; x++)
			{
				if(envelopes[x] == who)
				{
					found = true;
					break;
				}
			}
			if(!found)
			{
				var w = $('#' + bid + who).width();
				envelopes[envelopes.length] = who;
				var ofs = $('#menuitem' + who).position();
				var pw = $('#menuitem' + who).offsetParent().width();
				var dw = (ofs.left + w > pw) ? ofs.left + (pw - (ofs.left + w)) : ofs.left;
				var dh = ofs.top + 16;
				$('#' + bid + who).css({'top':dh,'left':dw});
			}
			//var h = $('#' + bid + who).height();
			$('#' + bid + who).css({'display':'none','visibility':'visible'});
			$('#' + bid + who).slideDown(5);
		} catch(e) {
			//alert(e.Message);
		}
	}

	this.mouseOut = function(e,whch,who){
		if(who == def)
			return;
		e = e ? e : window.event;
		if(e.stopPropagation)
			e.stopPropagation();
		else
			e.cancelBubble = true;
		var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
		while(reltg.tagName != 'BODY')
		{
			if (reltg == whch)
			{
				return;
			}
			reltg = reltg.parentNode;
		}
		// temporary fix
		menudropdown_timeout = setTimeout(function(){try{$('#' + bid + who).slideUp(5);$('#' + bid + def).slideDown(5);menudropdown_current=def;}catch(e){}},300);
	}
	function _clearTimeout(e)
	{
		e = e ? e : window.event;
		if(e.stopPropagation)
			e.stopPropagation();
		else
			e.cancelBubble = true;
		clearTimeout(menudropdown_timeout);
	}		
	this.clearTimeout = _clearTimeout
}
