/*
Script: prehome.js
		All Javascript files are managed by this script. 
		Based on site.js file from <http://www.mootools.net/>.

License:
        MIT-style license.

About:
		esl.js for mootools framework <http://www.mootools.net/> (c) 2007 Valerio Proietti, MIT-style license.
		Class created by Sylvain Barraud, Yvan Cottet and Gregory Paccaud, <http://www.esl.ch/>.
		Last modification, 14 december 2007.
		
Version: 1.0

Note:
		XHTML doctype is required.
		
*/

/*
Class: Site
		Inserts scripts into the [head] tag, if effect is needed (cf. action on $('divid')).
			
Events:

		Domready	Use for initialize start method.

Example:
		
		HTML page:
        	[head]
				<script language="Javascript" type="text/javascript" src="js/esl.js"></script>
        	[/head]
			
		JS file:
			Site.createObjects('JSfilename');
		
Note:
		Don't forget to insert "<script language="Javascript" type="text/javascript" src="js/mootools.js"></script>" into the head page before this js file.
*/

var Site = {
	/*
	Method: start
		-First method called on domready. This method instanciates necessary classes.
	*/
	start : function() {
	
		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
		
		//Analytics as asset
		Asset.javascript(gaJsHost+'google-analytics.com/ga.js');
		
		try {
			var pageTracker = _gat._getTracker("UA-7514044-1");
			pageTracker._trackPageview();
		} catch(err) {}
		
	},
	
	/*
	Method: initObjects
		-Create differents objects.
	*/
	createObjects : function(obj){
		switch (obj) {

		};
	}
};

var Prehome = new Class({
	initialize : function(){
		this.transition = false;
		this.setBehavior();
	},
	
	setBehavior : function(){
		var options = {
			wait : false
		};
		
		this.fade = [
			new Fx.Tween('french', options).set('opacity', 0),
			new Fx.Tween('german', options).set('opacity', 0),
			new Fx.Tween('italian', options).set('opacity', 0),
			new Fx.Tween('english', options).set('opacity', 0),
			new Fx.Tween('footer', {wait : false, duration : 200})
		];
		
		$('a-french').addEvents({
			mouseover : function(){
				this.fade[0].start('opacity', 1);
				this.fade[1].start('opacity', 0);
				this.fade[2].start('opacity', 0);
				this.fade[3].start('opacity', 0);
				this.fade[4].start('margin-top', 280);
			}.bind(this)
		});
		
		$('a-german').addEvents({
			mouseenter : function(){
				this.fade[0].start('opacity', 0);
				this.fade[1].start('opacity', 1);
				this.fade[2].start('opacity', 0);
				this.fade[3].start('opacity', 0);
				this.fade[4].start('margin-top', 280);
			}.bind(this)
		});
		
		$('a-italian').addEvents({
			mouseenter : function(){
				this.fade[0].start('opacity', 0);
				this.fade[1].start('opacity', 0);
				this.fade[2].start('opacity', 1);
				this.fade[3].start('opacity', 0);
				this.fade[4].start('margin-top', 280);
			}.bind(this)
		});
		
		$('a-english').addEvents({
			mouseenter : function(){
				this.fade[0].start('opacity', 0);
				this.fade[1].start('opacity', 0);
				this.fade[2].start('opacity', 0);
				this.fade[3].start('opacity', 1);
				this.fade[4].start('margin-top', 280);
			}.bind(this)
		});
	}
});

window.addEvent('domready',function() {
	Site.start();
	new Prehome;
});