// JavaScript Document

$(document).ready(function() {

        //$(window).resize( function(){ checkLayout(); });

        $(".videoTitle").click( function(){
                $(".videoTitle").removeClass("active");
                $(this).addClass("active");
                $(".itemVideoInfo, .itemVideoObject").hide();
                $("#"+$(this).attr("id").replace("itemVideoChoose", "itemVideoInfo")).show();
                $("#"+$(this).attr("id").replace("itemVideoChoose", "itemVideoObject")).show();
            });

        $(".contentItemContainer").click( function(){
                $(this).toggleClass("opened").children(".contentItem").toggle();
                if($("#contentNav").height() > $("#pageBottomContent").height()){
                    $("#pageBottomContent").height($("#pageTopContent").height() + $("#contentNav").height() - 40);
                }
            });

        $(".team .itemActive").show().siblings().show().parent().addClass("opened");

        //setTimeout(function(){ $(".hidden").hide(); },1000);
        //checkLayout();

    });

function checkLayout(){
	var viewportHeight = $(window).height();
	var viewportWidth = $(window).width();
	var pageBottomHeight = viewportHeight - $("#pageTopContent").height();

	if(viewportHeight > ($("#pageTopContent").height() + $("#pageBottomContent").height())){
		$("#pageBottomContent").height(pageBottomHeight);
		$("#pageBottomLeft, #pageBottomRight").height(pageBottomHeight-1);
	}

	if($("#contentRight").height() < $("#contentLeft").height()){
		$("#contentRight").height($("#contentLeft").height() - 45);
	}

	$(".contentRight").height($("#pageBottomContent").height() - 75);

	if($("#pageBottomRightContent").height() > ($("#pageBottomContent").height()+10)){
		$("#pagBottom, #pageBottomContent").height($("#pageBottomRightContent").height() + 4);
		$("#pageBottomRight").height($("#pageBottomRightContent").height() + 3);
	}

	$("#pageBottomRightContent").height($("#pageBottomContent").height()-5);


}