
/**
 * Set the content of the HTML element to be at least as high as the page height.
 */
function setMinHeight() {
	//Move the footer to the bottom of the screen.
	var footerElement = $("#footer");
	var currentFooterMargin = 35;
	var windowHeight = $(window).height();
	var footerBottom = footerElement.offset().top + footerElement.height() + 18;
	
	if (windowHeight > footerBottom) {	
		//footerElement.offset({left: 0, top: (windowHeight - footerBottom + minFooterMargin)});
		footerElement.css('margin-top', "" + (windowHeight - footerBottom + currentFooterMargin) + "px");
		//footerElement.css({'background': "red"});
		//$('#footer .footer-nav').click();
	}
	
	footerElement.click();
	
	//Adjust the #container to include the footer.
	footerBottom = footerElement.offset().top + footerElement.height() + 18;
	var containerElement = $("#container");
	var containerHeight = containerElement.height();
	var windowHeight = $(window).height();
	var documentHeight = $(document).height();
	
	var newHeight = containerHeight;
	
	if (newHeight < windowHeight) {
		newHeight = windowHeight;
	}
	
	if (newHeight < footerBottom) {
		newHeight = footerBottom;
	}
	
	if (containerHeight < newHeight) {
		containerElement.height(newHeight);
	} 

	//Make sure that .nav is at least as high as the .main.
/*	var navElement = $(".nav");
	var mainElement = $(".main");
	var mainHeight = mainElement.height();
	
	if (mainHeight > navElement.height()) {
		navElement.height(mainHeight);
	}*/
}


$(document).ready(function() {
	$('#slideshow').tabs().addClass('ui-tabs-vertical ui-helper-clearfix');
	$("#slideshow li").removeClass('ui-corner-top');
	
	// Create the emails.
	$("a.email").each(function(index, rawElement) {
		var element = $(rawElement);
		var basicAddress = element.attr('href');
		var fullAddress = basicAddress + "@orchardgroup.com";
		element.attr('href', "mailto:" + fullAddress);
		
		if (!element.hasClass('link-only')) {
			element.text(fullAddress);
		}
	});

	//setTimeout('setMinHeight()', 1);
	//setMinHeight();
	//$(window).resize(function() {
	//	setMinHeight();
	//});
	
});
