// Get window height
var H = $(window).height();
var mainH = (H-138);
var mainBot = (H-61);
var mainBotL2 = (H-89);
var W = $(window).width();
var rightW = (W-265);

//$('.w-info').text("H:" + H + " - mainH:" + mainH + " - mainBot:" + mainBot + " - W:" + W + " - rightW:" + rightW);
//$('.w-info').text(W + "x" + H);

// redirectPage after animations
function redirectPage() {
    window.location = linkLocation;
};
 
// Zoom-in out buttons for floor plans
function btnZoomInOut() {
	$("#right-col a.zoom-in").click(function(){ 
		$("img.full").css({width: rightW + "px", height: "auto"});
		$("a.zoom-in").hide(); 
		$("a.zoom-out").show();
	});
	$("#right-col a.zoom-out").click(function(){ 
		$("img.full").css({width: "auto", height: "100%"});	
		$("a.zoom-out").hide();
		$("a.zoom-in").show();
	});
};

function pageActionsDesignGallery() {
	
	$("#left-col").css({height: mainH + "px", top: "138px"});
	$("#left-col nav ul li.nav-title").hide().slideDown(50);
	$("#left-col nav ul ul li").hide().delay(200).slideDown("fast");
	$("#left-col-text article").hide();
	$(".text-intro").show();
	$("#left-col-text").hide().delay(1000).fadeIn(1000);
	$("#right-col").css({height: "0px", top: H + "px", width: rightW + "px", background: "#888888"});
	$("#right-col article.full-image").css({width: rightW + "px", textAlign: "center"});
	$("#right-col article").hide();
	$("img.full").css({width: "auto", height: "100%"});	
	
	btnZoomInOut();
	// Disable Zoom $("a.zoom-in").hide();

	$("a.nav-design-name").click(function(){
        $("#left-col").animate({top: "138px", height: mainH + "px"}, 500);
		$("#left-col nav ul ul li a").removeClass("on");
		$("#left-col-text article").fadeOut("fast");
		$(".text-intro").fadeIn(1000);
    });
	$("a.nav-facade").click(function(){
        $("#left-col").animate({top:  mainBot + "px", height: "61px"}, 500);
		$("#right-col").css({top: H + "px"});
		$("#left-col nav ul ul li a").removeClass("on");
    });
	$("a.nav-facade-level2").click(function(){
        $("#left-col").animate({top:  mainBotL2 + "px", height: "89px"}, 500);
		$("#right-col").css({top: H + "px"});
		$("#left-col nav ul ul li a").removeClass("on");
    });
	$("a.nav-ground-floor").click(function(){ 
		$("#right-col article").hide();
		//$(".plan-1").fadeIn("slow");
		$(".plan-1").show();
		$("#right-col").show().css({height: mainH + "px"}).animate({top: "138px"}, 1000, 'easeOutQuad');
		$("#left-col nav ul ul li a").removeClass("on");
		$(this).addClass("on");
		$(".text-intro").fadeOut("fast");
		$(".text-floor-size").delay(200).fadeIn(1000);
	});
	$("a.nav-upper-floor").click(function(){ 
		$("#right-col article").hide();
		//$(".plan-2").fadeIn("slow");
		$(".plan-2").show();
		$("#right-col").css({height: mainH + "px"}).animate({top: "138px"}, 1000, 'easeOutQuad');
		$("#left-col nav ul ul li a").removeClass("on");
		$(this).addClass("on");
		$(".text-intro").fadeOut("fast");
		$(".text-floor-size").delay(200).fadeIn(1000);
	});
	
    $("#left-col nav ul li a.nav-title").click(function(event){
        event.preventDefault();
        linkLocation = this.href;
		$("#supersized").fadeOut(500);
		$("#main").fadeOut(500, redirectPage);
    });
	$("#left-col nav ul li a.nav-level2-above").click(function(event){
        event.preventDefault();
        linkLocation = this.href;
		$("#left-col-text").fadeOut(500);
		$("#left-col nav ul ul li.nav-level3").delay(500).slideUp(500);
		$("#right-col").delay(1000).fadeOut(500, redirectPage);
    });
};

function pageActionsEminenceProminence() {
	
	$("#main").hide();
    $("#main").delay(1000).fadeIn(2000);
	
	$('#bottom-col').css({height: "0px"}).delay(1000).animate({bottom : "0px", height: "103px"}, 500, 'easeOutQuad');
	$("#bottom-col .intro").css({display: "none"}).delay(2000).fadeIn(1000);
	$("#bottom-col nav").css({display: "none"}).delay(2500).fadeIn(1000);
	
	$("#left-col").hide().css({height: "0px", top: H + "px"});
	$("#right-col").css({height: "0px", top: H + "px", width: rightW + "px"});
	$("#right-col article").hide();
	$(".bottom-right").hide();
	
	$("#left-col nav ul ul ul li").hide();
	$("#left-col-text").hide();
	
    $("#bottom-col nav ul li a.nav-gallery").click(function(event){
        event.preventDefault();
        linkLocation = this.href;
        $("#bottom-col").animate({bottom : "-103px"}, 500);
		$("#main").delay(500).fadeOut(500, redirectPage);
    });
	
	$("#bottom-col nav ul li a").click(function(){
        $("#bottom-col").animate({bottom : "-103px", height: "0px"}, 500);
    });
 	
	$("#bottom-col a.nav-this-page").click(function(){ 
		$("#left-col").delay(500).show().animate({top: "138px", height: mainH + "px"}, 1000, 'easeOutQuad');
		$("#right-col").delay(1500).css({height: mainH + "px"}).animate({top: "138px"}, 1000, 'easeOutQuad');
		$("#right-col article").hide();
	});
	$("#bottom-col a.nav-inclusions").click(function(){ 
		$("#left-col nav ul ul ul li").slideDown("fast");
		$("a.nav-exterior").addClass("on");
		$(".text-exterior").fadeIn("fast");
	});
	$("#bottom-col a.nav-process").click(function(){ 
		$("a.nav-process").addClass("on");
		$("#left-col a.above").removeClass("above");
		$(".text-process").fadeIn("fast");
		$("#left-col-text").delay(2500).fadeIn("fast");
		$(".bottom-right").delay(3500).fadeIn(1000);
	});
	$("#left-col a.nav-inclusions").click(function(){ 
		$("#left-col a").removeClass("on"); $(this).toggleClass("above"); $("#right-col article").hide();
		$(".nav-exterior").toggleClass("on");
		$("#left-col nav ul ul ul li").slideToggle("fast");
		$("#left-col-text").fadeOut("fast");
		$(".text-exterior").fadeIn("fast");
	});
	$("a.nav-exterior").click(function(){ 
		$("#left-col a").removeClass("on"); $(this).addClass("on"); $("#right-col article").hide();
		$(".text-exterior").fadeIn("fast");
	});
	$("a.nav-kitchen").click(function(){ 
		$("#left-col a").removeClass("on"); $(this).addClass("on"); $("#right-col article").hide();
		$(".text-kitchen").fadeIn("fast");
	});
	$("a.nav-bathrooms").click(function(){ 
		$("#left-col a").removeClass("on"); $(this).addClass("on"); $("#right-col article").hide();
		$(".text-bathrooms").fadeIn("fast");
	});
	$("a.nav-general").click(function(){ 
		$("#left-col a").removeClass("on"); $(this).addClass("on"); $("#right-col article").hide();
		$(".text-general").fadeIn("fast");
	});
	$("#left-col a.nav-process").click(function(){ 
		$("#left-col a").removeClass("on"); $(this).addClass("on"); $("#right-col article").hide();
		$("#left-col nav ul ul ul li").slideUp("fast");
		$("#left-col a.nav-inclusions").removeClass("above");
		$(".text-process").fadeIn("fast");
		$("#left-col-text").fadeIn("fast");
		$(".bottom-right").delay(2500).fadeIn(1000);
	});	
};
