jQuery(document).ready(function(){
    jQuery('ul.dropdown').superfish();    
});  


/*
 * Mootools Scripts
 * Background Fade for Top Level Menu Items
 */

window.addEvent('domready', function(){

	var menu = $('menu');
	var menuUL = menu.getElement('ul.menu');
	var menuLIS = menuUL.getChildren('li');
	
	menuLIS.each(function(l,i){
		/* Create and Style the background */
		var libg = new Element('span').addClass('libg');
		libg.setStyles({
			'display':'block',
			'position':'absolute',
			'top':'0px',
			'left':'0px',
			'width':l.getSize().size.x + 'px',
			'height':l.getSize().size.y + 'px',
			'z-index':'-1',
			'opacity':0
		});
		/* Get the Link and add the background */
		var link = l.getElement('a');
		link.adopt(libg);
		
		/* Create the fx var */
		var fx = new Fx.Styles(libg, {duration:600, wait:false, transition: Fx.Transitions.Sine.easeOut} );
		/* Hover the Top Elments */
		l.addEvent('mouseenter', function(){
			fx.start({
				'opacity':1
			});
		});
		
		/* Hover Out the Top Elments */
		l.addEvent('mouseleave', function(){
			fx.start({
				'opacity':0
			});
		});
		
		/* Finding current */
		if( l.getProperty('id') ) { 
			if( l.getProperty('id') == 'current' ) l.removeEvents(); 
		};
		
		/* Finding active */
		if( l.hasClass('active') ) l.removeEvents();
		
	});
	
});


