//set the fade speed
var masterFadeSpeed = 3000;
var childFadeSpeed = 1000;
var loadType = 2;

//wait til the DOM is loaded
$(document).ready(function() {
	setTimeout("startLoad()",1000);
});

function startLoad() {
	$('#loader').remove();
	if( loadType == 1 || loadType == 2 ) {
		stallLoad($('.container:first'));
	} else {
		$('.container').each( function(i) {
			$(this).find(".containerInner").fadeIn( masterFadeSpeed, function() {
				$(this).parent().find(".loader").remove();
				loadDivs($(this).children(":first"));
			});
		});
	}
}
function stallLoad(elem) {
	elem.find(".containerInner").fadeIn( masterFadeSpeed, function() {
		elem.find(".loader").remove();
		loadDivs($(this).children(":first"));
		if( loadType == 1 ) {
			$(elem).next().length && stallLoad( $(elem).next() );
		}
	});
}
function loadDivs(elem) {
	//start the fade
	elem.children(":first").fadeIn( childFadeSpeed, function() {
		if( loadType == 2 ) {
			if( $(elem).next().length ) {
				loadDivs( $(elem).next() );
			} else {
				$(elem).parent().parent().next().length && stallLoad( $(elem).parent().parent().next() );
			}
		} else {
			$(elem).next().length && loadDivs( $(elem).next() );
		}
	});
}
