var screenH, screenW, mainH, footerH, headerH, navH;

$(document).ready(function() {
    
       //pageLoaded();

	if ($("#ldaholder").length) {
		$("body").append("<div id='greyout'></div>");
		$("#greyout").css("opacity","0.7");
	}

	if(Get_Cookie("passlda")=="true"){
	    $('#ldaholder').hide();
		$('#greyout').hide();
	} else {
		$('#ldaholder').show();
		$('#greyout').show();
	} 

	$("nav li").each(function(index) {
		if ($(this).attr("class").length<1) {
			$(this).css("opacity",(8-index)/10);
		}
	});
	
	function position() {
		
		screenH = $(window).height();
		screenW = $(window).width();
		
		footerH = $("#siteFooter").height();
		headerH = $("#topbar").height();
		navH = $("nav").height();
		mainH = $("#main").height();
		
		ldaH = $("#ldabox").height();
		ldaW = $("#ldabox").height();
		
		ldaPosX = Math.floor((screenW-ldaW)/2);
		ldaPosY = Math.floor((screenH-ldaH)/2);
		
		$("#ldabox").css({
			"left":ldaPosX,
			"top":ldaPosY
		});
		
		var footerPos = screenH-footerH-headerH-mainH-navH;
		if (footerPos<0) footerPos = 0;
		$("#siteFooter").css("padding-top",footerPos-2);
		//alert(footerPos);
		
		
		/*
		mainH = screenH - footerH - navH - headerH;
		$("#main").css("height",mainH);
		
		if ($("#flashcontent").length) {
		
			$("#content").css("height", $("#flashcontent").height());
			
			var contentPosY = Math.floor((mainH - $("#content").innerHeight()) / 2);
			if (contentPosY > 0) {
				//alert(contentPosY);
				$("#content").css("top", contentPosY);
			}
			else {
				$("#content").css("top", "auto");
			}
		}
		*/
	}
	$(window).resize(position);
	position();
})


