

window.onload = function() {
	if ($('#home').html()) {
		clickableCHBanners();
		setHomePageBackground();
		hideHomePageElements();
		var wait = setTimeout('animate()', 1000);
	}
}


function isIE7() {
	return (BrowserDetect.browser == 'Explorer' && BrowserDetect.version > 6.9);
}


function clickableCHBanners() {
//	$('.chbinner').css('cursor', 'pointer');
//	$('.chbinner').bind('click', function() {
//		var anchorHref = $('a', this).attr('href');
//		if (anchorHref) {
//			window.location = anchorHref;	
//		}
//	});
}

/*
function setHomePageBackground() {
	var ch = $('#ContentHeader').height();
	var wh = $(window).height();
	var sh = $('#sidebar').height();
	var co = 61; //contentwrapper offset
	
	if (wh > sh && wh > (ch + co)) {
		$('#ContentHeader').height(wh - co);
	} else if (sh > (ch + co)) {
		$('#ContentHeader').height(sh - co);
	}
	$(window).resize(setHomePageBackground);
}
*/

function setHomePageBackground() {
	var ch = $('#ContentHeader').height();
	var cw = $('#ContentWrapper').height();
	var co = 61; //contentwrapper offset
	
	if (ch < cw) {
		$('#ContentHeader').css('min-height',cw);
	}
}


function hideHomePageElements() {
	$('#ContentHeader').css('opacity', 0);
	$('#ContentHeader').css('visibility', 'visible');
	if (!isIE7()) {
		$('.ContentHeaderBanner').css('opacity', 0);
}
}


function animate() {
	$('#ContentHeader').fadeTo(1500, 1);
	if (!isIE7()) {
		$('.ContentHeaderBanner').fadeTo(1000, 0, function(){ $('.ContentHeaderBanner').fadeTo(1000, 1); });
	}
}

