
var RCD = {

	setContainerHeight: function() {
		var $bc = $("#bodycopy"); 
		var targetHeight = parseInt($bc.css("top")) + $bc.height() + parseInt($bc.css('padding-top')) + parseInt($bc.css('padding-bottom')); 
		targetHeight += 5; // border at bottom
		if($("#container").height() < targetHeight) $("#container").css("height", targetHeight + "px"); 
	},

	activateNavigation: function() {
		var rootParent = $("body").attr('id');
		rootParent = rootParent.substring(rootParent.indexOf('_')+1); 
		$("#topnav_" + rootParent).addClass('on'); 
	},

	instructiveDefaults: [], 
	activateInstructiveFields: function() {
		$("input.instructive").each(function() {
			var id = $(this).attr('id'); 
			RCD.instructiveDefaults[id] = $(this).val();	
			$(this).focus(function() {
				if($(this).val() == RCD.instructiveDefaults[id]) $(this).val('');
				$(this).addClass('focused'); 
			}).blur(function() {
				var v = $.trim($(this).val());
				if(v.length < 1) $(this).val(RCD.instructiveDefaults[id]).removeClass('focused'); 
			}); 
		}); 
	},

	floatNavLists: function() {
		$("#bodycopy ul.floated").after("<div style='clear:both;'></div>").children("li:even").addClass("even"); 
	},

	init: function() {
		RCD.setContainerHeight(); 
		RCD.activateNavigation();
		RCD.activateInstructiveFields();
		RCD.floatNavLists();
	}
}

$(document).ready(function() {
	RCD.init();
	//$("#bodycopy").fadeTo("fast", 0.90); 
}); 
