
// Prepare for the dynamic animations

window.addEvent('domready', function() {
    // *** push logo out of view
	var idSplashWrapper = $('idSplashWrapper');
	var idSplashImages = idSplashWrapper.getElements('img');
	var idMainMenu = $('idMainMenu');
	idMainMenu.setStyle('position', 'relative');
	idMainMenu.setStyle('left', idMainMenu.getSize().x);
	
	idMainMenu.setStyle('overflow', 'hidden');
	idMainMenu.setStyle('display', 'none');
	idSplashImages.setStyle('display','none');
	idSplashWrapper.store('oldheight',idSplashWrapper.getSize().y);
	idSplashWrapper.store('oldwidth',idSplashWrapper.getSize().x);
	idSplashWrapper.setStyle('overflow','hidden'); 
	idSplashWrapper.setStyle('height','0px'); 
	idSplashWrapper.setStyle('width','0px'); 
	
	
	
	
	
	

	
	
});

window.addEvent('domready', function() {
	var idSplashWrapper = $('idSplashWrapper');
	var idSplashImages = idSplashWrapper.getElements('img');
	
	idSplashImages.addEvent('mouseover', function() {
		var myFx = new Fx.Tween(this, {duration: 'short'});
		myFx.start('height', 103+5).chain(function() {
			
		});
	});
	
	idSplashImages.addEvent('mouseout', function() {
		var myFx = new Fx.Tween(this, {duration: 'short'});
		myFx.start('height', 103-5)
	});
	
	
	//*** replace main link onfocus with an animated one
	var idMainMenuLinks = $('idMainMenu').getElements('a:not(.clsLiActive)');
	
	idMainMenuLinks.setStyle('color', '#000000'); // add black color so that tweening knows starting value
	idMainMenuLinks.set('tween', {duration: 'short'});
	idMainMenuLinks.addEvent('mouseover', function() {
		this.tween('color', '#dddddd');
		});
	idMainMenuLinks.addEvent('mouseout', function() {
		this.tween('color', '#000000');
		});
	
});


// Perform animations
window.addEvent('load', function() {
	var idSplashWrapper = $('idSplashWrapper');
	
	var LogoFx = new Fx.Tween(idSplashWrapper, {duration: 2000, transition: Fx.Transitions.Back.easeOut});
	
	LogoFx.start('width', idSplashWrapper.retrieve('oldwidth')).chain(function() {
					var myFx = new Fx.Tween(idSplashWrapper);
					myFx.start('height', idSplashWrapper.retrieve('oldheight')).chain(function() {
						var elsSplashImages = idSplashWrapper.getElements('img');
						elsSplashImages.setStyle('opacity',0);
						elsSplashImages.setStyle('display','inline');			
						
						elsSplashImages.tween('opacity', 1);
						
						var idMainMenu = $('idMainMenu');
						idMainMenu.setStyle('display', 'block');
						idMainMenu.tween('left', 0);
						
						$('idImgsWrapper').setStyle('height', 107);
					});
				});
});
