
// Nav element coordinates

$(document).ready(function() {
	var coordinates = new Array(-950, -855, -742, -630, -542, -470, -378, -251, -118);
	var i;
   
	// Set initial location of indicator
	
	$('.navigationBar').css({
		'background-position' : coordinates[indicatorReturnTo] + 'px top'
	});
	
	// Assign events to all items
	
	for (i=0; i < coordinates.length; i++) {
		var currentElement = '#mainNavigation_b' + (i+1);
	
		$(currentElement).bind("mouseover", {coords: coordinates, index: i}, anim);
   }

   $('.navigationBar').bind("mouseleave", {coords: coordinates, index: indicatorReturnTo}, anim);

   /* anim()
	*********
	Animate indicator
	*/
   function anim(e) {
		$('.navigationBar').animate({
			'backgroundPosition' : e.data.coords[e.data.index]
		}, 100);
		
		return;
	}
});