// JavaScript Document
$(document).ready(function(){
	$('#bg').imgpreload(function(){
		$('#bg').fadeIn();
	});
	
	$('.loading img').imgpreload(function(){
		$('.loading img').hide();
		$('.loading img').css('visibility','visible');
		$('.loading img').fadeIn();
		
	});
	
	$('.loading').imgpreload(function(){
		$('.loading').hide();
		$('.loading').css('visibility','visible');
		$('.loading').fadeIn();
		
	});
	
});


function coverSlide(){
	jQuery('.cover').maxImage({
		maxFollows:'both',
		overflow:'hidden', // [NOTE: setting to auto makes maxImage less accurate... use at your own risk], <br>
		position:'absolute',
		slideShow: true,
		slideDelay: 6,
		isBackground:true,
		zIndex:-10,
	    loaderClass:'loader',
		verticalAlign:'center',
		horizontalAlign:'center',
		maxAtOrigImageSize:false,
		onImageShow: function(){
			if ($.browser.msie) $("#content").show();
			else $("#content").fadeIn(300);
		}
	});
}

function coverNormal(){
	jQuery('.cover').maxImage({
		maxFollows:'both',
		overflow:'hidden', // [NOTE: setting to auto makes maxImage less accurate... use at your own risk], <br>
		position:'absolute',
		isBackground:true,
		zIndex:-10,
	    loaderClass:'loader',
		verticalAlign:'center',
		horizontalAlign:'center',
		maxAtOrigImageSize:false,
		onImageShow: function(){
			if ($.browser.msie) $("#content").show();
			else $("#content").fadeIn(300);
		}
	});
}

function cover(slide){
	if (slide) coverSlide();
	else coverNormal();
}
