//Simle Animated Menu for Mootools 1.2 v1
//Released June 2008 
//Dedicated to the public domain by www.consideropen.com

var navArrowSlider = function(navWrap,div, navElementsArray, activeID, arrowY, leftOffset) {
	var youAreHere = new Fx.Tween($(navWrap), { 
		duration: 1200,
		transition: Fx.Transitions.Elastic.easeOut  
	});
	 
	var youAreHere2 = new Fx.Tween(div, { 
		duration: 1200,
		transition: Fx.Transitions.Elastic.easeOut  
	});

	
	$$(navElementsArray).each(function(item){  		
		if( item.getSize().x > 30){
		item.addEvent('mouseenter', function() { 
			var thisPos = item.getPosition(navWrap).x  ; 
			youAreHere2.cancel();
	
			youAreHere2.set('display', '');
			youAreHere2.set('width', item.getSize().x + 'px');
			youAreHere2.start('margin-left', thisPos + 'px ' );
			
			
			
			youAreHere.cancel();
			youAreHere.start('background-position', thisPos + 'px ' + arrowY + 'px');
		});
		}
	});
	
	var currentArrow = function() {
		youAreHere2.cancel();
		//var activePos = $(activeID).getPosition(navWrap).x  ; 
		
		//youAreHere2.set('width',  $(activeID).getSize().x + 'px');
		
		//youAreHere2.start('margin-left', activePos + 'px ');
		youAreHere2.start('display','none');
		
	};
	
	//correct IE rendering problem (without this, it wont go to the active nav onload)
	var activePos = $(activeID).getPosition(navWrap).x  ; 
	//$(navWrap).setStyle('background-position', activePos + 'px ' + arrowY );
	
	$(div).style.marginLeft =  activePos + 'px ' ;
	
	//works to set image to starting position in other browsers
	currentArrow(); 
	
	$(navWrap).addEvent('mouseleave', currentArrow);	
}; 
	
	
