var defaultContentHeight = 0;
var navSpaceTop = 166+38;		// top + margin/padding
var navSpaceBottom = 25;		// margin/padding
var contentSpaceTop = 250+70;	// margin/padding
var contentSpaceBottom = 25;	// margin/padding

var dbTimer;
var dbTimerDuration = 500;
var thisObj = "";
var curObj = "";

$(document).ready(function() {

	defaultContentHeight = $('div#contentWrapper').height();
	//alert("defaultContentHeight: " + defaultContentHeight);
	resizeContentArea();

	$('div#navigationLayer > ul > li > a').click(function() {
		//thisObj = $(this).parent('li').children('ul');
		//alert(thisObj + "/" + curObj);
		//if (($(curObj).length >= 1) && (curObj != thisObj)) $(curObj).slideToggle(350);
		$(this).parent('li').children('ul').not('ul.actClass').slideToggle(350, function() {
			//curObj = $(this).parent('li').children('ul');
		});
		//$(this).not('a.actClass').addClass('overClass');
		return false;
	});

});

$(window).load( function(){
	resizeContentArea();
});

$(window).resize(function() {
	resizeContentArea();
});

function resizeContentArea() {
	var navHeight = $('div#navigationWrapper').height() + navSpaceTop + navSpaceBottom;
	var bodyHeight = $('body').height() - 1;
	if (navHeight > bodyHeight) maxHeight = navHeight; else maxHeight = bodyHeight;
	var contentHeight = defaultContentHeight + contentSpaceTop + contentSpaceBottom;
	var yDiff = maxHeight - contentHeight;
	if (yDiff > 0) $('div#contentWrapper').height(defaultContentHeight+yDiff);

	//alert("navHeight: " + navHeight);
	//alert("bodyHeight: " + bodyHeight);
	//alert("contentHeight: " + contentHeight);
}

