$(document).ready(function() {

	var PageTitle = $('title').html();
	var Nav2Title = $('.Nav2Title').html();
	if (Nav2Title == null) { Nav2Title = ''; }
	
	PageTitle = PageTitle.replace("&amp;", "");
	Nav2Title = Nav2Title.replace("&amp;", "");
	$('div.Page').addClass(Nav2Title).addClass(PageTitle);

	var BGColor = $('#BGColor').html();
	var BG1 = $('#TopImage img').attr("src");
	var BG2 = $('#BottomImage img').attr("src");
	var BG2H = $('#BottomImage img').attr("height") + "px";
	var BG2P = $('#BottomPadding').html();
	if (BG2P){ BG2P += "px"; } else { BG2P = 0; }
	var TotalHeight = $('#TotalHeight').html() - 25 + "px";
	if (TotalHeight != null) { $('.ContentWrapper').css({'height': TotalHeight}); }
	if (BG1 || BG2) { $('.ContentWrapper').css({
		'background-color': '#' + BGColor,
		'background-image': 'url(' + BG1 + ')',
		'padding-bottom' : BG2P
	}); }
	
	if(BG2) { $('.ContentBottom').html('<img src="'+BG2+'" alt="" />'); }
	var BG2W = $('#.ContentBottom img').attr("width");
	if (BG2W > 900) { $('.ContentBottom').addClass('Wide'); }
	
	if ($('#BGDark').html() == 'dark') {
		$('.ContentWrapper .Normal').addClass('DarkBG');
		$('.NavBox2 .root .txt').css({ 'color' : '#fff' }).hover(
			function() {$(this).css({ 'color' : '' });},
			function() {$(this).css({ 'color' : '#fff' });}
		);
	}
	
	if($('.Page').hasClass('Home')) {
		$('.ContentWrapper').css('padding-top',0);
		$('.BannerPane .Container').css('margin-top',0);
	}
});
