/* 
 * Javascript
 * This file utilizes Jquery.
 * Author: Legalmatch
*/
$(document).ready(function(){
	
	/*
	 * Make #right full-height.
	 * Height to set is browser's height by default.
	 * VARS:
	 * element = THE ELEMENT YOU WANT TO RESIZE
	 * model = THE DEFAULT ELEMENT YOU WANT THE HEIGHT TO MATCH
	 * fallback = THE ELEMENT YOU WANT THE HEIGHT TO MATCH IF model CAN BE TOO SHORT.
	*/	
	function fullHeight(element,model,fallback) {
		
		// Create element height vars for comparison
		var eHeight = $(element).height();
		
		// If model is not set to an element, set it to the window height.
		if(typeof(model) != "undefined" && typeof(fallback) == "undefined") {
			var mHeight = $(model).height();
		} else if($(model).height() < $(fallback).height()) {
			var mHeight = $(fallback).height();
		} else {
			var mHeight = document.body.clientHeight;
		}
		
		// Set height
		$(element).height(mHeight);
	}
	// Execute function on load.
	fullHeight("#right","body","#container");
	
	// Execute function on resize.
	$(window).bind('resize', function() {
		fullHeight("#right","body","#container");
	});
	
	/* EOF */
});