// Copyright Tobias Wetzel 2008
// Dependencies: mootools-1.2-core

var Site = {
 
	start: function(){
		Site.initMenu();
	},
 
	initMenu: function(){
		var act = $$('#nav li.active')[0];
		var pos = 720;
		if(act) var pos = act.getLeft();
		var lis = $$('#nav li[class!=active]');
		var high = new Element('div', {'id':'highlight'}).setStyles({'left': pos}).inject($('conM'), 'top');
		var fx = new Fx.Morph(high, {duration: 750, wait: false});
		var fxs = [];
		lis.each(function(li, i){
			var a = li.getFirst().setStyle('background-position','0 50px')
			fxs[i] = new Fx.Morph(a, {
				wait: false
			});
			li.addEvent('mouseover', function(e){
				fx.start({'left': a.getLeft()});
				fxs[i].start({'background-position': '0 20px', 'color': '#505050'});
			});
			li.addEvent('mouseout', function(e){
				fx.start({'left': pos});
				fxs[i].start({'background-position': '0 50px', 'color': '#82919b'});
			});
		});
	}
	
};
 
window.addEvent('domready', Site.start);