$(document).ready(function(){
	var animatedArrow = new AnimatedArrow();
	animatedArrow.run();
});

function AnimatedArrow() {
	
	var arrowIsAnimating = false;
	var arrowSection = null;
	
	this.run = function (){
		
		$(".animatedArrow").hoverIntent(enteredAnimatedArrowSection, exitedAnimatedArrowSection);
		
	};
	
	function animateArrow() {
		
		if (!arrowIsAnimating){return;}
		arrowIsAnimating = true;
		
		$(".linkArrow:eq(0)",arrowSection).animate({left: "-=5px"}, 500,"easeInOutSine").animate({left: "+=5px"},500, "easeInOutSine", animateArrow);
	}
	
	function enteredAnimatedArrowSection(){
		
		if (arrowIsAnimating){return;}
		arrowIsAnimating = true;
		
		arrowSection = this;
		
		animateArrow();
	}
	
	function exitedAnimatedArrowSection(){
		
		if (!arrowIsAnimating){return;}
		arrowIsAnimating = false;
	
	}
}
