
/* +++++++++++++++++++++++++++++++++++
   ++[/FONCTIONS DE SOLUTIONS       ]++
   ++++++++++++++++++++++++++++++++ */

window.addEvent('domready', function()
{
	//$ XXXXXXXXXXXXXXX
	if($('attentesBtn')){
		initSolOnglets = function(el){
			var btnH = $(el+'Btn').getStyle('height').toInt();
						
			var spans = $(el+'Btn').getElements('span');
			for(i=0; i<spans.length; i++){
				if(spans[i].hasClass('hov')){
					spanHov = spans[i];
				}
				if(spans[i].hasClass('off')){
					spanOff = spans[i];
				}
			}
			spanOff.Fx = new Fx.Morph(spanOff, { duration:200 });
			spanHov.Fx = new Fx.Morph(spanHov, { duration:200 });
			
			spanOff.Fx.start({'top':btnH});
			spanHov.Fx.start({'top':0});
			
			$(el+'Btn').removeClass('move');
			$(el+'Btn').addClass('on');
			
			_oldId = el;
		}
		
		$$('.move').each(function(el)
		{
			
			el.commonid = String(el.id).replace('Btn','');
			
			el._newBtn = $(el.commonid+'Btn');
			el._newPage = $(el.commonid);
			
			el.btnH = el.getStyle('height').toInt();
			
			el.spans = el.getElements('span');
			for(i=0; i<el.spans.length; i++){
				if(el.spans[i].hasClass('hov')){
					el.spanHov = el.spans[i];
				}
				if(el.spans[i].hasClass('off')){
					el.spanOff = el.spans[i];
				}
			}
			el.spanOff.Fx = new Fx.Morph(el.spanOff, { duration:200 });
			el.spanHov.Fx = new Fx.Morph(el.spanHov, { duration:200 });
			
			el.addEvent('mouseenter', function()
			{
				if(!el.hasClass('on')){		
					el.spanOff.Fx.cancel();
					el.spanHov.Fx.cancel();
					el.spanOff.Fx.start({'top':el.btnH});
					el.spanHov.Fx.start({'top':0});
				}
			});
	
			el.addEvent('mouseleave', function()
			{
				if(!el.hasClass('on')){					
					el.spanOff.Fx.cancel();
					el.spanHov.Fx.cancel();
					el.spanOff.Fx.start({'top':10});
					el.spanHov.Fx.start({'top':el.btnH});
				}
			});
	
			
		});
		
		switchCarrousel = function(sens, id){
			var pas = 597;
			var fichepas = id-2;
			$('pages-slide').Fx = new Fx.Tween($('pages-slide'), { duration:400 });
			idBox = $('detail').getElement('.projector');
			
			if(sens==1){
				PowerSlide(idBox, fichepas, 1);	
				$('pages-slide').Fx.start('left',-pas+'px');
			} else {
				$('pages-slide').Fx.start('left',0);
				PowerSlide(idBox, 0, 0);				
			}
		}
		
		
		
	}
		var aMinceur = $$('.btn-imc');
		var aCoaching = $$('.btn-coaching');
		if(aMinceur.length > 0){
			aMinceur[0].setStyle('opacity',0);
			
			imcFXstart = new Fx.Tween(aMinceur[0]);
			imcFXend = new Fx.Tween(aMinceur[0]);
			coachingFXstart = new Fx.Tween(aCoaching[0]);
			coachingFXend = new Fx.Tween(aCoaching[0]);
			
			imcFXstart.addEvent('complete', function(){
				coachingFXstart.start('opacity',1);
			});
			coachingFXstart.addEvent('complete', function(){
				(function(){coachingFXend.start('opacity', 0);}).delay(4000);
			});
			coachingFXend.addEvent('complete', function(){
				imcFXend.start('opacity', 1);
			});
			imcFXend.addEvent('complete', function(){
				(function(){imcFXstart.start('opacity', 0);}).delay(4000);
			});
			
			(function(){imcFXstart.start('opacity', 0);}).delay(4000);
		}
});
