/***********************************************
* Function to dynamically resize div based on window height.
* Resize target div through css style and subtract a variable difference.
* Call function like resizediv('sizediv', 250) which will set the div height to the height of window - 250px
* Copyright Marian Zamfirescu. This note must be kept with all instances of the scripts wherever used.
* This script may not be re-distributed in any for-profit form.
* Modified for Kitchen Pick to adjust height based on size of footer and amount of content starting @ line 25
* Modified July 2010 for MSM to adjust for footer height and padding amount to add when scrolling
***********************************************/
function resizediv(divtosize, diff, footersize, padamount) {
	var wwidth = 0, wheight = 0;
	var targetdiv = document.getElementById(divtosize);
	if (typeof( window.innerWidth) == 'number') {
		//Anything but IE
		wheight = window.innerHeight;
	}
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ Standards Mode
		wheight = document.documentElement.clientHeight;
	}
	else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//Older IE
		wheight = document.body.clientHeight;
	}

	targetdiv.style.height = "100%";

	var currentdivheight = targetdiv.offsetHeight;
	if (currentdivheight < (wheight - diff)) {
		if (currentdivheight >= (wheight - diff - footersize)) {
			targetdiv.style.height = wheight - diff + "px";
			targetdiv.style.paddingBottom = padamount + "px";
			}
		else {
			targetdiv.style.height = wheight - diff + "px";
			targetdiv.style.paddingBottom = "0px";
			}
		}
}
