//***************************************************************
// code gestion menu SISTER SHOPPING
// Auteur : Société Abiotik
// contact : 04 67 57 03 72
//***************************************************************
//----------------------------------------copyright abiotik 2005

//*****************************************************************************************************************
//                                              ECRITURE DU MENU DE GAUCHE
//*****************************************************************************************************************

// correspondance 
// rub0 : accueil/commun | rub1 : sac | rub2 : chaussures | rub3 : bijoux | rub4 : ceintures | rub5 : montres | rub6 : hommes | rub7 : enfants | rub8 : soldes | rub9 : collection été




// nouvelles Fonctions >> Menu en "dur"

var numSousGamme = 0;

function dbtMontageSousGamme(titre){
			var sousGammeOK = 1;
		 	document.write('<tr>'
				+'<td width="10"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="6" height="12"></td>'
				+'<td class="bc11V"><a href="javascript:var win=affCalque('+numSousGamme+');"><b>'+ titre + '</b></a></td>'
				+'<td width="28"><a href="javascript:var win=affCalque('+numSousGamme+');"><img src="../site/graphCommun/menuDyn/images2/plus.gif" width="11" height="12" border="0"></a>'
			// CALQUE
				+'<div id="Layer'+numSousGamme+'" style="position:absolute; margin-top=-7px; margin-left:-12px; width:160px; z-index:'+numSousGamme+'; visibility: hidden">'
			//dbt tab sous gamme	
				+'<table border="0" cellspacing="0" cellpadding="0">'
				+'<tr><td><img src="../site/graphCommun/menuDyn/images2/calqueHaut.gif"></td></tr>'
				+'<tr><td background="../site/graphCommun/menuDyn/images2/calqueFond.gif">'
				+'<table width="100%" border="0" cellspacing="3" cellpadding="0">');			
		
		numSousGamme++;
}
			

function finMontageSousGamme(){
		document.write('</table></td></tr>'
				+'<tr><td><img src="../site/graphCommun/menuDyn/images2/calqueBas.gif"></td></tr>'
				+'</table>'
				+'</div></td></tr>');
}


function dbtGammeSimple(){
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'
				+'<td width="10" align="right"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="6" height="12"></td>'
				+'<td class="bc11V">');
}

function finGammeSimple(){
		document.write('</td>'
				+'<td width="24"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="10" height="10">'
				+'</tr></table>');
}



//*****************************************************************************************************************
//Montage menu rub
//*****************************************************************************************************************
//VAR ECRITURE

//var designMenuRub = new Array();
var sousGammeOK = 0;
//var designRub=1;

var tabRub=new Array();
tabRub=eval('tabRub'+ designRub);

var i = 0, n = 0, debutTab=0, memo=0, timeout ;

//*****************************************************************************************************************
//Ecriture debut/fin Tableau : GAMMES

// ecriture debut rayons
	function debutTitreTab(titreGamme){
					
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'
			+'<td><img src="../site/graphCommun/menuDyn/images2/menuDyn_'+titreGamme+'.gif" width="176" height="26"></td>'
			+'</tr></table>'

			+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'
			+'<td background="../site/graphCommun/menuDyn/images2/menuDynFond.gif" valign="top">');

			espaceur(1,3);		
		//document.write(titreGamme+'<br>');
	}

// ecriture fin tab rayons
	function finTab(){
		espaceur(1,3);
		document.write('</td></tr></table>');
		//document.write('<br>');
}



// ecriture debut sousGamme
	function debutSousGamme(titreSG){

		document.write('<table border="0" cellspacing="0" cellpadding="0">'
				+'<tr><td><img src="../site/graphCommun/menuDyn/images2/calqueHaut.gif"></td></tr>'
				+'<tr><td background="../site/graphCommun/menuDyn/images2/calqueFond.gif">'
				+'<table width="100%" border="0" cellspacing="3" cellpadding="0"><tr>'
				+'<td><img src="../site/graphCommun/communNew/images/espaceur.gif" width="5" height="1"></td>'
				+'<td class="bc10V">');

/*
		//document.write(titreSG+'<br>');
		document.write('<table border="0" cellspacing="0" cellpadding="0">'
			+'<tr><td><img src="../site/graphCommun/menuDyn/images/calqueHaut.gif" width="160" height="5"></td></tr>'
			+'<tr><td background="../site/graphCommun/menuDyn/images/calqueFond.gif" class="violet11">&nbsp;&nbsp;<b>'+titreSG+'</b></td></tr>'
			+'<tr><td background="../site/graphCommun/menuDyn/images/calqueFond.gif"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="1" height="3"></td></tr>'
			+'<tr><td  bgcolor="#8A7498" align="center"><img src="../site/graphCommun/menuDyn/images/calqueTiret.gif"></td></tr>'
			//+'<tr><td background="../site/graphCommun/menuDyn/images/calqueFond.gif"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="1" height="2"></td></tr>'
			+'<tr><td background="../site/graphCommun/menuDyn/images/calqueFond.gif">');			
*/
	                        
	}			

// ecriture fin sousGamme
	function finSousGamme(){
		
		document.write('</td>'
				+'<td><img src="../site/graphCommun/communNew/images/espaceur.gif" width="5" height="1"></td>'
				+'</tr>'
				+'</table></td></tr>'
				+'<tr><td><img src="../site/graphCommun/menuDyn/images2/calqueBas.gif"></td></tr>'
				+'</table>');						  
		
	/*	document.write('</td></tr>'
			+'<tr><td><img src="../site/graphCommun/menuDyn/images/calqueBas.gif"></td></tr>'
			+'</table>');
			espaceur(1,2);
	*/			
	}

//Ecriture debut/fin Tableau : STANDARD

function debutTabStandard(){	
	
}

function finTabStandard(){

}



//*****************************************************************************************************************
//ECRITURE MENU GAUCHE
function affMenu(){

//------------------------------
//ECRITURE MENU RUBRIQUE
//Boucle ecriture menu
  while (tabRub[i] != "STOP") {
	
	//Verif si rayon
	
	if(tabRub[i] == "R") {
		if(i>0) {
		  	finTab();
		}		
		i=i+1;
		
		//titre rayon


		debutTitreTab(tabRub[i]);
	}
	
	//Verif si gamme
	else if(tabRub[i] == "G") {
		i++;
		//alert(tabRub[i]);
		// début écriture cellule gamme
              //document.write('<br>');
			  
		//Verif si sous gamme
		// pas de sous gamme
		if (tabRub[i+1] != "SG"){
		 	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'
				+'<td width="10" align="right"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="6" height="12"></td>'
				+'<td class="bc11V"><a href="'+tabRub[i+1]+'" onMouseOver="supCalque(memo);"><b>'+ tabRub[i] +'</b></a></td>'
				+'<td width="24"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="10" height="10"></td>'
				+'</tr></table>');			
			i=i+1;	
		}
		// sous gamme
		else {
			// information sous gamme présente
			sousGammeOK = 1;
			
			// ecriture gamme avec sous gamme
		 	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'
				+'<td width="10" align="right"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="6" height="12"></td>'				
				+'<td class="bc11V"><a href="javascript:var win=affCalque('+i+');"><b>'+ tabRub[i] + '</b></a></td>'
				+'<td width="28"><a href="javascript:var win=affCalque('+i+');"><img src="../site/graphCommun/menuDyn/images2/plus.gif" width="11" height="12" border="0"></a>');		
			
			// CALQUE
			document.write('<div id="Layer'+i+'" style="position:absolute; margin-top=-7px; margin-left:-12px; width:160px; z-index:'+i+'; visibility: hidden">');
			var titreSG = tabRub[i];
			memo=i;
			i=i+2;
			n = i;			
			// ecriture sous gamme 
			debutSousGamme(titreSG);
			while ((tabRub[n] != "G") && (tabRub[n] != "R") && (tabRub[n] != "STOP")){				
				

	
			document.write('<a href="' +tabRub[n+1]+ '"onMouseOver="stopTemps();" onMouseOut="temps('+memo+');"><b>' + tabRub[n] + '</b></a><br>');
			

//document.write('<a href="' +tabRub[n+1]+ '"onMouseOver="stopTemps();" onMouseOut="temps('+memo+');"><b>' + tabRub[n] + '</b></a><br>');	
/*			
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'
			+'<td width="5" height="14"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="5" height="1"></td>'
			+'<td class="bc10V"><a href="' +tabRub[n+1]+ '"onMouseOver="stopTemps();" onMouseOut="temps('+memo+');"><b>' + tabRub[n] + '</b></a></td>'	
			+'<td width="5"><img src="../site/graphCommun/communNew/images/espaceur.gif" width="5" height="1"></td></tr>'
			+'</table>');
*/	
				i=n+1;
				n=n+2;
			}
			finSousGamme();
			document.write( '</div></td></tr></table>');	
		  
		}
		



		
		
		// fin gamme
		document.write('');
	}
	i++;
  }
  finTab();

}

//*****************************************************************************************************************
// Fonctions gestion calque
function temps(a){
var memo = a
	timeout = setTimeout('supCalque(memo)',2000);
}

function affCalque(c){
var n=1;
	with (document.getElementById("Layer" + memo).style)
		visibility="hidden";
		with (document.getElementById("Layer" + c).style)
			visibility="visible";
		memo = c;	
	stopTemps();
}

function stopTemps(){
	clearTimeout(timeout);
}

function supCalque(a) {
  if (sousGammeOK == 1){
	with (document.getElementById("Layer" + a).style)
		visibility="hidden";
	}
}

