$j(document).ready(function() {
	// # IE Helpers
	$j('#nav>li:last-child').addClass('_last-child');
	$j('fieldset:last-child').addClass('_last-child'); 
	$j('p:last-child').addClass('_last-child'); 
	
	if($j(".listing").length > 0 || $j(".list.projects").length > 0 || $j(".pager.photos").length > 0) {
		$j(".main-content").css({
			"background": "none",
			"padding": "0",
			"width": "775px"
		});
	}
	else {
		if($j("#p_home").length == 0) {
			$j(".main-content").css({
				"background": "url(_assets/images/bg-white.png)",
				"padding": "30px",
				"width": "715px"
			});
		}
	}
	
	if($j(".back").length > 0) {
		$j(".back").appendTo($j(".main-content"));
	}
	
	$j(".main-content .details ul li").prepend("&raquo; ");
	
	$j("._gallery").each(function() {
		$j(this).find("ul li").each(function(i) {
			if((i % 4) == 3) {
				$j(this).addClass("last");
			}
		});
	});
	
	$j(".projContent").cycle({cleartypeNoBg: true});
		
	windowResize();
});

function windowResize() {
	if($j("#adminical").length == 0) {
		var curContentHeight = 585;
		var headerFooterHeight = 276;
		var bannerMargin = 395;
		var curWindowHeight = $j(window).height();
		
		if(curWindowHeight > (curContentHeight + headerFooterHeight)) {
			var addition = curWindowHeight - (curContentHeight + headerFooterHeight);
			var newContentHeight = curContentHeight + addition;
			var newMargin = bannerMargin + addition;
			$j("#content").css("height", newContentHeight);
			$j("#content #home-bottom").css("padding-top",bannerMargin+addition);
		}
	}
}

$j(window).resize(windowResize);
