// Copyright Abiotik 2005
// Dernière mise à jour : 26/07/2006

//**********************************************************************************************
// MODULE D'ECRITURE DE DECLINAISONS PRODUIT DE BASE SUR POWER BOUTIQUE + OPTIONS AFFICHAGE
// + GESTION LANGUE >> FR / UK
//**********************************************************************************************
// ADAPTATION : Site MODES DISCOUNT
// Copyright Abiotik 2007 - Tous droits réservés
//**********************************************************************************************
// ce code est la propriété de Abiotik.
// Pour toutes informations contacter-nous au 04 67 57 03 72
//**********************************************************************************************



	//Declaration variables globales
	var longTabCoul;
	
	var version2=0;
	
	var choixCoul="0", 
	choixTaille="0", 
	inserVignette="0", 
	inserZoom="0", 
	nbZoom = "0",
	inserPictos = "0",
	inserAssoc="0",
	nbAssoc="4"
	affichNewPage="0";
	
	var tab=new Array();
	var tabCoul=new Array();


// Prog version UK
//------------------

	// tableau comparatif couleur FR/UK
	//----------------------------------
	var tabCoulUK = new Array(
	"ORANGE","ORANGE",
	"BLANC-CASSE","OFF-WHITE",
	"CUIR","LEATHER",
	"NOIR","BLACK",
	"BEIGE","BEIGE",
	"ROUGE","RED",
	"VERT","GREEN",
	"MARRON","BROWN",
	"VIOLET","PURPLE",
	"BLANC","WHITE",
	"BLEU","BLUE",
	"PARME","VIOLET",
	"CARREAUX","CHECKED",
	"VIOLET","PURPLE",
	"GRIS","GREY",
	"ROSE","PINK",
	"LILAS","LILAC",
	"BORDEAUX","BURGUNDY",
	"CIEL","SKY-BLUE",
	"ANTHRACITE","CHARCOAL-GREY",
	"MARINE","NAVY-BLUE",
	"GRISE","GREY",
	"VIEUX ROSE","OLD-ROSE",
	"TURQUOISE","TURQUOISE",
	"ROUGE-ORANGE","ORANGE-RED",
	"GRIS-FONCE","DARK-GREY",
	"GRIS-CLAIR","LIGHT-GREY",
	"KAKI","KHAKI",
	"JAUNE","YELLOW",
	"BLANC-NOIR","WHITE-BLACK",
	"MAUVE","MAUVE",
	"VERT-ANIS","ANISE-GREEN",
	"CARMIN","CARMINE",
	"CAMEL","CAMEL",
	"CHOCOLAT","CHOCOLATE",
	"VERMILLON","VERMILION",
	"VERT-AMANDE","ALMOND-GREEN",
	"ROSE-SAUMON","SALMON-PINK",
	"PANTHERE","PANTHER"
	);

// tab traduction FR/US :

var tabTraduction_fr = new Array(
"Choisissez la couleur et la taille",
"Choisissez la couleur",
"Choisissez la taille",
"Cliquez pour zoomer sur le produit",
"Commandez aujourd'hui",
", recevez votre commande d'ici",
"Plus d'infos sur les livraisons...",
"PAPIER CADEAU",
"QUANTITE",
"Taille", 
"oui",
"non",
"cliquez pour zoomer sur la couleur correspondante",
"Papier cadeau"
);

var tabTraduction_us = new Array(
"Select colour and size", //0
"Select colour", //1
"Select size", //2
"Click here to enlarge", //3
"Order today", //4
", , expect your package within", // 5
"More about delivery", //6
"GIFT WRAP", //7
"QUANTITY", //8
"Size", //9
"yes",//10
"no",//11
"Click on color to enlarge",//12
"Gift wrap" //13
);

	
	var affichLangue = "fr";



/*
	var recupLangue = window.document.location;
	var chaine = recupLangue.toString();
	var resultatLangue = chaine.indexOf('_us');

	//alert(resultatLangue);
	if (resultatLangue > 0){
		affichLangue = "us";
	}
	//alert(affichLangue);
*/

//*******************************************************************************************
// FONCTIONS D'ECRITURES HAUTES : TITRE / PICTOS / DESCRIPTION
//*******************************************************************************************

// ECRITURE GRAPHISME HAUT / TITRE
function affDeclinaison(){
// début tableau 1 supérieur
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="2">'
              +'<tr><td align="right" class="percent" bgcolor="#771c4d" height="20"><b>'); 
		// texte titre
		
		if (version2 == 0){
			document.write(Titre);
			//alert(Titre);
			graphismeTexte();
			// ecriture désignation
			document.write(Designation);
			affichDeclinaison();
		}
}

// ECRITURE GRAPHISME FIN TITRE / REF. PRODUIT / PICTOS / DESCRIPTION
function graphismeTexte(){
		document.write('</b></td></tr>'
              //+'<tr><td height="2"></td></tr>'
			  +'<tr><td align="right">Réf. : '+refProduit+'</td></tr>');
			 // +'<tr><td height="2"></td></tr>'


// FONCTION PICTOS       
		
		if (inserPictos==1){
            document.write('<tr><td background="../site/imgModuleProduit/imageFond1.gif"><img src="../site/imgModuleProduit/espageur.gif" width="1" height="8"></td></tr>'
              +'<tr><td>');		
			var designPictos, a=0;
			while (tabPictos[a] != "fin"){
				document.write('<img src="../site/pictos/'+tabPictos[a]+'.gif" border="0">');
				a++;
			}
		}
      
		document.write('</td></tr>'
              +'<tr><td background="../site/imgModuleProduit/imageFond1.gif"><img src="../site/imgModuleProduit/espageur.gif" width="1" height="8"></td></tr>'
              +'<tr><td></td></tr></table>');
		//texte description
}


//**********************************************************************************************
// 			FONCTION D'ECRITURE BASSE : DECLINAISONS/QTE/CDER/ASSOC
//**********************************************************************************************
function affichDeclinaison(){


// Picto pop up calcul
	if(affichLangue=="fr"){
		document.write('<br><br>'
		+'<a href="javascript:var win=window.open(\'https://www.1euro.com/1euro/calculetteTEG.do?idPartenaire=2442075\',\'certificat\', \'width=605,height=480\', \'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, dependent=yes\');">'
		+'<img src="http://partenaires.1euro.com/partenaires/fr/kit_rose/calc_bt_rose.gif" border="0"></a>');
	}



// gestion zoom hors vignette
		if (inserZoom == 1 && inserVignette == 0){
			zoom(refProduit);
		}

//fin tableau 1 supèrieur (mise en page PB)
		document.write('</font></div></td></tr></table>');


// ECRITURE GRAPHISME DESCRIPTION / DECLINAISONS + CDE + ASSOCIES
// tableau 2 de gestion taille / couleur / commander / assoc
		// Appel gestion des déclinaisons
		
		
		gestionDeclinaisons();
				

		//fin tab déclinaisons
		
	
// ecriture de quantite + commander
//*********************************************************************************		

	// gestion de l'appel des images boutons et du pop up cde par tel
		var appelLangue = "";
		if(affichLangue == "us")
			appelLangue = "_us";


		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="3">'
		
	// Quantité + papier cadeaux
		+'<tr><td width="100%" background="../site/imgModuleProduit/fondCoul.gif"><img src="../site/imgModuleProduit/fondCoul.gif" width="6" height="3"></td>'
		+'<td background="../site/imgModuleProduit/fondCoul.gif"><img src="../site/imgModuleProduit/fondCoul.gif" width="6" height="1"></td></tr>'
	// Papier		
		+'<tr bgcolor="#E3CBDB"><td align="right">&gt;&gt; '+eval("tabTraduction_"+affichLangue)[7]+' :'
		+'<input type="hidden" name="option1"></td>'
		+'<td><select name="option2" class="pdt"><option value="'+eval("tabTraduction_"+affichLangue)[11]+'<br>Marque <a>" selected>'+eval("tabTraduction_"+affichLangue)[11]+'</option><option value="'+eval("tabTraduction_"+affichLangue)[10]+'<br>Marque <a>">'+eval("tabTraduction_"+affichLangue)[10]+'</option></select></td></tr>'
	//Qte
		+'<tr bgcolor="#E3CBDB"><td align="right">&gt;&gt; '+eval("tabTraduction_"+affichLangue)[8]+' :</td>'
		+'<td><input type="text" name="qteABK" size="2" value="1">'
	// blocage touche entrer sur "qte"
		+'<div id="blocageEnter" style="display: none"><input type="text" name="qte" value="1"><div></td></tr></table>'		


		+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../site/imgModuleProduit/espaceur.gif" height="10"></td></tr></table>'
	// Commander

		+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'
		+'<td><a href="javascript:var win=window.open(\'telpop'+appelLangue+'.cfm\',\'cdeTel\',\'scrollbars=no,width=320,height=300\')"><img src="../site/imgModuleProduit/commande_tel'+appelLangue+'.gif" border="0"></a></td>'		
		+'<td align="right"><a href="javascript:commander();"><img src="../site/imgModuleProduit/commande_ligne'+appelLangue+'.gif" border="0"></a></td>'		
		+'</tr></table>');
	// fonction cde jour
	document.write('<table width="100%" border="0" cellspacing="3" cellpadding="0"><tr><td align="center">');	
	
		cdeJour();
	
	document.write('</td></tr></table>'
	

	// Espace entre CDE et Associés		
		+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../site/imgModuleProduit/espaceur.gif" height="5"></td></tr></table>');


// ecriture de produits Associes
//*********************************************************************************				  
		if (inserAssoc != 1){
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#7B767A"><img src="../site/imgModuleProduit/espaceur.gif" height="1"></td></tr></table>');
		}
		else{
		produitAssoc();
		}
//*********************************************************************************
// fin tableau 2	  
		document.write('</td></tr></table>');

// adaptation recup mise en page PB
	document.write('<table width="95%" border="0" cellpadding="0" cellspacing="4" align="center">'
			+'<tr><td align="right"><div><font>');
}		
		

//*******************************************************************************************
//                        	FONCTIONS D'ECRITURES SECONDAIRES
//*******************************************************************************************

// FONCTION DEBUT DE TABLEAU DES DECLINAISONS
function DbtTabDeclinaisons(texteChoix){
		
		document.write('<table width="100%" border="0" cellspacing="4" cellpadding="0"><tr><td>'
		
		
		+'<table width="100%" border="0" cellspacing="0" cellpadding="0">'
		+'<tr><td background="../site/imgModuleProduit/imageFond2.gif" width="70" class="fond_barre"><img src="../site/imgModuleProduit/imageFond2.gif"></td>'
		+'<td width="190" class="fond_barre" align="center" valign="top"><b>'+texteChoix+'</b></td>'
		+'<td background="../site/imgModuleProduit/imageFond2.gif" class="fond_barre"><img src="../site/imgModuleProduit/imageFond2.gif"></td>'
		+'</tr></table>');
		//début tableau des déclinaisons

}



//**********************************************************************************************
// FONCTION ECRITURE VIGNETTE
function vignette(imageVignette){	

	document.write('<img src="../site/vignettes/'+imageVignette+'.gif">');

}

//**********************************************************************************************
// FONCTION ECRITURE COULEUR
	function affichCoul(valeurCoul, designCoul){

		if(longTabCoul == 1)
			document.write('<td width="20" align="right"><input type="radio" name="couleur" value="' +valeurCoul+ '" checked></td>');
		else
			document.write('<td width="20" align="right"><input type="radio" name="couleur" value="' +valeurCoul+ '"></td>');
		
		
		// choix langue
		if (affichLangue=="us"){
			for(nb=0;nb<tabCoulUK.length;nb=nb+2){
				if(designCoul == tabCoulUK[nb]){
					designCoul= tabCoulUK[nb+1];
					break;
				}
			}
			//alert(nb +" - "+tabCoulUK.length);
		}
	
		document.write('<td class="pdt" width="100" align="left"><span class="fond_barre"><b>'+designCoul+'</b></span></td>');

	}
//**********************************************************************************************
// FONCTION ECRITURE TAILLE (directement sur la fonction de gestion)


//**********************************************************************************************
// FONCTION ECRITURE ZOOM
function zoom(designZoom){

	if (inserVignette == 1){

			if (nbZoom < 2)
				document.write('<a href=\'javascript:var win=window.open("../site/vignettes/'+designZoom+'_zoom.jpg","zoom","width=620,height=600","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");\'>');
			else
				document.write('<a href=\'javascript:var win=window.open("../site/popUpZoom/zoom.htm?nbImages='+nbZoom+'&refImage='+designZoom+'&libelle='+document.formulaire.titre.value+'","zoom","width=620,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");\'>');
		
		document.write('<img src="../site/imgModuleProduit/pictoZoom.gif" border="0" alt="'+eval("tabTraduction_"+affichLangue)[12]+'"></a>');
	}
	
	else{
		if (nbZoom < 2)
			document.write('<br><a href=\'javascript:var win=window.open("../site/vignettes/'+designZoom+'_zoom.jpg","zoom","width=620,height=600","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");\'>');
		else
			document.write('<br><a href=\'javascript:var win=window.open("../site/popUpZoom/zoom.htm?nbImages='+nbZoom+'&refImage='+designZoom+'&libelle='+document.formulaire.titre.value+'","zoom","width=620,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");\'>');
		
		document.write('<img src="../site/imgModuleProduit/pictoZoom.gif" border="0" alt="'+eval("tabTraduction_"+affichLangue)[3]+'"></a>');
	}	
}





//**********************************************************************************************
// FONCTION ECRITURE PRODUITS ASSOCIES
function produitAssoc(){
		//cellule + table produit associées
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">'
		+'<tr><td background="../site/imgModuleProduit/imageFond2.gif" width="70" class="fond_barre"><img src="../site/imgModuleProduit/imageFond2.gif"></td>'
		+'<td width="120" class="fond_barre" align="center" valign="top"><b>Avec cet article</b></td>'
		+'<td background="../site/imgModuleProduit/imageFond2.gif" class="fond_barre"><img src="../site/imgModuleProduit/imageFond2.gif"></td>'
		+'</tr></table>'
		+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../site/imgModuleProduit/espaceur.gif" height="5"></td></tr></table>'		
		+'<table cellspacing="0" cellpadding="0" border="0"><tr>'); 
				
		// gestion ouverture de page		
			if (affichNewPage == "0")
				var ouvPage = ' target="_blank"';
			else
				var ouvPage = '';
			
			
			for (i=1; i<=nbAssoc;i++){
				if (eval("produitAssoc"+i+".refActive") != "")
					document.write('<td width="100"><table cellspacing="0" cellpadding="0" border="3" bordercolor="#837767"><tr><td bordercolor="#837767"><a onMouseOver="javacript=affichAssoc('+i+',\'visible\');" onMouseOut="javacript=affichAssoc('+i+',\'hidden\');" href="fiche_produit.cfm?ref='+ eval("produitAssoc"+i+".refActive")+'"'+ouvPage+'>'
					+'<img src="images_produits/v'+ eval("produitAssoc"+i+".refActive")+'_1.gif" border="0" alt="cliquez pour accèder\nau produit"></a></td></tr></table></td>');
			}

		document.write('<td></td></tr></table>');

		// cellule séparation couleur taille Hauteur = 1
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../site/imgModuleProduit/espaceur.gif" height="5"></td></tr></table>');
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#7B767A"><img src="../site/imgModuleProduit/espaceur.gif" height="1"></td></tr></table>');
  		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../site/imgModuleProduit/espaceur.gif" height="4"></td></tr></table>');
		// cellule + table javacript layer produits associés
		document.write('<table  border="0" cellspacing="0" cellpadding="0" border="0"><tr>');
		//+'<td>CDE LAYERS</td>'
		
			for (i=1; i<=nbAssoc;i++){
				if (eval("produitAssoc"+i+".refActive") != "non")		
					document.write('<td width="108"><img src="../site/imgModuleProduit/espaceur.gif" width="100" height="1"><br><div id="Layer'+i+'" style="position:absolute; width:88px; z-index:'+i+';  background-color: #E3CBDB; layer-background-color: #E3CBDB; visibility: hidden">'
					+ '<br><div align="center">'+eval("produitAssoc"+i+".titre")+'<br>'
					+ '<b>'+eval("produitAssoc"+i+".prix")+'</b></div><br> '
					+ '</div></td>');
			}		
		
		document.write('</tr></table>');	

}



//*******************************************************************************************
// FONCTIONS GESTION CALQUE ET PRODUITS ASSOCIES
	// gestion des affichages layers
		function affichAssoc(i,etatAssoc){
			with (document.getElementById("Layer" + i).style)
				visibility= etatAssoc;
 		}








//*******************************************************************************************
// 								FONCTION OUV/FERME DECOUPAGE - BCBG Discount
//*******************************************************************************************

var decoupage=1, actifDecoupage = 1;

	function actionOuverture(actif){

		if (actif == "plus" && actifDecoupage < decoupage){
			document.getElementById('liste'+ actifDecoupage).style.display = 'none';
			document.getElementById('cell'+ actifDecoupage).style.background="#FFF";
			actifDecoupage++;
			document.getElementById('cell'+ actifDecoupage).style.background="#E3CBDB";
			document.getElementById('liste'+ actifDecoupage).style.display = 'block';	
		}
		else if (actif == "moins" && actifDecoupage > 1){
			document.getElementById('liste'+ actifDecoupage).style.display = 'none';
			document.getElementById('cell'+ actifDecoupage).style.background="#FFF";
			actifDecoupage--;
			document.getElementById('cell'+ actifDecoupage).style.background="#E3CBDB";
			document.getElementById('liste'+ actifDecoupage).style.display = 'block';
		}
		else if (actif != "moins" && actif != "plus"){
			document.getElementById('liste'+ actifDecoupage).style.display = 'none';
			document.getElementById('cell'+ actifDecoupage).style.background="#FFF";
			actifDecoupage = actif ;
			document.getElementById('cell'+ actifDecoupage).style.background="#E3CBDB";
			document.getElementById('liste'+ actifDecoupage).style.display = 'block';		
		}
	}



//*******************************************************************************************
// 								FONCTION DE GESTION DECLINAISONS - BCBG Discount
//**********************************************************************************************
function gestionDeclinaisons(){
		
		//Ecriture de la chaine avec "#" en fin de ligne	
		var longEcriture = ecriture.length - 1;
		var tabEcriture="";
		
		for (i=0;i<longEcriture-1;i++){
			tabEcriture=tabEcriture + ecriture[i] + "#";
		}
		
		tabEcriture=tabEcriture + ecriture[longEcriture-1];

//alert (tabEcriture);

		// ecriture du tableau de base en fonction de la chaine et du séparateur "#"
		tab=tabEcriture.split("#");
		var longTabEcriture=tab.length;
//alert (tab);

		// ecriture du tableau des couleurs avec verif doublons et position

		var n = 0 , a=0, diviseur ;



		
	// verif si choix couleurs + taille
	if (choixCoul=="1") { 
		
		if(choixTaille =="1")
			diviseur = 2;
		else
			diviseur = 1;
		
		
		for(i=0;i<(longTabEcriture/diviseur);i++){
			// verif si coul "n" == coul "n+1"
			if (tab[n] != tab[n+diviseur]){
					// verif si coul "n" (avec tabCoul[0] déjà ecrit) n'a pas déjà été ecrit sur le tableau
					if (a != 0){
						var EcritureOK =0;
						for (b=0; b<a ;b++){
							if (tabCoul[b] == tab[n]){
							// si on trouve une correspondance on passe EcritureOK à 1 >> empeche l'écriture
								EcritureOK =1;
								break;
							}
						}
						if(EcritureOK ==0){
							// si pas de correspondance on ecrit le tableau des couleurs
							tabCoul[a] = tab[n];
							a++;						
						}
					}
					// ecriture de tabCoul[0] dans la boucle
					else{
						tabCoul[a] = tab[n];
						a++;
					}
			}
			n=n+diviseur;			
		}
	}// fin if choix coul / choix taille


//---------------------------------------
// CAS 1 : coul et taille
//Ecriture des couleurs, tailles et references en fonction des couleurs définies plus haut.
	
	if (choixCoul=="1" && choixTaille=="1"){
		var tailleRef=new Array();
		longTabCoul=tabCoul.length;

	
		// debut du tableau
		DbtTabDeclinaisons(eval("tabTraduction_"+affichLangue)[0]);

		// tableau support affichage des declianaisons
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>');


		
		// Boucle DES COULEURS avec taille
		for (i=0;i<longTabCoul;i++){
			coul = tabCoul[i];


		
		
		//**********************************************************************************************
		// DECOUPE PAR 10 COULEURS
			
			if (i==0){
				document.write('<div id="liste1" style="display: block">'); 
				//alert(decoupage);
			}
			else if (i == 10 || i == 20 || i == 30 || i == 40 || i == 50 || i == 60 || i == 70 || i == 80 || i == 90){
				decoupage++;
				document.write('<div id="liste'+decoupage+'" style="display: none">');
				//alert(decoupage);
			}


			//----------------------------
			// tableau par déclinaison
			document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>');

			
			// Affichage vignette			
			document.write('<td width="100" height="80">');
			if (inserVignette == 1){
				vignette(refProduit +"_"+ coul);
			}
			document.write('</td>');
			
			
			// affichage couleur
						
			affichCoul(tabCoul[i], coul);
			
						
			
			
			//ECRITURE TAILLES / REFERENCES
			n=0;	
			b=0;
			
			
			document.write ('<td width="100"> &nbsp;&nbsp;&nbsp; <select class="pdt" name="taille' + i + '">');
			
			
			while (n < longTabEcriture){
				if (tabCoul[i] == tab[n]){
					document.write('<option value="' + (eval(tab)[n+1]) + '">'+eval("tabTraduction_"+affichLangue)[9] +' '+ (eval(tab)[n+1]));
				}
			
				n=n+diviseur;
			}
		document.write ('</select></td>');
		

		// inser ZOOM avec vignette
		
		document.write('<td align="center">');		
		if (inserZoom == 1 && inserVignette==1){
			zoom(refProduit +"_"+ coul);
		}		
		document.write('</td></tr></table');

		

		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td background="../site/imgModuleProduit/espaceur.gif" height="5"><img src="../site/imgModuleProduit/espaceur.gif"></td></tr></table>'
		+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td background="../site/imgModuleProduit/imageFond2.gif" ><img src="../site/imgModuleProduit/imageFond3.gif"></td></tr></table>');



		
		
		// fin DIV découpage
		if (i==9 || i == 19 || i == 29 || i == 39 || i == 49 || i == 59  || i == 69  || i == 79  || i == 89  || i == 99 || i == (longTabCoul-1)){
			document.write('</div>');			
			//alert(i);
		}

				
		} //fin "for"
	
	

	document.write('</td></tr></table>');
	
	// affichage des choix de page

		if (decoupage > 1){
			//alert (decoupage);
			document.write('<table cellspacing="0" cellpadding="0" height="40" width="90%" border="0"  align="center"><tr>');

				document.write('<td width="100"><b><a href="javascript:actionOuverture(\'moins\');"><font color="#7A6D5D">&lt;&lt; Page précédente</font></a></b></td>');
				
				for(nbDecoup=1; nbDecoup<= decoupage; nbDecoup++){
					document.write('<td align="center"><b> - </b></td><td align="center" width="20"><b><div id="cell'+nbDecoup+'" style="border: 2px solid #FFF;"><a href="javascript:actionOuverture('+nbDecoup+');">'+ nbDecoup+'</a></div></b></td>');
				}
				document.getElementById('cell1').style.background="#E3CBDB";
				
				document.write('<td align="center"><b> - </b></td><td align="right" width="100"><b><a href="javascript:actionOuverture(\'plus\');"><font color="#7A6D5D">Page suivante &gt;&gt;</font></a></b></td>');
			
			document.write('</tr></table>');
		
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../site/imgModuleProduit/espaceur.gif" height="10"></td></tr></table>');
		
		}
	
	
	
	} // fin "if"



//---------------------------------------
// CAS 2 : coul uniquement
//Ecriture des couleurs et references en fonction des couleurs définies plus haut.
	else if (choixCoul=="1" && choixTaille=="0"){
		longTabCoul=tabCoul.length;
		
		// debut du tableau
		DbtTabDeclinaisons(eval("tabTraduction_"+affichLangue)[1]);

		// tableau support affichage des declianaisons
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>');
		
		
		for (i=0;i<longTabCoul;i++){
			coul = tabCoul[i];


		//**********************************************************************************************
		// DECOUPE PAR 10 COULEURS
			
			if (i==0){
				document.write('<div id="liste1" style="display: block">'); 
				//alert(decoupage);
			}
			else if (i == 10 || i == 20 || i == 30 || i == 40 || i == 50 || i == 60 || i == 70 || i == 80 || i == 90){
				decoupage++;
				document.write('<div id="liste'+decoupage+'" style="display: none">');
				//alert(decoupage);
			}


			//----------------------------
			// tableau par déclinaison
			document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>');

			
			// Affichage vignette			
			document.write('<td width="100" height="80">');
			if (inserVignette == 1){
				vignette(refProduit +"_"+ coul);
			}
			document.write('</td>');			
			
			var refCoul = tab[i];
			
			//ECRITURE COULEUR
			// affichage couleur
			affichCoul(tabCoul[i], coul);


		// inser ZOOM avec vignette
		
		document.write('<td align="center">');		
		if (inserZoom == 1 && inserVignette==1){
			zoom(refProduit +"_"+ coul);
		}		
		document.write('</td></tr></table');

		

		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../site/imgModuleProduit/espaceur.gif" height="5"></td></tr></table>'
		+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td background="../site/imgModuleProduit/imageFond2.gif" ><img src="../site/imgModuleProduit/imageFond3.gif"></td></tr></table>');



		
		
		// fin DIV découpage
		if (i==9 || i == 19 || i == 29 || i == 39 || i == 49 || i == 59  || i == 69  || i == 79  || i == 89  || i == 99 || i == (longTabCoul-1)){
			document.write('</div>');			
			//alert(i);
		}

				
		} //fin "for"
	
	

	document.write('</td></tr></table>');
	
	// affichage des choix de page

		if (decoupage > 1){
			//alert (decoupage);
			document.write('<table cellspacing="0" cellpadding="0" height="40" border="0" width="90%" align="center"><tr>');

				document.write('<td width="100"><b><a href="javascript:actionOuverture(\'moins\');"><font color="#7A6D5D">&lt;&lt; Page précédente</font></a></b></td>');
				
				for(nbDecoup=1; nbDecoup<= decoupage; nbDecoup++){
					document.write('<td align="center"><b> - </b></td><td align="center" width="20"><b><div id="cell'+nbDecoup+'" style="border: 2px solid #FFF;"><a href="javascript:actionOuverture('+nbDecoup+');">'+ nbDecoup+'</a></div></b></td>');
				}
				document.getElementById('cell1').style.background="#E3CBDB";
				
				document.write('<td align="center"><b> - </b></td><td align="right" width="100"><b><a href="javascript:actionOuverture(\'plus\');"><font color="#7A6D5D">Page suivante &gt;&gt;</font></a></b></td>');
			
			document.write('</tr></table>');
		
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../site/imgModuleProduit/espaceur.gif" height="10"></td></tr></table>');
		
		}
	
	
	
	} // fin "if"
		

//---------------------------------------
// CAS 3 : taille uniquement
//Ecriture des tailles et references en fonction de "tab" définies plus haut.	
	else if (choixCoul=="0" && choixTaille=="1"){
		//ECRITURE TAILLES / REFERENCES
		n=0;	
		b=0;
				// debut du tableau
		DbtTabDeclinaisons("Choisissez la Taille ci-dessous");
		
		document.write ('<table><tr><td class="pdt" width="150"><b>Choisissez votre taille : </b></td>');
		document.write ('<td> &nbsp;&nbsp;&nbsp; <select class="pdt" name="taille">');
		
		while (n < longTabEcriture){
				document.write('<option value="' + (eval(tab)[n]) + '">Taille '+ (eval(tab)[n]));
			n=n+1;
		}

		document.write('</select></td></tr></table');

		

		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td background="../site/imgModuleProduit/espaceur.gif" height="5"><img src="../site/imgModuleProduit/espaceur.gif"></td></tr></table>'
		+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td background="../site/imgModuleProduit/imageFond2.gif" ><img src="../site/imgModuleProduit/imageFond3.gif"></td></tr></table>');

		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../site/imgModuleProduit/espaceur.gif" height="10"></td></tr></table>');
		
	}	

//---------------------------------------
// CAS 4 : pas de déclinaison
	else {
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>');	
	}

//alert(eval('document.formulaire.taille0.value'));

}// fin fonction ecriture des déclinaisons








//*******************************************************************************************
//							 Fonction COMMANDE + verif commande
//*******************************************************************************************
function commander(){
  //init var
	var okCde=false, refProduitCDE, designCoul;
	var designTaille = 0, papierCadeau = "non";
	var cdeProduit, cdeCouleur;  

  // si choix coul == 1
  if (choixCoul == "1"){
  
  		
		// si + de 1 couleur on vérifie si une coul est coché en bouclant sur la tabCoul
		if (longTabCoul > 1){
			for(i=0; i<longTabCoul; i++){
				if(document.formulaire.couleur[i].checked == true){
					cdeCouleur = tabCoul[i];
					okCde=true;
					designCoul=i;
				}
			}
		}
		// si 1 couleur on ne vérifie pas si coché et on désigne le tabCoul[0]
		else{
			i=0;
			cdeCouleur = tabCoul[i];
			okCde=true;
			designCoul=i;
		}
  }
// si pas de choix coul on bloque la verif. à "TRUE"  
  else{
  	okCde=true;
	
  }
  
	// Envoi de la commande ou alert erreur
	// verif si okCde == true (couleur ok)
	if (okCde==true){
		
		var titre=document.formulaire.titre.value;
		
	// blocage des memoires doublons dans le titre
		var resultat = titre.indexOf('<BR>');
		if (resultat>0){
			var resultat2 = titre.indexOf('<br>');
			titre=titre.substring(resultat+4,resultat2);
		}		
		var cde ="";		
		
		//**********************************************		
		// coul et taille
		if(choixCoul == "1" && choixTaille =="1"){		
			refProduitCDE = refProduit+'_'+cdeCouleur+'_'+eval('document.formulaire.taille'+ designCoul +'.value');
		}
		
		//**********************************************
		// coul
		else if(choixCoul == "1" && choixTaille =="0"){	
			refProduitCDE = refProduit +'_'+ cdeCouleur;
		}
		
		//**********************************************		
		// taille	
		else if(choixCoul == "0" && choixTaille =="1"){
			
			refProduitCDE = refProduit +'_'+ document.formulaire.taille.value;
		}
		
		//**********************************************		
		// pas de choix
		else if (choixCoul == "0" && choixTaille =="0"){
			refProduitCDE = refProduit;
			//titre= "______________________________</a><br>" +refProduitCDE+ "<br>Papier Cadeau : "
			
			//alert("commande produit non décliné :\n" + "Référence : " + refProduit);
		}
	
	// LANCEMENT COMMANDE POWER BOUTIQUE
		// Designation variables : Papier cadeaux > option1 et quantité > qte
		//var papierCadeau = document.formulaire.option1.value ;

		var quantite = document.formulaire.qteABK.value ;
		document.formulaire.qte.value=document.formulaire.qteABK.value;		
		
		document.formulaire.option1.value = "</a><br>Réf : "+refProduitCDE+"<br> "+eval("tabTraduction_"+affichLangue)[13]+" :";
		
		cde ='ref='+refProduitCDE+'&type=1&code_lg=lg_'+affichLangue;
		
		document.formulaire.titre.value = titre;
		document.formulaire.action = "com_act.cfm?" + cde;		
		document.formulaire.submit();
	}
	// erreur coul
	else{
		alert("Vous devez préciser la couleur ");
	}
}


//FONCTION ***********************************************************************************	
	//"commandez aujourd'hui, livraison j+3 ouvert":	
	function cdeJour(){
	
	// gestion de l'appel des images boutons et du pop up cde par tel
		var appelLangue = "";
		if(affichLangue == "us")
			appelLangue = "_us";	
	
		var livraison;
		var tabJour_fr = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
		var tabJour_us = new Array("Sunday","Monday","Thuesday","Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Thuesday","Wednesday","Thursday","Friday","Saturday");
		var jour = new Date();
		jour=jour.getDay();
		if ((jour == 0) || (jour == 5) || (jour == 6))
			livraison = 3;
		else{
			livraison = jour + 3;
			if (livraison ==7)
				livraison = 1;
			
		}
		//alert(tabJour[jour]);
		document.write('<a href="#" onclick="window.open(\'livraison'+appelLangue+'.cfm\', \'livraison\', \'location=no,scrollbars=yes,width=800,height=600,top=20,left=20,status=yes,resizable=yes\')"><font color="#ED2D97">'+eval("tabTraduction_"+affichLangue)[4]+' <b>'+eval("tabJour_"+affichLangue)[jour]+'</b>, '+eval("tabTraduction_"+affichLangue)[5]+' <b>'+eval("tabJour_"+affichLangue)[livraison]+'</b></font><br><div><font color="FF0000">&gt;&gt; <b>'+eval("tabTraduction_"+affichLangue)[6]+'</b></font></div></a>');
	}
//***********************************************************************************



// RESOLUTION PB TOUCHE ENTRER SUR QTE 

function actuCde(){
	//formulaire.action="http://www.bestaffaire.fr/boutique/com_act.cfm?ref=QD590&type=32&code_lg=lg_fr";
}		
		