nav = new Object();
nav.contentArray = [ "acasa", "produse", "articole", "ambiente", "contact" ];
nav.position = 0;

$(document).ready(
		function() {
			var location = "acasa";
			change(location);
			$("#navcontainer_left").hover(function() {
				$("#navigator_left").stop().show();
			}, function() {
				$("#navigator_left").stop().hide();
			});
			$("#navcontainer_right").hover(function() {
				$("#navigator_right").stop().show();
			}, function() {
				$("#navigator_right").stop().hide();
			});

			$("#navigator_left").click(function() {
				nav.position = nav.position - 1;
				location = getLocation(nav.position);
				change(location);
			});
			$("#navigator_right").click(function() {
				nav.position = nav.position + 1;
				location = getLocation(nav.position);
				change(location);
			});
			$(".limenu").click(
					function() {
						nav.position = $(this).index();
						_gaq.push([ '_trackEvent', 'MenuInteraction',
								nav.contentArray[nav.position],
								nav.contentArray[nav.position] + " clicked" ]);
						location = getLocation(nav.position);
						change(location);
					});

		});

function change(location) {
	switch (location) {
	case "acasa":
		$("#image").show();
		$(".contentClass").hide();
		modifySelectedMenu(0);
		$("#contentAcasa").show();
		break;
	case "produse":
		$("#image").hide();
		$(".contentClass").hide();
		modifySelectedMenu(1);
		$("#contentProduse").show();
		break;
	case "articole":
		$("#image").hide();
		$(".contentClass").hide();
		modifySelectedMenu(2);
		$("#contentArticole").show();
		break;
	case "ambiente":
		$("#image").hide();
		$(".contentClass").hide();
		modifySelectedMenu(3);
		$("#contentAmbiente").show();
		break;
	case "contact":
		$("#image").hide();
		$(".contentClass").hide();
		modifySelectedMenu(4);
		$("#contentContact").show();
		break;
	default:
	}
}

function getLocation(a) {
	if (a <= 0) {
		nav.position = 0;
		return nav.contentArray[0];
	}
	if (a < 5) {
		return nav.contentArray[a];
	}
	if (a >= 5) {
		nav.position = 4;
		return nav.contentArray[5];
	}

}

function modifySelectedMenu(pos) {
	for (z = 0; z < 5; z++) {
		$('#menuUL li:eq(' + z + ')').removeClass("selected").addClass(
				"unselected");

	}
	$('#menuUL li:eq(' + pos + ')').removeClass("unselected");
	$('#menuUL li:eq(' + pos + ')').addClass("selected");

}

