$(document).ready(function() {
	adjustContentBox();
	//adjustNav();
	setupWatermarks();
	setTimeout(adjustContentBox, 200);
});



function adjustContentBox() {
	var h = $("#Text").height();
	if(h > 500) {
		$("#ContentBox").css("height", h + 140);
		$("#Footer").css("top", h + 148);
	}
}

function setupWatermarks() {
	$("input,textarea").each(function() {
		if($(this).val() == "")
			$(this).watermark(this.title);
	});
}

//obsolete:
function adjustNav() {
	var nav = $("#Subnavigation");
	var items = $(nav).children().filter("a");
	
	var maxHeight = 0;
	$(items).each(function(i) { maxHeight = Math.max(maxHeight, $(this).height()); });
	
	if(maxHeight > 16) {
		$(items).each(function(i) {
			var target = this;
			var nxt = $(this).next()[0];
			if(nxt && nxt.tagName == "DIV")
				target = nxt;
			$(target).css({"margin-bottom" : 5});
		});
	}
}

