chemPhotosArticles = "../../bibliotheque/article/";
chemLegendesArticles = "../../bibliotheque/article/FR/";
chemColoris = "../../bibliotheque/coloris/";
chemPhotosCategories =  "../../bibliotheque/categorie/";
chemLegendesCategories =  "../../bibliotheque/categorie/FR/";
chemImages = "../../assets/images/";
chemImagesLG = "../../assets/images/FR/";

// roll over bouton //
function ChangeBt(bouton,sens) {
     document.getElementById(bouton).src=eval(bouton+sens+".src");
}

// changement d'état des puces homme-femme-unisexe //
function ChangePicto(picto,type,sens) {
     document.getElementById(picto).src=eval("puce"+type+sens+".src");

}

// roll over bouton ajout panier //
function ChangePanier(picto,type,sens) {
     document.getElementById(picto).src=eval(type+sens+".src");

}

// ouverture popup //
function OuvFen(page, nom, param) {
     mafenetre = window.open(page,nom,param);
     mafenetre.document.close();
     mafenetre.focus();
}

// défilement photos //
var numPhoto = 1;
function TournePhoto(sens) {
     numPhoto = numPhoto + sens;
     if (numPhoto > maxPhotos) numPhoto=1;
     if (numPhoto ==0) numPhoto=maxPhotos;
     photo.src=eval("photo"+numPhoto+".src");

}


function format_number(nbre)
{
	nbre = nbre.toString();
	var pos = nbre.indexOf(".");
	var decimales = nbre.substr(pos);
	if(pos==-1)
	{	return(nbre+".00");}
	else
	{
		if(decimales.length==2)
		{	return(nbre+"0");}
		else
		{	return(nbre);}
	}
}

// défilement coloris //
function TourneColori(sens) {
     numColori = numColori + sens;
	 if (numColori >= maxColoris) numColori=0;
     if (numColori ==-1) numColori=maxColoris-1;
	 
	 
	if(ListeColoris[numColori]!='38_mini.jpg')
	{
    	document.getElementById('colori').src=eval("colori"+numColori+".src");	  		
		document.getElementById('NomColoris').innerHTML=ListeNomColoris[numColori];
	}
	
	document.getElementById("IdColoris").value = ListeColoris[numColori].substring(0, ListeColoris[numColori].indexOf("_",0));
	
	if(Zoom[numColori]==1)
	{	document.getElementById('colori').onclick=ZoomColoris;
		document.getElementById('colori').title="agrandir l'échantillon";
		document.getElementById('colori').style.cursor="pointer";}
	else
	{	document.getElementById('colori').onclick=PasDeZoom;
		document.getElementById('colori').title="";
		document.getElementById('colori').style.cursor="auto";}
	
	var taille = document.getElementById('IdTaillePoids').value;  
	
	//pas de promo
	 if(eval("ListePromo"+taille+"["+numColori+"]")=="0.00")
	 {
	 	document.getElementById('tablePrixBarre').style.backgroundImage='url(none)';
		document.getElementById('PrixBarre').innerHTML="";
		document.getElementById('prixunitaireHT').value=eval("ListePrixHT"+taille+"["+numColori+"]")+"";
	 	var total = Math.round(parseFloat(eval("ListePrixHT"+taille+"["+numColori+"]"))*parseFloat(document.getElementById('quantite').value)*100)/100;
	 	document.getElementById('prixtotalHT').value=format_number(total)+" €";
		
		document.getElementById('prixunitaireTTC').value=eval("ListePrixTTC"+taille+"["+numColori+"]")+"";
	 	var total = Math.round(parseFloat(eval("ListePrixTTC"+taille+"["+numColori+"]"))*parseFloat(document.getElementById('quantite').value)*100)/100;
	 	document.getElementById('prixtotalTTC').value=format_number(total)+" €";
	 }
	 else
	 // promo
	 {
	 	document.getElementById('tablePrixBarre').style.backgroundImage='url(../../assets/images/onglet_non_reduction.gif)';
		document.getElementById('PrixBarre').innerHTML="<STRIKE>"+eval("ListePrixTTC"+taille+"["+numColori+"]");+"</STRIKE>";
		
		document.getElementById('prixunitaireHT').value = Math.round((parseFloat(eval("ListePrixHT"+taille+"["+numColori+"]"))-(parseFloat(eval("ListePrixHT"+taille+"["+numColori+"]"))*parseFloat(eval("ListePromo"+taille+"["+numColori+"]"))/100))*100)/100+" €";
		var total = Math.round((parseFloat(document.getElementById('prixunitaireHT').value)*parseFloat(document.getElementById('quantite').value))*100)/100;
	 	document.getElementById('prixtotalHT').value=format_number(total)+" €";
		
		document.getElementById('prixunitaireTTC').value = Math.round((parseFloat(eval("ListePrixTTC"+taille+"["+numColori+"]"))-(parseFloat(eval("ListePrixTTC"+taille+"["+numColori+"]"))*parseFloat(eval("ListePromo"+taille+"["+numColori+"]"))/100))*100)/100+" €";
		var total = Math.round((parseFloat(document.getElementById('prixunitaireTTC').value)*parseFloat(document.getElementById('quantite').value))*100)/100;
	 	document.getElementById('prixtotalTTC').value=format_number(total)+" €";
		//window.alert(format_number(total));
	 }
	 
	 if(eval("ListeIndispo"+taille+"["+numColori+"]")=="dispo")
	 {
	 	document.getElementById('DivIndisponible').style.visibility = "hidden";
		document.getElementById('DivDateDispo').style.visibility = "hidden";
	}
	else
	{
		document.getElementById('DivIndisponible').style.visibility = "visible";
		document.getElementById('DivDateDispo').innerHTML = "disponible le<BR>"+eval("ListeDateDispo"+taille+"["+numColori+"]");
		document.getElementById('DivDateDispo').style.visibility = "visible";
	}

}

