$(function(){
	//main content height fix
	contentHeightOriginal = $('#main-content').outerHeight();
	navHeight = $('#navigation').outerHeight();
	
	applyResize();
	
	$(window).resize(applyResize);
	
	setTimeout('applyResize()', 1000);
	
	//temporary!
	$('.search input.search-box').val("Search the site...");
	$('.search input.search-box').focus(function(){
		if($('.search input.search-box').val() == "Search the site...")
		{
			$('.search input.search-box').val("");
		}
	});
	$('.search input.email').val("Enter you email address");
	$('.search input.email').focus(function(){
		if($('.search input.email').val() == "Enter you email address")
		{
			$('.search input.email').val("");
		}
	});
});

var contentHeightOriginal;
var navHeight;

function applyResize()
{
	mainContentResizeHeight();
	mainContentResizeNav();
}

function mainContentResizeNav()
{
	var windowWidth  = $(window).width();
	var contentWidth = $('#main-content').outerWidth();
	var navWidth	 = $('#navigation').outerWidth();
	
	var minWindowWidth = 1024;
	var maxWindowWidth = 1280;
	
	if ( windowWidth <= minWindowWidth )
	{
		var newNavWidth		= 20;
		var newContentWidth = 80;
	}
	
	if ( windowWidth > minWindowWidth && windowWidth < maxWindowWidth )
	{
		var newNavWidth = ( Math.round( ( 25 + ( ( maxWindowWidth - windowWidth ) / ( maxWindowWidth - minWindowWidth ) * -5 ) ) * 100 ) / 100 );
		var newContentWidth = (100 - newNavWidth);
	}
	
	if ( windowWidth >= maxWindowWidth )
	{
		var newNavWidth		= 25;
		var newContentWidth = 75;
	}
	
	$('#main-content').css( 'width', newContentWidth.toString() + '%' );
	$('#navigation').css( 'width', newNavWidth.toString() + '%' );

}

function mainContentResizeHeight(setExplicitHeight)
{
	var windowHeight  = $(window).height();
	var contentHeight = $('#main-content').outerHeight();
	var ch = 0;
	
	if( contentHeightOriginal > windowHeight && contentHeightOriginal > navHeight )
	{
		if( setExplicitHeight )
		{
			ch = contentHeightOriginal + 10;
		}
		else
		{
			return;
		}
		
	}
	
	var biggestHeight = Math.max((navHeight), windowHeight, ch);
	
	$('#main-content').height(biggestHeight);
}

$(function(){
	$('#requestSample').bind('click', function() {
		$('#signup-address').slideToggle('slow', function() {
		    // Animation complete.
		  });
	});

	//signup-address
});

