//Hmenu by Karurosu v0.1
function hmenu() {

	var szNormal = 110, szSmall  = 80, szFull   = 200;
	
	var origColor = {};
 
 	
	var kwicks = $$("#hmenu li");
	var fx = new Fx.Elements(kwicks, {wait: false, duration: 300, transition: Fx.Transitions.Back.easeOut});
	
	ncolor = {};
	
	kwicks.each(function(kwick, i) 
	{
		origColor[i] = kwick.getStyle("background-color");
		ncolor[i] = new Color(origColor[i]).setBrightness(20);
		kwick.addEvent("mouseenter", function(event) 
		{
			var o = {};
			o[i] = {
					width: [kwick.getStyle("width").toInt(), szFull],
					'background-color': ncolor[i].rgbToHex()
			}
			kwicks.each(function(other, j)
			{
				if(i != j) 
				{
					var w = other.getStyle("width").toInt();
					if(w != szSmall) o[j] = {width: [w, szSmall]};
				}
			});
			fx.start(o);
		});
		kwick.addEvent("mouseleave", function(event)
		{
			var fx = new Fx.Styles(kwick, {wait: false, duration: 300, transition: Fx.Transitions.Back.easeOut});
			fx.start({
				'background-color': origColor[i]
			});
		});
	});
 
	$("hmenu").addEvent("mouseleave", function(event) {
		var o = {};
		kwicks.each(function(kwick, i) {
			o[i] = {width: [kwick.getStyle("width").toInt(), szNormal]}
		});
		fx.start(o);
	});

}
