


		var zCounter=1, imageUBound = 5;
		var currentHeader=0;
		var timerHandle;
		var lang;
		
		$(document).ready(function(){


			$(".tab").not(".tab:first").hide();
			//changeHeaderImage every nSec
			window.setTimeout(function() {changeImageEveryDelay(3500);}, 3500);
			function changeImageEveryDelay(delayMS)
			{	currentHeader = (++currentHeader) % imageUBound;
				changeHeaderImage(currentHeader)
				timerHandle = window.setTimeout(function() { changeImageEveryDelay(delayMS)}, delayMS);
			}

			$(".datepicker").datepicker();

			var activeTab = $(".activeTab");
			$(".item").click(function()
			{	if ($(this).hasClass("activeMenuTab"))
					return;
				$(".activeMenuTab").removeClass("activeMenuTab");
				$(this).addClass("activeMenuTab");
				_gat._getTracker("UA-11728318-1")._trackPageview("/" + lang + "/" + $(this).text());
				window.clearTimeout(timerHandle);
				var elemClicked = $(this);
				var destDivName = "#tab" + parseInt(elemClicked.attr("name"));
				var destDiv = $(destDivName);
				$("#content").css({height:$("#content").height()})
				activeTab.fadeOut("slow", function()
				{
					$("#fadeMe").show();
					$("#content").animate({height: destDiv.height()}, "slow", function() {
						destDiv.fadeIn("slow");
						activeTab = destDiv;
					})
					changeHeaderImage(elemClicked.attr("name"));
				});
			})

			if (window.location.href.indexOf("#") >= 0)
			{	var document = window.location.href.substring(window.location.href.indexOf("#")+1, window.location.href.length);
				$(".item:contains(" + document + ")").click();
			}

	
			function changeHeaderImage(id)
			{		img = $("#header" + id);
					img.css({zIndex:++zCounter, opacity:0}); //now the image is on top, totally faded
					img.animate({opacity:1});
			
			}		


			$("#submitContact").click(function() {
				$(this).attr("DISABLED","TRUE");
				$(".progress").show();
				$.post("/mail.php", $("#contactForm").serialize(), function(ans) {
					if (ans.status == "ok")
					{	$("#contactForm").slideUp("slow", function() { $(".contactFormThankYou").slideDown("slow") });
						$("#tab3").add("#content").animate({height:400},"slow");
					}
				}, "json")
			});

		})
