$().ready(function() {

	$.preload([ 'bottom, gradient, tile, top'], {
	    base:'/assets/chskv2/images/lpHoverDs/',
	    ext:'.png'
	});
	// set some minimum dimensions - techincally won't really matter anymore since the content is static
	var minWidth = 994;
	var minHeight = 736;
	var viewportWidth = $(window).width();
	if (viewportWidth < minWidth) { // min-width
		viewportWidth = minWidth;
	}
	var viewportHeight = $(window).height();
	if (viewportWidth < minHeight) { // min-height
		viewportHeight = minHeight;
	}
	// resize the background div so that it stretches the entire width/height of the viewport
	$("#background, #background img").css({
		'width':viewportWidth + 'px',
		'height':viewportHeight + 'px'
	});
	// on window resize, the background div needs to resize as well
	$(window).resize(function() { 
		var newViewportWidth = $(window).width();
		if (newViewportWidth < minWidth) { // min-width
			newViewportWidth = minWidth;
		}
		var newViewportHeight = $(window).height();
		if (newViewportHeight < minHeight) { // min-height
			newViewportHeight = minHeight;
		}
		$("#background, #background img").css({
			'width':newViewportWidth + 'px',
			'height':newViewportHeight + 'px'
		});
	});
	// using the suckerfish plugin again since the full screen video is gone
	// ie couldn't handle suckerfish plus full-screen flash video
	// the right aligned menus are intentional and the logic is in the supersubs plugin
    $("ul.sf-menu").supersubs({ 
        minWidth:12,
        maxWidth:27,
        extraWidth:1
    }).superfish({
	    hoverClass:'sfHover',
		delay:500,
		animation:{opacity:'show'},
		speed:'fast', 
	    autoArrows:false,
	    dropShadows:false,
	    disableHI:false
	});
	// simulate the drop down hover state to affect active/hover state
	$('#nav-home a').hover(
		function() {
			$(this).parent().addClass('sfHover');
		},
		function() {
			$(this).parent().removeClass('sfHover');
		}
	);
	// equalize the height of the landing page blocks
	$("#landing .lpLink").css({'height':equalize('#landing ol', 'li', '.lpLink')});
	$("a[rel='external']").click(function() {
		var page = $(this).attr('href');
		window.open(page,'newWindow');
		return false;
	});
	$("#landing li").click(function() {
		var href = $(this).find('a').attr('href');
		window.location.href = href;
	});
});