$(document).ready(function(){

	var cHeight = $('.main-content').height();
	if ( cHeight < 571 ) {
		cHeight = 571;
		$('.main-content').css( "height", cHeight + 'px' );
	}
	
	$('.left-nav').css( "height", cHeight + 8 + 'px' );
	
	// Stretch out the bottm left and right shadows to fill the empty space.
	var bottomHeight = $(".wrapper").height() - $(".left-top").height() - 33; /* 33 is the height of the bottom cap */
	$('.left-bottom').css( "height", bottomHeight + 'px' );
	$('.right-bottom').css( "height", bottomHeight + 'px' );


	// Go Home
	$('.header').click(function() { document.location.href='/'; });
	
	// Setup menu mouseovers
	$(".menuItems").find("img").each(function() {
	
		var id = $(this).attr("id");
		var normal = '/assets/images/layout/' + id + '.gif';
		var over = '/assets/images/layout/' + id + '-over.gif';
		
		var mypage = window.location.pathname;
		if ( mypage.indexOf(id) >= 1 ) {
			$(this).attr('src',over);
		}
		else if ( id == "leasing" && (mypage.indexOf("city") >= 1 || mypage.indexOf("washington") >= 1 || mypage.indexOf("oregon") >= 1 || mypage.indexOf("utah") >= 1) ) {
			$(this).attr('src',over);
		}
		else {
			$(this).mouseover(function(){ $(this).attr('src',over); });
			$(this).mouseout(function(){ $(this).attr('src',normal); });
		}
		
	});	
	
	// For everyone's favorite browser
	//$(function(){$(document).pngFix();});
	
});


function emailLink( name ) {
	var domain = "powelldev.com";
	document.write('<a href=\"mailto:' + name + '@' + domain + '\">');
	document.write(name + '@' + domain + '</a>');
}

