// slidung shutter menu -- START


$(document).ready(function(){

	var shutterspeed = 500;
	
	var shutter_1_isopen = false;
	var shutter_1_moving = false;
	var shutter_w_isopen = false;
	var shutter_w_moving = false;
	var shutter_m_isopen = false;
	var shutter_m_moving = false;
	
	$("#handle").mouseover(function () {
		$("#handle_arrow ").css("display", "none");
		if (!shutter_1_isopen && !shutter_1_moving) {
			shutter_1_moving = true;
			$("#shutter_1").show("slide", {}, shutterspeed, function () {
				shutter_1_isopen = true;
				shutter_1_moving = false;
			});			
		}
	});

	
	$("#woman img").click(function () {
		if (shutter_w_isopen) {
			//nothing happens
		}else if (	!shutter_w_isopen && !shutter_w_moving &&
					!shutter_m_isopen && !shutter_m_moving 
					) { 
			shutter_w_moving = true;
			$("#shutter_w").show("slide", {}, shutterspeed, function () {
				shutter_w_isopen = true;
				shutter_w_moving = false;
			});	
		}else if (	!shutter_w_isopen && !shutter_w_moving &&
					shutter_m_isopen && !shutter_m_moving
				) {
			shutter_m_moving = true;
			$("#shutter_m").hide("slide", {}, shutterspeed, function () {
				shutter_m_isopen = false;
				shutter_w_moving = true;
				$("#shutter_w").show("slide", {}, shutterspeed, function () {
					shutter_w_isopen = true;
					shutter_w_moving = false;
				});	
				shutter_m_moving = false;
			});	
		}
	});


	$("#man img").click(function () {
		if (shutter_m_isopen) { //stop reacting when the submenue is open
		
		}else if (	!shutter_m_isopen && !shutter_m_moving &&
					!shutter_w_isopen && !shutter_w_moving
					) {
			shutter_m_moving = true;
			$("#shutter_m").show("slide", {}, shutterspeed, function () {
				shutter_m_isopen = true;
				shutter_m_moving = false;
			});	
		}else if (	!shutter_m_isopen && !shutter_m_moving &&
					shutter_w_isopen && !shutter_w_moving
					) {
			shutter_w_moving = true;
			$("#shutter_w").hide("slide", {}, shutterspeed, function () {
				shutter_w_isopen = false;
				shutter_m_moving = true;
				$("#shutter_m").show("slide", {}, shutterspeed, function () {
					shutter_m_isopen = true;
					shutter_m_moving = false;
				});	
				shutter_w_moving = false;
			});	
		}
	});	


	$("#top_bar, #content").hover(function () {
		if (	
				shutter_1_isopen && !shutter_1_moving &&
				!shutter_w_isopen && !shutter_w_moving &&
				!shutter_m_isopen && !shutter_m_moving
				) { //hide shutter_1 which is the only one that is open
			shutter_1_moving = true;
			$("#shutter_1").hide("slide", {}, shutterspeed, function () {
				shutter_1_isopen = false;
				shutter_1_moving = false;
				$("#handle_arrow ").css("display", "block");
			});	
		}else if (
				shutter_1_isopen && !shutter_1_moving &&
				shutter_w_isopen && !shutter_w_moving &&
				!shutter_m_isopen && !shutter_m_moving
				) { //hide shutter_w when it is open with shutter_1
			shutter_w_moving = true;
			$("#shutter_w").hide("slide", {}, shutterspeed, function () {
				shutter_w_isopen = false;
				shutter_1_moving = true;
				$("#shutter_1").hide("slide", {}, shutterspeed, function () {
					shutter_1_isopen = false;
					shutter_1_moving = false;
				});	
			});	
			shutter_w_moving = false
		}else if (
				shutter_1_isopen && !shutter_1_moving &&
				!shutter_w_isopen && !shutter_w_moving &&
				shutter_m_isopen && !shutter_m_moving
				) { //hide shutter_m when it is open with shutter_1
			shutter_m_moving = true;
			$("#shutter_m").hide("slide", {}, shutterspeed, function () {
				shutter_m_isopen = false;
				shutter_1_moving = true;
				$("#shutter_1").hide("slide", {}, shutterspeed, function () {
					shutter_1_isopen = false;
					shutter_1_moving = false;
				});	
			});	
			shutter_m_moving = false;
		}
	});

});

// slidung shutter menu -- STOP
