var currentSplashImage = 7;

window.addEvent('domready', function(){

	new Lightbox();
	
	// Align the background image based on the height of the content tier.
	var cententTierSize = $('content-tier').getSize();
	if ( cententTierSize.y <= 888 )
	{
		$('content-tier').setStyle('background-position', 'center center');
	}
	
	if (pageId == 'home')
		{
			splashImageLoop = setInterval( "splashImageChanger(currentSplashImage)", 3000 );
		}

});


//////////////-------------- FUNCTIONS ----------------//////////////
function splashImageChanger(imageId)
	{
		var slide = new Fx.Morph('splashImage', {duration: 'long', transition: Fx.Transitions.Quad.easeOut});

		switch(imageId)
		{
			case 1:
				slide.start({left:-640});// where it's going to slide to
				currentSplashImage = 2;
				break;   
			case 2:
				slide.start({left:-1280});
				currentSplashImage = 3;
				break;
			case 3:
				slide.start({left:-1920});
				currentSplashImage = 4;
				break;
			case 4:
				slide.start({left:-2560});
				currentSplashImage = 5;
				break;
			case 5:
				slide.start({left:-3200});
				currentSplashImage = 6;
				break;
			case 6:
				slide.start({left:-3840});
				currentSplashImage = 7;
				break;
			case 7: // same as 1
				$('splashImage').setStyle('left',0);
				slide.start({left:-640});
				currentSplashImage = 2;
				break;
		}
	};
