$(document).ready(function() {

	var srcArray = new Array();
	var i = 0;

	$('.itemText p em img').attr('src', function(get) {
		srcArray[i] = this.src;
		i++;
	});

	$.merge(srcArray, [document.URL + 'i/collage2.jpg']);

	$.preload(srcArray, {
		onFinish:splashScreen,
		threshold:2
	});

});

function splashScreen() {

	$('#mainDivOverlay').fadeTo(8000, 0.1, function() {
		$('.home').css({backgroundImage:'url(/i/collage.jpg)'});
		$('#mainDivOverlay').fadeTo(800, 0.75, function() {
			$('div.home').css({backgroundImage:'url(/i/collage2.jpg)'});
			$('.t1').fadeIn(3000, function() {
				$('.t2').fadeIn(3000, function() {
					$('.t3').fadeIn(3000, function() {
						$('.t4').fadeIn(3000, function() {
							$('.t5').fadeIn(4000, function() {
							$('.itemText p em').hide(800);
							$('#mainDivOverlay').fadeTo(5000, 0, function() {
								/*
								$('.home').css({'background-image':'url(/i/collage.jpg)'});
								$('#mainDivOverlay').fadeTo(2000, 10);
								splashScreen();
								*/

							/* onMouseOver/onMouseOut func */
								$('.itemText p').hoverIntent(function() {

									var thisClass = $(this).attr('class');

									$('#mainDivOverlay').fadeTo(800, 0.75, function() {
										$('.' + thisClass + ' em').fadeIn(1000);
									});

								},function() {

									var thisClass = $(this).attr('class');

									$('#mainDivOverlay').fadeTo(800, 0, function() {
										$('.' + thisClass + ' em').fadeOut(1000);
									});

								});
							/* end of onMouseOver/onMouseOut func */

							});
							});
						});
					});
				});
			});
		});
	});

}

/*
$(document).ready(function() {


	$('.itemText p').hover(function() {
	
			var thisClass = $(this).attr('class');
			$('#mainDivOverlay').fadeTo(800, 0.75);
			$('.' + thisClass + ' em').fadeIn(1500);

		},function() {

			var thisClass = $(this).attr('class');

			$('#mainDivOverlay').fadeTo(800, 0);
			$('.' + thisClass + ' em').fadeOut(1500);

	});

});
*/


/*
$(document).ready(function() {
	splashScreen();
});
*/

