jQuery(document).ready( function($)
{

	$(function() {
		var menu           = $('#menu-main'),
			gutter         = $('#current-item-gutter'),
			highlight      = $('#current-item-highlight'),
			currentElement = menu.find('li.current');

		var getPositionByElement = function (element) {
			return element.position().left;
		}

		var mouseOverHandler = function () {
			menu.find('ul li')
				.hover(function() {
					highlight
						.stop()
						.animate({
							'left':  getPositionByElement($(this)) + 10,
							'width': $(this).width() - 20
						}, 200);
				}, function() {
					highlight
						.stop()
						.animate({
							'left':  getPositionByElement(currentElement) + 10,
							'width': currentElement.width() - 20
						}, 200);
					}
				);
		}

		highlight.css({
			'left':  getPositionByElement(currentElement) + 10,
			'width': currentElement.width() - 20
		});

		mouseOverHandler();
	});
});

