// JavaScript Document
$(document).ready(function(){ // When the page is ready

	$('.fadeBlock img:gt(0)').css('visibility','visible');
	$('.fadeBlock2 img:gt(0)').css('visibility','visible');
	$('.fadeBlock3 img:gt(0)').css('visibility','visible');
	
	//set when to start the rotations of each image (1,2,3)
	//by start 1 second later than previous, they fade in sequence

	setTimeout('nextSite();start1()',2000);
	setTimeout('nextSite2();start2()',4000);
	setTimeout('nextSite3();start3()',6000);
	
	var preload1 = new Image();
	preload1.src = '';
	
	var preload2 = new Image();
	preload2.src = '';
	
	var preload3 = new Image();
	preload3.src = '';
	
	
	
	}); // close doc ready

function start1(){
	slideInt = window.setInterval('nextSite()',6000);
}

function start2(){
	slideInt2 = window.setInterval('nextSite2()',6000);

}

function start3(){
	slideInt3 = window.setInterval('nextSite3()',6000);
}

var x=1;
var x2=1;
var x3=1;
var stopInt=0;
function nextSite(){
	if(x>=$('.fadeBlock img').size() ){
		//clearInterval(slideInt);
		x=0;
		}
	$('.fadeBlock  img:eq('+x+')').fadeIn(1000);
	$('.fadeBlock img:lt('+x+')').fadeOut(1000);
	$('.fadeBlock img:gt('+x+')').fadeOut(1000);
	x++;
	}

function nextSite2(){
	if(x2>=$('.fadeBlock2 img').size() ){
		//clearInterval(slideInt);
		x2=0;
		}
	$('.fadeBlock2  img:eq('+x2+')').fadeIn(1000);
	$('.fadeBlock2 img:lt('+x2+')').fadeOut(1000);
	$('.fadeBlock2 img:gt('+x2+')').fadeOut(1000);
	x2++;
	}

function nextSite3(){
	if(x3>=$('.fadeBlock3 img').size() ){
		//clearInterval(slideInt);
		x3=0;
		}
	$('.fadeBlock3  img:eq('+x3+')').fadeIn(1000);
	$('.fadeBlock3 img:lt('+x3+')').fadeOut(1000);
	$('.fadeBlock3 img:gt('+x3+')').fadeOut(1000);
	x3++;
	}


var slideInt;
var slideInt2;
var slideInt3;