


//*****************************************************************
// Code de gestion principale de montage site VIBRATO MUSIC
// Auteur: Costagliola Jean luc - tél 04 67 57 03 72
// Tous droits réservés - Abiotif 2011
//*****************************************************************




// GESTION MENU HAUT
//*****************************************************************

	var timeout, timeAttente;
	var memo=1;
	
	function affCalque(nbCalque){
		c=nbCalque;
		timeAttente = setTimeout('lanceCalque(c)',150);
		stopTemps();		
	}

	function lanceCalque(nbCalque){

		// suppression calque + image
		document.getElementById("claque" + memo).style.visibility="hidden";		
		document.getElementById("MH_" + memo).style.backgroundImage='url(images/menuH_dbtcase.png)';	

		// affichage des calques + image
		document.getElementById("claque" + nbCalque).style.visibility="visible";
		document.getElementById("MH_" + nbCalque).style.backgroundImage='url(images/menuH_Activecase1.png)';					
		
		memo=nbCalque;
	}

	function supCalque(nbCalque){

		// suppression calque + image
		document.getElementById("claque" + memo).style.visibility="hidden";
		document.getElementById("MH_" + memo).style.backgroundImage='url(images/menuH_dbtcase.png)';	
	}


	function temps(){
		timeout = setTimeout('supCalque(memo)',400);
		clearTimeout(timeAttente);			
	}
	
	function stopTemps(){
		clearTimeout(timeout);
	}





// GESTION IMG SURVOL
//*****************************************************************

	function imgSurvol(nom,actionOnOFF){

	}
	
	
	
// GESTION BANNIERES DEFILANTES ACCUEIL
//*****************************************************************

	var gradOpac;
	var blocActifTrans=1;
	var actionPlusMoins=0;
	var actionAutoTrans=1;
	var stopAutoTrans=1;
	var memoBlocTrans=1;


	function initBanTrans(){
		with (document.getElementById("blocTrans"+memoBlocTrans).style) {
			if (document.all) filter="alpha(opacity=100)";
			else opacity=1;
			display="block";
		}
		document.getElementById("case"+memoBlocTrans).style.backgroundImage='url(images/banDefil_point1.png)';
		if(stopAutoTrans==1)
			tourneAutoTrans();	
	}


	
	function changeBlocTrans(actionBlocTrans){
		actionPlusMoins=0;
		memoBlocTrans=blocActifTrans;
		blocActifTrans=actionBlocTrans;		
		gradOpac="100";
		actionTrans();
	}



	function actionTrans(){			
		// efface
		if(actionPlusMoins==0){	
			gradOpac=gradOpac-10;
			with (document.getElementById("blocTrans"+memoBlocTrans).style) {
				//visibility="hidden";
				if (document.all) filter="alpha(opacity="+gradOpac+")";
				else opacity=gradOpac/100;
			}
			if(gradOpac<=0){
				actionPlusMoins=1;
				document.getElementById("blocTrans"+memoBlocTrans).style.display="none";
				document.getElementById("case"+memoBlocTrans).style.backgroundImage='url(images/banDefil_point0.png)';
				document.getElementById("blocTrans"+blocActifTrans).style.display="block";							
			}
			transparence();				
		}	
		// affiche
		else{
			gradOpac=gradOpac+10;
			with (document.getElementById("blocTrans"+blocActifTrans).style) {
				if (document.all) filter="alpha(opacity="+gradOpac+")";
				else opacity=gradOpac/100;
			}
			if(gradOpac<100){
				transparence();
			}
			else{
				//actionPlusMoins=0;
				//memoBlocTrans=blocActifTrans;
				//document.getElementById("case"+blocActifTrans).style.backgroundColor = "#fff";
				document.getElementById("case"+blocActifTrans).style.backgroundImage='url(images/banDefil_point1.png)';				
				if(stopAutoTrans==1)
					tourneAutoTrans();		
			}		
		}		
	}	


	function transparence(){
		tempsAvance = setTimeout('actionTrans()',20);	
	}


	function arretAutoTrans(){		
		stopAutoTrans=0;
		clearTimeout(tempsAutoTrans);	
	}


	function tourneAutoTrans(){
		if(stopAutoTrans==1){
			tempsAutoTrans = setTimeout('changeBlocTrans(actionAutoTrans)',4000);
			actionAutoTrans++;
			if(actionAutoTrans==4)
				actionAutoTrans=1;
		}
	}




// GESTION PUBS DEFILANTES ACCUEIL - SLIDE type 1
//*****************************************************************
	var memoBlocPub=1;
	var actifBlocPub;
	var positionInitBlocPub=-260;
	var positionBlocPub;
	var stopDefilAuto=0;

	var blocageBoutSVABK_1=0;

	function defilBlocPubAuto(){
		blocageBoutSV1ABK=1;
		actifBlocPubAuto=memoBlocPub+1;
		if(actifBlocPubAuto==4)
			actifBlocPubAuto=1;
		tempsAvanceAuto = setTimeout('changeBloc(actifBlocPubAuto)',8000);
	}


	function ArretDefilBlocPubAuto(){
		stopDefilAuto=1;
		clearTimeout(tempsAvanceAuto);
	}


	function avancePasSVABK_1(num){
		actifBlocPubAuto=memoBlocPub+num;
		if(actifBlocPubAuto==4)
			actifBlocPubAuto=1;
		else if(actifBlocPubAuto==0)
			actifBlocPubAuto=3;
		changeBloc(actifBlocPubAuto);
	}	

	
	function changeBloc(bloc){
		if(bloc != memoBlocPub && blocageBoutSVABK_1==0){			
			if(bloc > memoBlocPub){
				positionBlocPub=positionInitBlocPub;
			}
			else{
				positionBlocPub=0;
				document.getElementById("pub"+bloc).style.marginTop = "0px";
			}			
			actifBlocPub=bloc;	
			blocageBoutSVABK_1=1;
			avanceBlocPub();
		}	
	}
	
	
	function avanceBlocPub(){		
		// avance
		if(actifBlocPub > memoBlocPub){
			positionBlocPub = positionBlocPub + 20;		
			document.getElementById("pub"+actifBlocPub).style.marginTop = positionBlocPub+"px";		
			if(positionBlocPub < 0){
				tempsAvance = setTimeout('avanceBlocPub()',10);
				document.getElementById("imgPubH"+memoBlocPub).src = "images/pubDefil_titre"+memoBlocPub+"_1.png";
				document.getElementById("imgPubH"+actifBlocPub).src = "images/pubDefil_titre"+actifBlocPub+"_2.png";
			}
			else{
				document.getElementById("pub"+memoBlocPub).style.marginTop = "-260px";	
				memoBlocPub=actifBlocPub;
				blocageBoutSVABK_1=0;				
				if(stopDefilAuto==0)
					defilBlocPubAuto();				
			}		
		
		}
		//recul
		else{		
			positionBlocPub = positionBlocPub - 20;		
			document.getElementById("pub"+memoBlocPub).style.marginTop = positionBlocPub+"px";		
			if(positionBlocPub > -320){
				tempsAvance = setTimeout('avanceBlocPub()',10);
				document.getElementById("imgPubH"+memoBlocPub).src = "images/pubDefil_titre"+memoBlocPub+"_1.png";
				document.getElementById("imgPubH"+actifBlocPub).src = "images/pubDefil_titre"+actifBlocPub+"_2.png";				
			}
			else{
				memoBlocPub=actifBlocPub;
				blocageBoutSVABK_1=0;
				if(stopDefilAuto==0)
					defilBlocPubAuto();				
			}		
		}
	}

	
	function initBanAccueil(){
		document.getElementById("pub1").style.marginTop = 0+"px";
		document.getElementById("imgPubH1").src = "images/pubDefil_titre1_2.png";
		defilBlocPubAuto();	
	}







// GESTION MARQUES DEFILANTES ACCUEIL - SLIDE type 2
//*****************************************************************
	var avanceSVABK = 110;

	var posInitSVABK = 0;
	var compteurSVABK = 1;	
	var stopAutoABK=0;
	var blocageSVABK=0;
	var retourInit, retourAction;

	//relance avance auto;
	function initSVABK(){
		stopAutoABK=1;
		blocageSVABK=0;
		avanceAutoSVABK = setTimeout('actionPlusSVABK()',4000);
	}

	function actionSVABK(actionPM){
		stopAutoABK=0;
		clearTimeout(avanceAutoSVABK);
		if(blocageSVABK==0){
			blocageSVABK=1;
			if(actionPM==1)	{				
				if(compteurSVABK <1) compteurSVABK = 1;
				actionPlusSVABK();
			}
			else{
				compteurSVABK--;
				actionMoinsSVABK();
			}
		}
	}


	function actionPlusSVABK(){		
		// avance
		if(posInitSVABK > compteurSVABK*avanceSVABK*-1 && posInitSVABK > hauteurMaxSVABK){
			posInitSVABK = posInitSVABK - 10;		
			document.getElementById("cadreSVABK").style.marginTop = posInitSVABK+"px";		
			tempsAvance = setTimeout('actionPlusSVABK()',30);
		}
		else{
			if(compteurSVABK < nbLigneSVABK){
				compteurSVABK++;
				blocageSVABK=0;				
			}
			else{
				retourInit=0;
				retourAction=10;
				compteurSVABK=1;
				retourSVABK();
			}
			//relance avance auto
			if(stopAutoABK==1) initSVABK();
		}	
	}

	function actionMoinsSVABK(){		
		// recul
		if(posInitSVABK < (compteurSVABK-1)*avanceSVABK*-1 && posInitSVABK < 0){
			posInitSVABK = posInitSVABK + 10;		
			document.getElementById("cadreSVABK").style.marginTop = posInitSVABK+"px";		
			tempsAvance = setTimeout('actionMoinsSVABK()',30);
		}
		else{
			blocageSVABK=0;
		}
	}


	function retourSVABK(){
		if(posInitSVABK < retourInit){
			posInitSVABK = posInitSVABK + retourAction;		
			document.getElementById("cadreSVABK").style.marginTop = posInitSVABK+"px";		
			tempsAvance = setTimeout('retourSVABK()',30);
		}
		else{
			blocageSVABK=0;
		}
	}



// FONCTIONS DIVERSES
//*****************************************************************

// ouv/ferm "plus affichage" listing 2
	function ouvPlusAffichage(action){
		if(action == 1){
			document.getElementById("boutPlusAffichage").style.display = "none";
			document.getElementById("plusAffichage").style.display = "block";			
		}
		else{
			document.getElementById("boutPlusAffichage").style.display = "block";
			document.getElementById("plusAffichage").style.display = "none";		
		}
	}

// ouv/ferm cadres produit
	function actionBlocProd(num){
		var nbCadreBlocProduit=2;		
		for(n=1; n<=nbCadreBlocProduit; n++){
			document.getElementById("cadre"+n).style.display = "none";
			document.getElementById("titre"+n).style.backgroundColor = "#fff";
			document.getElementById("titre"+n).style.color = "#222";
		}
		document.getElementById("cadre"+num).style.display = "block";
		document.getElementById("titre"+num).style.backgroundColor = "#333";
		document.getElementById("titre"+num).style.color = "#fff";
	}


// FONCTIONS DIVERSES
//*****************************************************************


	var memoBlocRN;
	
	function initBlocRN(){
		memoBlocRN=1;
		document.getElementById("MenuRN_" + memoBlocRN).style.backgroundColor='#333';
		document.getElementById("MenuRN_" + memoBlocRN).style.color = '#fff';
		document.getElementById("listeRN_" + memoBlocRN).style.display = 'block';	
	}
	
	function activeBlocRN(num){
		document.getElementById("MenuRN_" + memoBlocRN).style.backgroundColor='';
		document.getElementById("MenuRN_" + memoBlocRN).style.color = '#222';
		document.getElementById("listeRN_" + memoBlocRN).style.display = 'none';
		memoBlocRN=num;
		document.getElementById("MenuRN_" + memoBlocRN).style.backgroundColor='#333';
		document.getElementById("MenuRN_" + memoBlocRN).style.color = '#fff';
		document.getElementById("listeRN_" + memoBlocRN).style.display = 'block';			
	}
	
	
