//Simle Animated Menu for Mootools 1.2 v1
//Released June 2008 
//based on consideropen modified by Autotech
var navArrowSlider = function(navWrap, navElementsArray, activeID, barY, leftOffset) {
	var youAreHere = new Fx.Tween($(navWrap), { 
		duration: 1500,
		transition: Fx.Transitions.Elastic.easeOut
	});

	$$(navElementsArray).each(function(item){  
		item.addEvent('mouseenter', function() { 
			var thisPos = item.getPosition(navWrap).x + item.getSize().x - leftOffset; 
			youAreHere.cancel();
			youAreHere.start('background-position', thisPos + 'px' + barY + 'px'); 
		});
	});
	
	//activeID##############
	var currentArrow = function() {
		youAreHere.cancel();
		var activePos = $(activeID).getPosition(navWrap).x  + $(activeID).getSize().x - leftOffset; 
		youAreHere.start('background-position', activePos + 'px ' + barY + 'px');   
	};
	
	//correct IE rendering problem (without this, it wont go to the active nav onload)
	var activePos = $(activeID).getPosition(navWrap).x  + $(activeID).getSize().x - leftOffset; 
	$(navWrap).setStyle('background-position', activePos + 'px ' + barY + 'px');       
	
	//works to set image to starting position in other browsers
	currentArrow(); 
	
	$(navWrap).addEvent('mouseleave', currentArrow);
}; 
	
window.addEvent('domready', function() {
	navArrowSlider(
		'nav_wrap', // ID of nav wrap
		'#nav_wrap ul li', // Array selector of nav elements 
		'active_nav', // ID of current nav element
		'0', //  Background position y of background image
		'100' //  INT ONLY - How far left from the right edge of the nav element that the image settles
	); 	
}); 


