////////////////////////////////////////////////// FUNCTION
function testSlide(slide_num,count){
		if(slide_num <= 1){ 
			$$('.fleche_left').setStyle('display', 'none');
			$$('.fleche_right').setStyle('display', 'block');
			slide_num = 1;
		}else{
			$$('.fleche_left').setStyle('display', 'block');
			if ($("slide_"+(slide_num+count))){ 
				$$('.fleche_right').setStyle('display', 'block');
			}else{
				$$('.fleche_right').setStyle('display', 'none');
			}
		}
	}

////////////////////////////////////////////////// START
window.addEvent('domready', function(){

////////////////////////////////////////////////// RESEAUX
//$$('#reseaux').set('morph', {duration: 'long', transition: 'elastic'});
$('reseaux').set('tween', {transition: Fx.Transitions.Back.easeOut});

$$('#reseaux #reseaux_btn, #reseaux #reseaux_content').addEvents({
														  
			mouseenter: function(){
				// This morphes the opacity and backgroundColor
				//this.morph({top:0});
				$('reseaux').tween('top', -20);

				
			},
			mouseleave: function(){
				// Morphes back to the original style
				//this.morph({top:-200});
				$('reseaux').tween('top', -180);
			}
			/*click: function(){
				// Morphes back to the original style
				$$('.sousmenu').morph({opacity:0});
			}*/
			
});
$$('.img_hover').addEvents({
						   


														  
			mouseenter: function(){
				
				src = this.get('src');
				new_src= src.substring(0,src.length-4);
				extension=src.substring(src.lastIndexOf("."));
				//alert(src+ ' '+new_src);
				this.set('src', new_src+'_2'+extension);

				
			},
			mouseleave: function(){
				
				src = this.get('src');
				new_src= src.substring(0,src.length-6);
				extension=src.substring(src.lastIndexOf("."));

				//alert(src+ ' '+new_src);
				this.set('src', new_src+extension);
				
			}
			
});

//var midSlide = new Fx.Slide('mid').hide().toggle();					   		
//(function(){ midSlide.slideIn(); }).delay(2000);
////////////////////////////////////////////////// slide
$$('.lien_references, #slide_acueil a').set('tween',{duration: 500});
$$('.lien_references, #slide_acueil a').addEvents({
			mouseenter: function(){

				this.tween('opacity', 0.6);
		
			},
			mouseleave: function(){
				
				this.tween('opacity', 1);
				
			}
			
});


////////////////////////////////////////////////// MENU

$$('#menu_rubrique .lien_rub[rel*='+page+']').getParent('li').setStyle('border-bottom', '#c70000 solid 4px');
$$('#menu_rubrique .lien_rub[rel*='+page+']').setStyle('color', '#000000');


$$('.sousmenu').set('tween',{duration: 0});
$$('.sousmenu').tween('opacity', 0);

//$$('.sousmenu').set('tween',{duration: 500});
//$$('.sousmenu').set('tween',{duration: 500});
//$$('.sousmenu').fade('hide');
	
	if( page == 'reference'){	
		$$('.sousmenu[id*=reference]').tween('opacity',1);	
	}
	
	if($$('.sousmenu[id*='+page+']')){
		$$('.sousmenu[id*='+page+']').tween('opacity',1);
		//$$('.sousmenu[id*='+page+']').fade('show');
	}
	

	
		//$$('#menu_reference').morph({opacity:1});
	
	
		$$('#menu_rubrique ul[class*=sousmenu]').getParent('li').addEvents({
														  
			mouseenter: function(){
				// This morphes the opacity and backgroundColor
				//this.getChildren('ul').morph({opacity:1});

				this.getChildren('ul').tween('opacity', 1);
				$$('.sousmenu li').setStyle('float', 'left');
				
			},
			mouseleave: function(){
				// Morphes back to the original style
				$$('.sousmenu').tween('opacity', 0);
			},
			click: function(){
				// Morphes back to the original style
				$$('.sousmenu').tween('opacity', 0);
			}
			
		});

////////////////////////////////////////////////// call multiBox
	var initMultiBox = new multiBox({
		mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
		container: $(document.body),//where to inject multiBox
		//descClassName: 'multiBoxDesc',//the class name of the description divs
		path: './Files/',//path to mp3 and flv players
		useOverlay: true,//use a semi-transparent background. default: false;
		maxSize: {w:2000, h:2000},//max dimensions (width,height) - set to null to disable resizing
		addDownload: false,//do you want the files to be downloadable?
		pathToDownloadScript: './Scripts/ForceDownload.asp',//if above is true, specify path to download script (classicASP and ASP.NET versions included)
		addRollover: true,//add rollover fade to each multibox link
		addOverlayIcon: true,//adds overlay icons to images within multibox links
		addChain: true,//cycle through all images fading them out then in
		recalcTop: true//subtract the height of controls panel from top position
		//addTips: true//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
	});



////////////////////////////////////////////////// ACCORDION	
	//create our Accordion instance
	var myAccordion = new Accordion($('accordion'), '.toggler', '.element', {
		opacity: false,
		display  :2,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#000000');
		},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#999999');
		}
	});	
////////////////////////////////////////////////// END
});
