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) {}
		
	}
};

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($$('#logos img')[0], options).set('opacity', 0),
			new Fx.Tween($$('#logos img')[1], options).set('opacity', 0),
			new Fx.Tween($$('#logos img')[2], options).set('opacity', 0),
			new Fx.Tween($$('#logos img')[3], options).set('opacity', 0),
			new Fx.Tween('footer', {wait : false, duration : 200})
		];
		
		$('a-french').addEvents({
			mouseover : function(){
				$$('.s').removeClass('s');
				$('a-french').addClass('s');
				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('opacity', 1);
				this.fade[5].start('opacity', 0);
				this.fade[6].start('opacity', 0);
				this.fade[7].start('opacity', 0);
				this.fade[8].start('margin-top', 321);
			}.bind(this)
		});
		
		$('a-german').addEvents({
			mouseenter : function(){
				$$('.s').removeClass('s');
				$('a-german').addClass('s');
				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('opacity', 0);
				this.fade[5].start('opacity', 1);
				this.fade[6].start('opacity', 0);
				this.fade[7].start('opacity', 0);
				this.fade[8].start('margin-top', 321);
			}.bind(this)
		});
		
		$('a-italian').addEvents({
			mouseenter : function(){
				$$('.s').removeClass('s');
				$('a-italian').addClass('s');
				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('opacity', 0);
				this.fade[5].start('opacity', 0);
				this.fade[6].start('opacity', 1);
				this.fade[7].start('opacity', 0);
				this.fade[8].start('margin-top', 321);
			}.bind(this)
		});
		
		$('a-english').addEvents({
			mouseenter : function(){
				$$('.s').removeClass('s');
				$('a-english').addClass('s');
				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('opacity', 0);
				this.fade[5].start('opacity', 0);
				this.fade[6].start('opacity', 0);
				this.fade[7].start('opacity', 1);
				this.fade[8].start('margin-top', 321);
			}.bind(this)
		});
	}
});

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