
var fitImage = function(theSelector) {
	var theImage;
	if (theSelector) {
		theImage = $(theSelector);
	} else {
		theImage = $('#theresizeimage');
	}
	if (theImage) {
		var currentRatio = theImage.width() / theImage.height();
		var windowHeight = $(window).height();
		var newHeight = Math.round(windowHeight * HEIGHT_PCT);
		var newWidth = Math.round(newHeight * currentRatio);
		theImage.css({'height':newHeight, 'width':newWidth});
		var theLabel = $('#theresizeimagelabel');
		if (theLabel) {
			theLabel.css({'width':newWidth});
		}
	}
}

