// Geek Web Design Javascript Timed Actions for vertical slide-out menus
// Copyright 2006, Stephen Terhune (steve@geekwebdesign.com)

	function MenuActionArgs(startAt, stopAt, move)
	{
		this.thispos = startAt;
		this.endpos = stopAt;
		this.vector = move;
	}
	
	function MenuActionMethod()
	{
		if ((this.Args.thispos >= this.Args.endpos && this.Args.vector > 0) ||
		    (this.Args.thispos <= this.Args.endpos && this.Args.vector < 0))
		{
		    this.Args.thispos = this.Args.endpos;
		    this.Stopped = true;
				if (this.Args.vector < 0)
					this.ObjPointer.style.display = "none";
		}
		else
		{
			if (this.ObjPointer.type == "ul" && document.all)
			{
				this.ObjPointer.style.display = "list-item";
			}
			else
			{
				this.ObjPointer.style.display = "block";
			}
		}
		this.ObjPointer.style.height = this.Args.thispos + "px";
		this.Args.thispos += this.Args.vector;
	}
	
	var am = new ActionManager();
	
	function GrowMenu(menuElement, targetHeight)
	{
		var objElement = document.getElementById(menuElement);
		var startHeight = 10;
		if (objElement.style.pixelHeight)
			startHeight = objElement.style.pixelHeight;
		if (objElement.style.display == "none")
			am.StartAction(am.AddAction(objElement, MenuActionMethod, 10, new MenuActionArgs(startHeight, targetHeight, 8)).ID, true);
	}
	
	function ShrinkMenu(menuElement)
	{
		var objElement = document.getElementById(menuElement);
		var startHeight = 50;
		if (objElement.style.pixelHeight)
			startHeight = objElement.style.pixelHeight;
		if (objElement.style.display == "block")
		{
			var goahead = true;
			for (var i = 0; i < am.ActionList.length; i++)
			{
				if (am.ActionList[i] && am.ActionList[i].ObjPointer == objElement &&
					am.ActionList[i].Args.vector < 0 && am.ActionList[i].Stopped == false)
				{
					goahead = false;
					break;
				}
			}
			if (goahead == true)
				am.StartAction(am.AddAction(objElement, MenuActionMethod, 10, new MenuActionArgs(startHeight, 10, -8)).ID, false);
		}
	}

