function Headmenu()
{
	var self = this;
	this.moving = 0;
	this.buttonsover = false;
	this.menu = document.getElementById("headmenu");
	this.buttons = this.menu.getElementsByTagName("li");
	
	this.menu.onmouseover = function()
	{
		if(!self.moving)
		{
			self.menu.style.opacity = 0.6;
			self.moving = 1;
			var i = -30;
			var dtime = setInterval(function(){
				
				//debug.changeValue(self.menu.style.top);
				i+=3;
				self.menu.style.top = i;
					if(i >= 0)
					{
						clearInterval(dtime);
						self.moving = 2;
						
					}
					
				},10);
		}
	}

	this.menu.onmouseout = function()
	{
		setTimeout(function(){
			if(!self.buttonsover)
			{
				if(self.moving == 2)
				{
					var i = 0;
					var dtime = setInterval(function(){
						
						//debug.changeValue(new Date);
						i-=3;
						self.menu.style.top = i;
							if(i <= -40)
							{
								self.menu.style.opacity = 0;
								clearInterval(dtime);
								self.moving = 0;
								self.menu.style.top = -30;
							}
							
						},10);
				}
			}
		},300);
	}
	
	for(var i =0;i < this.buttons.length ; i++)
	{
		this.buttons[i].onmouseover = function()
		{
			self.buttonsover = true;
			this.style.cursor = "pointer";
		}
		
		this.buttons[i].onmouseout = function()
		{
			self.buttonsover = false;
		}
	}
	
}