var configuratorVU = new Class(
{
	/*************************************************************************************************************************
	 * Variable
	 *************************************************************************************************************************/
	
	
	
	/*************************************************************************************************************************
	 * Constructor
	 *************************************************************************************************************************/
	initialize: function()
	{
		this.load();
	},
	
	
	
	/*************************************************************************************************************************
	 * Evenements
	 *************************************************************************************************************************/
	load: function()
	{
		//ecran de chargemebnt
		$$('a.next').addEvent('click', this.save_config_overlay.pass([], this));
		
		//leaver alert
		if ( $('alertBox_ok') != undefined )
		{
			$('alertBox_ok').addEvent('click', function(){
				$('alertBox').setStyle('display','none');
				new Fx.Tween("Overlay",
				{
					property: 'opacity',
					duration: 'normal'
				}).start(0.7,0.0);
			});
		}
		
		//evenements pour les pop up
		SqueezeBox.assign($$('.popup_menu'), {
			parse: 'rel'
		});
		
		//evenements pour les tooltips
		$$('.tooltip_info').each(function(el)
			{
				el.addEvents({
					'mouseenter':	this.show_tooltip.pass([el], this),
					'mouseleave':	this.hide_tooltip.pass([el], this)
				});
			}.bind(this));
	},
	
	
	
	/*************************************************************************************************************************
	 * Functions
	 *************************************************************************************************************************/
	//
	//montrer le tooltip
	show_tooltip: function(el)
	{
		var decal = $('divoption').getScroll().y;
		
		$('tooltip').setStyle('top',$(el).getPosition().y-15+decal);
		$('tooltip').setStyle('left',$(el).getPosition().x+22);
		
		//ici le code pour la mise a jour de l'info du tooltip !
		var O = $H(Opt);
		$('tooltip').getElement('.Description').set('html', O[el.id]['info']);
		
		$('tooltip').setStyle('opacity',0);
		$('tooltip').setStyle('display','block');
		$('tooltip').fade(1);
	},
	
	//cacher le tooltip
	hide_tooltip: function(el)
	{
		$('tooltip').fade(0);
	},
	
	save_config_overlay: function()
	{
		if ( canGoNext )//on peut passer a letape suivante
		{
			new Fx.Tween("Message",
			{
				property: 'opacity',
				duration: 'short'
			}).start(0.0,0.8);
			new Fx.Tween("Overlay",
			{
				property: 'opacity',
				duration: 'normal'
			}).start(0.0,0.7);
		}
		else
		{
			new Fx.Tween("Overlay",
			{
				property: 'opacity',
				duration: 'normal'
			}).start(0.0,0.7);
			$('alertBox').setStyle('display','block');
		}
	},
	
	fonction_test: function()
	{
		
	},
	
	fin_: function()
	{
		
	}
	
	
	
	
});//fin class
	
	
	
//dom ready
window.addEvent('domready', function() {
	cfg_vu = new configuratorVU();
});

//load ready
window.addEvent('load', function() { //lorque tout la page html et les image sont chargees
	//animation now loading -> on enleve l'overlay avec l'image lorque le chargement est termine
		new Fx.Tween("Message",
		{
			property: 'opacity',
			duration: 'long'
		}).start(0.8,0);
		new Fx.Tween("Overlay",
		{
			property: 'opacity',
			duration: 'long'
		}).start(0.7,0);
});
