function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });
 
    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 4, //seconde avant auto scroll 
        scroll: 1, //nbre d'item à scroller 
        wrap: 'both',
        initCallback: mycarousel_initCallback
    });
});





$(document).ready(function(){ 

	//Examples of how to assign the ColorBox event to elements
	$("a[rel='example1']").colorbox();
	$("a[rel='example2']").colorbox({transition:"fade"});
	$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
	$("a[rel='example4']").colorbox({slideshow:true});
	$(".example5").colorbox(); 
	$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
	$(".parcours").colorbox({iframe:true, innerWidth:600, innerHeight:420});
	$(".diapo").colorbox({width:"840px", height:"630px", iframe:true});
	$(".video").colorbox({transition:"none" , width:"555px", height:"420px", iframe:true});
	$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
	$(".example9").colorbox({
		onOpen:function(){ alert('onOpen: colorbox is about to open'); },
		onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
		onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
		onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
		onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
	});
	
	//Example of preserving a JavaScript event for inline calls.
	$("#click").click(function(){ 
		$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
		return false;
	});






});


 


function radio(){

	window.open('radio.php','radio','width=433,height=340,toolbar=no,menubar=no, location=no, resizable=no, scrollbars=yes,status=no,left=100,top=100');		

}

function change_onglet(k,nb){

	
	for( i = 1 ; i<= nb ; i++ ){
		document.getElementById('onglet'+ i ).className = 'onglet';
		document.getElementById('txtonglet'+ i ).style.display = 'none';

	}
	
	document.getElementById('onglet'+ k ).className = 'onglet_select';  
	document.getElementById('txtonglet'+ k ).style.display = 'block';


}

function setFd(){

	document.getElementById('flash_bg').style.height=document.getElementById('contenaire').offsetHeight+'px';

	var so = new SWFObject("fd.swf?temp=17", "mybg", "100%",document.getElementById('contenaire').offsetHeight , "8", "#ffffff");

	so.addParam("wmode", "transparent" );

	so.addParam("scale", "noscale");
	so.addParam("quality", "high");
	so.addParam("AllowScriptAccess","always");
	so.addParam("swliveconnect","true");

   so.write("flash_bg");
   
} 

timer=0;

function init() {
	timer = setTimeout("initialise()",500);
	
}

function initialise(){
	montre("ss"+cat);
}


function montre(id) {
	clearTimeout(timer);
	var d = document.getElementById(id);
	for (var i = 1; i<=4; i++) {
		if (document.getElementById('ss'+i)) {document.getElementById('ss'+i).style.display='none';}
	}
	if (d) {d.style.display='block';}
}


function gens(fichier,larg,haut,px,py) { 
	ff=window.open(fichier,"_blank","height="+haut+",width="+larg+",left="+px+",top="+py+",scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no,location=no") }


function change_class(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=7; i++) {
		if (document.getElementById('s_menu'+i)) {document.getElementById('s_menu'+i).className='smenu';}
	}
if (d) {d.className='smenu_ok';}
}

	
function switchcontent(cid){
	document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
	selectedItem=cid+"|"+document.getElementById(cid).style.display
}




var countDep = 0; 
var countDep2 = 0; 
var countDep3 = 0; 
var  timer = 0;


function dep(dir){

	if(countDep==0){

		if(dir==1){
	
			courrant++;
	
			if( courrant == nbre-limit  ){ document.getElementById('f_right').style.visibility='hidden'; }
			document.getElementById('f_left').style.visibility='visible';
			
			timer=setInterval("goto(186)", 100);
	
	
		}else{
	
			courrant--;
	
	
			if( courrant == 1  ){ document.getElementById('f_left').style.visibility='hidden'; }
			document.getElementById('f_right').style.visibility='visible';
			
			timer=setInterval("goto(-186)", 100);

		}

	}

}

function goto(depX){

	countDep++;
	
	if( countDep<=6 ){
		
		document.getElementById('com').scrollLeft+=depX/6;

	}else{
		clearInterval(timer);
		countDep = 0;
	}

}

function dep2(dir){


	if(countDep2==0){
	

		if(dir==1){
	
			courrant2++;
	
			if( courrant2 == nbre2-limit2  ){ document.getElementById('f_right2').style.visibility='hidden'; }
			document.getElementById('f_left2').style.visibility='visible';
			
			timer=setInterval("goto2(160)", 100);
	
	
		}else{
	
			courrant2--;
	
	
			if( courrant2 == 1  ){ document.getElementById('f_left2').style.visibility='hidden'; }
			document.getElementById('f_right2').style.visibility='visible';
			
			timer=setInterval("goto2(-160)", 100);

		}

	}

}

function goto2(depX){

	countDep2++;
	
	if( countDep2<=5 ){
		
		document.getElementById('com2').scrollLeft+=depX/5;

	}else{
		clearInterval(timer);
		countDep2 = 0;
	}

}

function dep3(dir){


	if(countDep3==0){
	

		if(dir==1){
	
			courrant3++;
	
			if( courrant3 == nbre3-limit3  ){ document.getElementById('f_right3').style.visibility='hidden'; }
			document.getElementById('f_left3').style.visibility='visible';
			
			timer=setInterval("goto3(160)", 100);
	
	
		}else{
	
			courrant3--;
	
	
			if( courrant3 == 1  ){ document.getElementById('f_left3').style.visibility='hidden'; }
			document.getElementById('f_right3').style.visibility='visible';
			
			timer=setInterval("goto3(-160)", 100);

		}

	} 

}

function goto3(depX){

	countDep3++;
	
	if( countDep3<=5 ){
		
		document.getElementById('com3').scrollLeft+=depX/5;

	}else{
		clearInterval(timer);
		countDep3 = 0;
	}

}



