window.addEvent('domready', function() {
	var fr=$('search').getElement('input[type=text]');
	fr.addEvent('focus', function(){
		var v=this.value;
		this.value=((v=='Search')?'':v);
		return true;
	});
	var navMenu=$('menu')
	navMenu.setStyle('marginBottom', 0);
	var navWidth=navMenu.getSize().x;
	var navMenuLi=navMenu.getElements('ul.nav > li');
	var mbtn = navMenu.getStyle('marginBottom').toInt();
	if(Browser.Engine.trident && Browser.Engine.version <= 4){
		navMenuLi.each(function(el, i){
			el.addEvents({
				'mouseenter': function(){
					el.addClass('hover');
				},
				'mouseleave': function(){
					el.removeClass('hover');
				}
			});
		});
	}
	var growFx = new Fx.Tween(navMenu,{property:'paddingBottom'});
	navMenuLi.each(function(el, i){
		var mel=el.getElement('ul,dl');
		if(mel){
			el.stil=mel.getSize().y;
			var melFx = new Fx.Reveal(mel);
			mel.setStyle('width', navWidth);
			mel.dissolve();
			el.addEvents({
				'mouseenter': function(){
					growFx.start(this.stil+6);
					melFx.reveal();
				},
				'mouseleave': function(){
					growFx.start(0);
					melFx.dissolve();
				}
			});
		} else {
			el.addEvent(
				'mouseenter', function(){
					var cur=navMenu.getStyle('paddingBottom').toInt();
					if(cur>1) growFx.start(0);
			});
		}
	});
});
