


//************************************************************************
//						GESTION PRINCIPALE - ENCEINTE PC
//************************************************************************
// Auteur : Abiotik / jean luc COSTAGLIOLA
// contact : 04 67 57 03 72
//************************************************************************
// ------------------------------------- tous droits réservés abiotik 2010


//****************************************************************
// GESTION MENU HAUT CALQUES
//****************************************************************

	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(../site/graph/images/MH_fond'+memo+'_1.gif)';

		// affichage des calques + image
		document.getElementById("claque" + nbCalque).style.visibility="visible";
		document.getElementById("MH_" + nbCalque).style.backgroundImage='url(../site/graph/images/MH_fond'+nbCalque+'_2.gif)';		
		
		memo=nbCalque;
	}

	function supCalque(nbCalque){

		// suppression calque + image
		document.getElementById("claque" + memo).style.visibility="hidden";
		document.getElementById("MH_" + memo).style.backgroundImage='url(../site/graph/images/MH_fond'+memo+'_1.gif)';
		if(designUnivers > 0){
			document.getElementById("MH_" + designUnivers).style.backgroundImage='url(../site/graph/images/MH_fond'+designUnivers+'_2.gif)';
			memo=designUnivers;
		}

	}


	function temps(){
		timeout = setTimeout('supCalque(memo)',300);
		clearTimeout(timeAttente);			
	}
	
	function stopTemps(){
		clearTimeout(timeout);
	}





// GESTION IMG SURVOL
//*****************************************************************

	function imgSurvol(nom,actionOnOFF){

	}

// GESTION IMG SURVOL
//*****************************************************************

	function init_menuH(){
		if(designUnivers > 0){
			document.getElementById("MH_" + designUnivers).style.backgroundImage='url(../site/graph/images/MH_fond'+designUnivers+'_2.gif)';
		}	
	}



//****************************************************************
// GESTION PUB BANNIERE 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.backgroundColor = "#E6881A";			
		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.backgroundColor = "";
				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 = "#E6881A";				
				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 HTML
//****************************************************************

	var memoBlocPub=1;
	var actifBlocPub;
	var positionInitBlocPub=-260;
	var positionBlocPub;
	var stopDefilAuto=0;

	function defilBlocPubAuto(){
		actifBlocPubAuto=memoBlocPub+1;
		if(actifBlocPubAuto==4)
			actifBlocPubAuto=1;
		tempsAvanceAuto = setTimeout('changeBloc(actifBlocPubAuto)',5000);
	}


	function ArretDefilBlocPubAuto(){
		stopDefilAuto=1;
		clearTimeout(tempsAvanceAuto);
	}


	
	function changeBloc(bloc){
		if(bloc != memoBlocPub){			
			if(bloc > memoBlocPub){
				positionBlocPub=positionInitBlocPub;
			}
			else{
				positionBlocPub=0;
				document.getElementById("pub"+bloc).style.marginTop = "0px";
			}			
			actifBlocPub=bloc;	
			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);
			}
			else{
				document.getElementById("pub"+memoBlocPub).style.marginTop = "-260px";
				document.getElementById("imgPubH"+memoBlocPub).src = "../site/graph/pubHtml/images/PH_titre"+memoBlocPub+"_1.gif";
				document.getElementById("imgPubH"+actifBlocPub).src = "../site/graph/pubHtml/images/PH_titre"+actifBlocPub+"_2.gif";								
				memoBlocPub=actifBlocPub;
				if(stopDefilAuto==0)
					defilBlocPubAuto();				
			}		
		
		}
		//recul
		else{		
			positionBlocPub = positionBlocPub - 20;		
			document.getElementById("pub"+memoBlocPub).style.marginTop = positionBlocPub+"px";		
			if(positionBlocPub > -320){
				tempsAvance = setTimeout('avanceBlocPub()',10);
			}
			else{
				document.getElementById("imgPubH"+memoBlocPub).src = "../site/graph/pubHtml/images/PH_titre"+memoBlocPub+"_1.gif";
				document.getElementById("imgPubH"+actifBlocPub).src = "../site/graph/pubHtml/images/PH_titre"+actifBlocPub+"_2.gif";
				memoBlocPub=actifBlocPub;
				if(stopDefilAuto==0)
					defilBlocPubAuto();
					
			}		
		}
	}

	
	function initBanAccueil(){
		document.getElementById("pub1").style.marginTop = 0+"px";
		document.getElementById("imgPubH1").src = "../site/graph/pubHtml/images/PH_titre1_2.gif";
		defilBlocPubAuto();	
	}



//****************************************************************
// GESTION COLONNE GAUCHE MENU DYN
//****************************************************************

	//var designUnivers=1;
	
	// init menu G et menu haut
	function init_menuG(){
		if(designUnivers > 0){
			// menu G
			document.getElementById("titreUnivers" + designUnivers).style.backgroundImage='url(../site/graph/images/MG_fondActif.gif)';
			document.getElementById("univers" + designUnivers).style.display="block";		
		}	
	}


	function gestion_MenuG(universMG){
		for(i=1; i<=4; i++){
			if(i != universMG){
				document.getElementById("univers" + i).style.display="none";									
			}
		}
		document.getElementById("univers" + universMG).style.display="block";
	}





//****************************************************************
// FONCTIONS DE MONTAGE JS
//****************************************************************


	// MONTAGE infos txt Bandeau haut
	//------------------------------------------------------------------

	function MontageHautInfos(){
		document.write('<a href="http://www.enceinte-pc.com/comment-choisir-ses-enceintes,fr,8,43.cfm">Quel type d\'enceintes choisir ?</a>  | '
			+'<a href="http://www.enceinte-pc.com/branchement-enceinte,fr,8,44.cfm">Comment connecter ses enceintes ?</a> | '
			+'<a href="http://www.enceinte-pc.com/page_5,fr,8,5.cfm">Modes de paiement</a>  | '
			+'<a href="http://www.enceinte-pc.com/page_8,fr,8,8.cfm">Information livraison</a>');
	}

	
	function MontageBlocRecherche(){	
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">'
			+'<form action="http://www.enceinte-pc.com/boutique/recherche_resultats.cfm" method="get" name="form_search" target="_self" style="margin:0;padding:0;"><tr><td>'
			+'<input type="hidden" name="code_lg" value="lg_fr">'
			+'<input type="text" name="mot" id="champ_recherche_style" style="width:180px; border: none; font-size: 11px; margin: 6px 0 0 0; font-family: verdana;" value="Recherchez un article" onfocus="focusMotValue(this.id);" onblur="blurMotValue(this.id);">'
			+'</td>'
			+'<td><div onClick="document.form_search.submit();return false;" style="width:35px; height: 25px; cursor: pointer;"></div></td>'
			+'</tr></form></table>');
	}
	
	// MONTAGE Colonne GAUCHE // RECHERCHE par PRIX
	//------------------------------------------------------------------
	


	function goRecherchePrix(){
		var tabPrix= new Array ('',35,60,100,200,300,'');
		var fourchettePrix = document.rechercheParPrix.fourchettePrix.value;
		window.location='http://www.enceinte-pc.com/boutique/recherche_resultats.cfm?rayon_nav='+document.rechercheParPrix.choixRayon.value+'&gamme_nav=0&prix_min='+tabPrix[fourchettePrix-1]+'&prix_max='+tabPrix[fourchettePrix]+'&mot=&classement=prix_unitaire&code_lg=lg_fr&ordre=ASC&triage=1';
		//alert(document.rechercheParPrix.choixRayon.value+' - ' + [fourchettePrix-1]+' - ' + [(fourchettePrix)]);
		
	}

	function montageBlocRecherchePrix(){				
		document.write('<form name="rechercheParPrix"> ' 
			+'<div style="height: 28px;"></div>'
			+'<div style="margin: 0 0 0 20px;">'	  		
			+'<select name="choixRayon"  style="width: 170px; margin-top: 5px;">'
			+'<option selected value="-1" >Tous les rayons</option>'
			+'<option value="41">Enceinte multimédia 2.0</option>'
			+'<option value="51">Enceinte multimédia 2.1</option>'
			+'<option value="61">Enceinte multimédia 5.1</option>'
			+'<option value="91">Enceinte multimédia sans fil</option>'
			+'<option value="81">Dock iPod / iPhone</option>'
			+'<option value="71">Casques audio</option>'		
			+'</select>'

			+'<select name="fourchettePrix"  style="width: 170px; margin-top: 10px;">'
			+'<option selected value="1"> Inférieur à 35 €</option>'				
			+'<option value="2"> de 35 à 60 €</option>'
			+'<option value="3"> de 60 à 100 €</option>'			
			+'<option value="4"> de 100 à 200 €</option>'
			+'<option value="5"> de 200 à 300 €</option>'
			+'<option value="6"> 300 € et plus</option>'							
			+'</select>'			

			+'<div onclick="goRecherchePrix();" style="cursor: pointer; margin: 3px 0 0 0; width:170px; height: 22px;"></div>'
			+'</div>'		  		
			+'</form>');
	}


	
	
	// MONTAGE Colonne DTE // pubs MV
	//------------------------------------------------------------------
	
	function MontageColDte(){
		// gestion des MV par bloc
		//-----------------------------		
		var designMV=designUnivers;
		
		//top ventes
		//-----------------------------
		if (eval('rub'+designMV+'MV').image != ""){
			var designImage, designLien;
			document.write('<div style="margin:30px 0 30px 0;">'
				+'<div><img src="../site/graph/images/CD_titreMV.gif"></div>');
				
			for(i=0; i<eval('rub'+designMV+'MV').image.length; i++){
				designImage = eval(eval('rub'+designMV+'MV').image[i]).image;
				designLien = eval(eval('rub'+designMV+'MV').image[i]).lien;
				//alert(designImage);
				document.write('<div><a href="'+designLien+'"><IMG src="../site/gestionClient/MV/images/'+designImage+'" border="0"></a></div>');
			}
			document.write('</div>');
		}
	}





	// MONTAGE PIED
	//------------------------------------------------------------------

	function MontagePiedInfosLigne(){
		document.write('<div id="ligneHaute"><img src="../site/graph/images/pied_ligne1.gif" usemap="#barreInfoPied" border="0"></div>'
			+'<map name="barreInfoPied">'
			+'<area shape="rect" coords="32,0,185,25" onclick="favoris();" style="cursor:pointer;">'
			+'<area shape="rect" coords="212,0,391,25" href="mailto:?subject=Enceinte-PC.com&BODY=Toutes%20les%20enceintes%20PC%20et%20MAC%20sont%20sur%20%3A http%3A%2F%2Fwww%2Eenceinte%2Dpc%2Ecom%2F" id="lien_envoi_mail_titre" style="cursor:pointer;">'
			+'<area shape="rect" coords="433,0,640,25" href="http://www.facebook.com/#!/pages/Enceinte-PCcom/135321756522228?v=wall" target="_blank">'
			+'<area shape="rect" coords="771,5,859,27" href="http://www.enceinte-pc.com/index.cfm">'
			+'<area shape="rect" coords="902,5,980,27" onclick="history.back();" style="cursor:pointer;">'
			+'</map>');
	}

	function MontagePiedInfosImages(){
		document.write('<div onclick="window.location=\'http://www.enceinte-pc.com/page_5,fr,8,5.cfm\';" style="cursor:pointer;"><img src="../site/graph/images/pied_banPaiement.gif"></div>'
			+'<div onclick="window.location=\'http://www.enceinte-pc.com/page_8,fr,8,8.cfm\';" style="cursor:pointer;"><img src="../site/graph/images/pied_banLivraison.gif" style="margin-top: 5px;"></div>');
	}

//****************************************************************
// FONCTIONS DE MONTAGE DIV
//****************************************************************

	// MONTAGE DIV PRODUIT
	//------------------------------------------------------------------

	function initProd(){

		// montage produit >> bandeau haut (haut résumé)
		//-----------------------------------------------		
		var montageProd1='<div class="sep"></div>'
			+'<table border="0" cellspacing="2" cellpadding="0" height="36"><tr>';	
		if(document.formulaire.wattsABK && document.formulaire.wattsABK.value != '0')
			 montageProd1= montageProd1+ '<td><div class="blocWatt">'+document.formulaire.wattsABK.value+'</div></td>';
		else if(document.formulaire.wattsABK.value == '0')
			 montageProd1= montageProd1+ '<td width="5" bgcolor="#222222">&nbsp;</td>';			
		if(document.formulaire.puisssanceABK && document.formulaire.puisssanceABK.value != '0'){
			 montageProd1= montageProd1+ '<td align="center" class="tabTD1">Puissance'
				+'<div><img src="../site/graph/produit/images/etoile'+document.formulaire.puisssanceABK.value+'.gif"></div></td>';						
		}
		if(document.formulaire.audioABK && document.formulaire.audioABK.value != '0'){
			 montageProd1= montageProd1+ '<td align="center" class="tabTD1">Qualité Audio'
				+'<div><img src="../site/graph/produit/images/etoile'+document.formulaire.audioABK.value+'.gif"></div></td>';						
		}		
		if(document.formulaire.designABK && document.formulaire.designABK.value != '0'){
			 montageProd1= montageProd1+ '<td align="center" class="tabTD1">Design'
				+'<div><img src="../site/graph/produit/images/etoile'+document.formulaire.designABK.value+'.gif"></div></td>';						
		}
		if(document.formulaire.prixABK && document.formulaire.prixABK.value != '0'){
			 montageProd1= montageProd1+ '<td align="center"">Qualité / prix'
				+'<div><img src="../site/graph/produit/images/etoile'+document.formulaire.prixABK.value+'.gif"></div></td>';						
		}				
		montageProd1=montageProd1+'</tr></table><div class="sep" style="margin-bottom: 10px;"></div>';	
		var Destination = document.getElementById('insertResumHaut');
		Destination.innerHTML =	montageProd1;
	
	
		// montage produit >> milieu (haut description)
		//-----------------------------------------------
		var montageProd2='<div class="sep"></div><div style="height:37px;"><div style="float: right"><img src="../site/graph/produit/images/serviceClient.gif"></div>';
		
		//Frais de port
		//if(document.formulaire.fraisport && document.formulaire.fraisport.value != '0')
		//	montageProd2=montageProd2+'<div style="float: right"><img src="../site/graph/produit/images/Frais_Port'+document.formulaire.fraisport.value+'.gif"></div>';		
		
		//stock
		if( delaiApproTexteArray["0$0"] == "en stock")
			montageProd2=montageProd2+'<div><img src="../site/graph/produit/images/enStock.gif"></div>';		
		
		montageProd2=montageProd2+'</div><div class="sep"></div>';
		
		//Deuxième ligne (Frais de Port)
		montageProd2=montageProd2+'<div style="height:37px;"><div style="float: right"><img src="../site/graph/produit/images/Frais-MondialRelay-1.gif"></div>';
		montageProd2=montageProd2+'<div style="float: right"><img src="../site/graph/produit/images/Frais-Colissimo-'+document.formulaire.fraisport.value+'.gif"></div>';
		montageProd2=montageProd2+'<div style="float: right"><img src="../site/graph/produit/images/FraisPort"></div>';
		
		montageProd2=montageProd2+'</div><div class="sep" style="margin-bottom: 20px;"></div>';
		
		var Destination2 = document.getElementById('insertProdHaut');
		Destination2.innerHTML = montageProd2;		
	
	}









//****************************************************************
// FONCTIONS DIVERSES
//****************************************************************
	
	// FAVORIS IE et FF
	//--------------------------------------------------------------------------  
	function favoris() { 
		if ( navigator.appName != 'Microsoft Internet Explorer'){ 
			window.sidebar.addPanel("Enceintes multimédia PC / MAC","http://www.enceinte-pc.com/",""); 
		} 
		else { 
			window.external.AddFavorite("http://www.enceinte-pc.com/","Enceintes multimédia PC / MAC"); 
		} 
	} 

		


//****************************************************************
// FONCTIONS PWB
//****************************************************************

	// RECHERCHE
	//-------------------------------------------------------------------------------

	function focusMotValue(input){
		if (document.getElementById && document.getElementById(input).value == 'Recherchez un article')
		document.getElementById(input).value='';
	}
	function blurMotValue(input){
		if (document.getElementById && document.getElementById(input).value == '')
		document.getElementById(input).value='Recherchez un article';
	}


























