var ButtonState = 
{
	SetupButton : function(id)
	{
		var btn = $(id);
		if (btn != null)
		{
			var btn_height = parseInt(btn.getAttribute("but_height"),10);
			btn.style.height = "%spx".format(btn_height*2);
			btn.parentNode.style.height = "%spx".format(btn_height);
		
			//log("XXXXXXXXXXX btn.style.height = %s".format(btn.style.height));
	
			btn.onmouseover = function()
			{
				var mode = this.getAttribute("but_mode");
				if (mode == null || mode == "on")
				{
					this.style.top = "-%spx".format(btn_height);
				}
			}
	
			btn.onmouseout = function()
			{
				var mode = this.getAttribute("but_mode");
				if (mode == null || mode == "on")
				{
					this.style.top = "0px";
				}
			}
		}
	},

	RegisterButtons : function(obj)
	{
		if (obj==null) obj = document.body;
		var children = obj.childNodes;
		for (var x=0; x < children.length; x++)
		{
			var child = children[x];
			if (child.nodeType==1)
			{
				var but_height = child.getAttribute("but_height");
				if (but_height != null)
				{
					ButtonState.SetupButton(child);
				}
				if (child.childNodes.length > 0)
				{
					ButtonState.RegisterButtons(child);
				}
			}
		}
	},
	
	SetState : function(butid,stateOff)
	{
		var button = $(butid);
		button.setAttribute("but_mode",(stateOff)?"off":"on");
		if (stateOff)
		{
			var btn_height = button.getAttribute("but_height");
			button.style.top = "-%spx".format(btn_height);
		}
		else
		{
			button.style.top = "0px";
		}
	}
}