$.preload('/_images/basebarcaps_verticalbarbody.png','horizontalbarbody_cornerjog.png','mainmenu-1.png','mainmenu-2.png','mainmenu-3.png','mainmenu-4.png','mainmenu-5.png','mainmenu-6.png','mainmenu-7.png','mainmenu-8.png','navigation-bkd.png');

$(window).bind("load", function() { 
    //var timeout = setTimeout(function() {$("#content").find("img").trigger("finishImgLoad")}, 500);
	//var timeout2 = setTimeout("updateGalleryWidth()", 10000);
	updateGalleryWidth();
	$("#contentWrapper").css("overflow","auto");
	CSBfleXcroll('contentWrapper');
});

$(document).ready(function(){
	
	/*
	$("#content > img:gt(5)").lazyload({
	    placeholder: "/_images/loading_on_white.gif", 
	    event: "finishImgLoad" 
	});
	*/
	
	setContentWidth();
	verticalCenter("#outerWrapper");
	

	//background rollovers setup
	$("#mainMenu li a:contains(" + $("body").attr("class") + ")").parent().addClass("current");
	
	var tEq = $("#mainMenu li.current a").parent().prevAll().length;
	if ( tEq > 3 ){ tEq += 1 }
	if ( tEq > 7 ){ tEq += 1 }
	var newP = (tEq * 22) + 264;
	if ( tEq > 3 ){ newP -= 10 }
	if ( tEq > 7 ){ newP -= 12 }
	$("#marker").css({
		top: newP
	});
	$("#mainMenu li:not(.current) a").hover(
		function () {
			//var h = "0px -" + $(this).css("height");
			//$(this).css("background-position",h);
			
			var tEq = $(this).parent().prevAll().length;
			if ( tEq > 3 ){ tEq += 1 }
			if ( tEq > 7 ){ tEq += 1 }
			var newP = (tEq * 22) + 264;
			if ( tEq > 3 ){ newP -= 10 }
			if ( tEq > 7 ){ newP -= 12 }
			
			$("#marker").stop().animate({
				top: newP
			}, 500);
		},
		function () {
			//$(this).css("background-position","0px 0px");
			
			var tEq = $("#mainMenu li.current a").parent().prevAll().length;
			if ( tEq > 4 ){ tEq += 1 }
			if ( tEq > 7 ){ tEq += 1 }
			var newP = (tEq * 22) + 264;
			if ( tEq > 3 ){ newP -= 10 }
			if ( tEq > 7 ){ newP -= 12 }
			
			$("#marker").stop().animate({
				top: newP
			}, 500);
		}
	);

});
$(window).resize(function(){
	setContentWidth();
	verticalCenter("#outerWrapper");
});