
// Prepare for the dynamic animations
window.addEvent('domready', function() {
    // *** push logo out of view
	var idLogo = $('idLogoCleanFreaks');
	$(document.body).setStyle('overflow-x', 'hidden'); //prevent scroll bars appearing when we are animating. 
	idLogo.setStyle('position','relative'); // shift it off screen
	idLogo.setStyle('left', window.getSize().x-idLogo.getPosition().x); // shift it off screen
	// *** hide header icons
	var idHeaderIcons = $('idHeaderIcons').getElements('img');
	idHeaderIcons.setStyle('opacity','0');
});




// Perform animations
window.addEvent('load', function() {
	var idLogo = $('idLogoCleanFreaks');
	var LogoFx = new Fx.Tween(idLogo, {duration: 2000, transition: Fx.Transitions.Bounce.easeOut});
	LogoFx.start(
		'left','0px'
		).chain(function() {
			// re-activate scrolling
			$(document.body).setStyle('overflow-x', 'auto'); 
			
			// animate header icons
			var fx = new Fx.Tween($('idHeaderIcons').getElements('img')[2]);
			fx.start(
				'opacity', 1
				).chain(function() {
			
				var fx = new Fx.Tween($('idHeaderIcons').getElements('img')[1]);
				fx.start(
					'opacity', 1
					).chain(function() {
			
					var fx = new Fx.Tween($('idHeaderIcons').getElements('img')[0]);
					fx.start(
						'opacity', 1
						);
					})
				})
			
		
		})
});