
var doSplash = function () {

	// begin by fading in the backgrounds quickly
	new Effect.Appear('background-grey', {
		duration: 0,
		queue: { position: 'end', scope: 'background' }
	});
	new Effect.Appear('background', {
		duration: 0,
		queue: { position: 'end', scope: 'background' }
	});

	// then fade in the splash content together (grey version visible)
	new Effect.Parallel([
		new Effect.Appear('photograph', { sync: true, transition: Effect.Transitions.EaseFrom }),
		new Effect.Appear('welcome', { sync: true, transition: Effect.Transitions.EaseFrom })
	],{
		delay: 0.5,
		duration: 2.1,
		queue: { position: 'end', scope: 'photo' }
	});

	// then begin transition the transition of the grey photo to color
	new Effect.Fade('photo-grey', {
		transition: Effect.Transitions.EaseFrom,
		duration: 7.5,
		queue: { position: 'end', scope: 'photo' }
	});

	// then pickup the background transition to color
	new Effect.Parallel([
		new Effect.Fade('welcome-grey', { sync: true, transition: Effect.Transitions.EaseFrom }), 
		new Effect.Fade('background-grey', { sync: true, transition: Effect.Transitions.EaseFrom })
	],{
		delay: 0.5,
		duration: 4.5,
		queue: { position: 'end', scope: 'background' }
	});

	// and finally do the fade out
	new Effect.Parallel([
		new Effect.Fade('background', { sync: true, transition: Effect.Transitions.EaseFrom }),
		new Effect.Fade('welcome', { sync: true, transition: Effect.Transitions.EaseFrom }), 
		new Effect.Fade('photograph', { sync: true, transition: Effect.Transitions.EaseFrom })
	],{
		duration: 4.5,
		queue: { position: 'end', scope: 'photo' },
		afterFinish: function () { $('splash').setStyle({ display: 'none' }); }
	});

};

var endSplash = function () {

	// terminate any effects currently queued
	var queue = Effect.Queues.get('background');
	queue.each(function(e) { e.cancel() });
	var queue = Effect.Queues.get('photo');
	queue.each(function(e) { e.cancel() });

	// and fade out splash quickly
	new Effect.Parallel([
		new Effect.Fade('background-grey', { sync: true, transition: Effect.Transitions.EaseFrom }),
		new Effect.Fade('background', { sync: true, transition: Effect.Transitions.EaseFrom }),
		new Effect.Fade('welcome-grey', { sync: true, transition: Effect.Transitions.EaseFrom }), 
		new Effect.Fade('welcome', { sync: true, transition: Effect.Transitions.EaseFrom }), 
		new Effect.Fade('photo-grey', { sync: true, transition: Effect.Transitions.EaseFrom }),
		new Effect.Fade('photograph', { sync: true, transition: Effect.Transitions.EaseFrom })
	],{
		duration: 1,
		afterFinish: function () { $('splash').setStyle({ display: 'none' }); }
	});

};
