function aaa(){
	document.getElementById('zzz').style.display="none";
}

// PNG transparent sous internet Explorer
function IE_CorrectAlpha_PNG(){ 
	for(i=0; i<document.images.length; i++){ 
		img    = document.images[i]; 
		imgExt  = img.src.substring(img.src.length-3, img.src.length); 
		imgExt  = imgExt.toUpperCase(); 
		if (imgExt == "PNG"){ 
			imgID    = (img.id) ? "id='" + img.id + "' " : ""; 
			imgClass= (img.className) ? "class='" + img.className + "' " : ""; 
			imgTitle= (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "; 
			imgStyle= "display:inline-block;" + img.style.cssText; 
			if (img.align == "left") { 
				imgStyle = "float:left;"  + imgStyle; 
			} else if (img.align == "right"){ 
				imgStyle = "float:right;" + imgStyle; 
			} 
			if (img.parentElement.href){ 
				imgStyle = "cursor:hand;" + imgStyle; 
			}        
			strNewHTML    = '<span '+imgID+imgClass+imgTitle+' style="width:'+img.width+'px; height:'+img.height+'px;'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.src+'\', sizingMethod=\'scale\');"></span>'; 
			img.outerHTML = strNewHTML; 
			i = i-1;
		}
	}
} 
window.attachEvent("onload", IE_CorrectAlpha_PNG)
/* Popup impression produit */
function popupPdtImprimer(prod){
	titre="Impression";
	w=open("popup-imprimer-produit.php?prod="+prod,"impression","width=400,height=400,toolbar=no,scrollbars=yes,resizable=no,top=0,left=0");
	w.document.close();
}
/* Popup calculatrice fianet */
function popUpCalculatrice(prix){
	w=open("https://secure.fia-net.com/wallet/customer/calculette.php?MerchantID=6931&Amount="+prix,"financement","width=618,height=505,toolbar=no,scrollbars=yes,resizable=no,top=0,left=0");
	//w.document.close();
}
/* Popup image centré + lien fermer */
function PopupImage(img) {
	titre="Agrandissement";
	w=open("popup-agrandissement.php?img="+img,"image","width=400,height=400,toolbar=no,scrollbars=no,resizable=no,top=0,left=0");
	w.document.close();
}
/* Chargement des pages à partir d'un menu Flash */
function chargePage(page) {
	top.location.href=page+".php";
}
/* Validation javascript des champs */
function arobaceok(email)
{
	if(document.formVousEtes.email.value == ""){
		alert("Il manque votre adresse e-mail!");
		return false;
	}
	var a=document.forms[0].email.value;
	var test="" + a;
	for(var k = 0; k < test.length;k++)
		{
		var c = test.substring(k,k+1);
		if(c == "@")
		{
		return true;
		}
	}
	alert("La syntaxe de votre e-mail est incorrect !");
	return false;
}
/* changer l'image en grand sur la fiche produit */
function changerImage(div1,div2,img){
	dir1 = "images/produits/moyennes/"+img;
	dir2 = "javascript:PopupImage('images/produits/grandes/"+img+"');";
	document.getElementById(div1).src=dir1;
	document.getElementById(div2).href=dir2;
}
// decompte du temps
// id : id de la balise dans laquelle le temps restant sera affiché
// d : nombre de jour
// h : nombre d'heure
// m : nombre de minutes
// s : nombre de seconde
function decompte(id,d,h,m,s){
	t = 1000;
	
	if(h==0 && m==0 && s==0 && d==0){location.reload();}
	
	//construction du texte
	txt = "Reste : ";
	if(d==1){ txt += "1 jour ";}
	if(d>1){ txt += d+" jours ";}
	if(d<1){
		if(h==1){ txt += "1 h ";}
		if(h>1){ txt += h+" h ";}
		if(m==1){ txt += "1 min ";}
		if(m>1){ txt += m+" min ";}
		if(h<1){
			if(s==1 || s==0){ txt += s+" '' ";}
			if(s>1){ txt += s+" '' ";}
		}
		
	}
	
	//affichage
	document.getElementById(id).innerHTML = txt;
	
	//decompte
	s--;
	if(s==-1 && m>0){s=59;m--;}
	if(m==-1 && h>0){m=59;h--;}
	if(h==-1 && d>0){h=23;d--;}
	
	//on relance la fonction
	fct = "decompte('"+id+"','"+d+"','"+h+"','"+m+"','"+s+"')";
	//alert(fct);
	setTimeout(fct,t);
}
// decompte du temps avec affichage complet
// id : id de la balise dans laquelle le temps restant sera affiché
// d : nombre de jour
// h : nombre d'heure
// m : nombre de minutes
// s : nombre de seconde
function decompteComplet(id,d,h,m,s){
	t = 1000;
	
	if(h==0 && m==0 && s==0 && d==0){location.reload();}
	
	//construction du texte
	txt = "";
	if(d==1){ txt += "1 jour ";}
	if(d>1){ txt += d+" jours ";}
	if(h==1){ txt += "1 heure ";}
	if(h>1){ txt += h+" heures ";}
	if(m==1){ txt += "1 minute ";}
	if(m>1){ txt += m+" minutes ";}
	if(s==1 || s==0){ txt += s+" seconde ";}
	if(s>1){ txt += s+" secondes ";}
	
	//affichage
	document.getElementById(id).innerHTML = txt;
	
	//decompte
	s--;
	if(s==-1 && m>0){s=59;m--;}
	if(m==-1 && h>0){m=59;h--;}
	if(h==-1 && d>0){h=23;d--;}
	
	//on relance la fonction
	fct = "decompteComplet('"+id+"','"+d+"','"+h+"','"+m+"','"+s+"')";
	//alert(fct);
	setTimeout(fct,t);
}
//fonction aller à la page x
function allerA(page){
	if(page!=""){
		document.location = page;
	}
}
//fonction aller à la page x
function parentAllerA(page){
	if(page!=""){
		window.opener.document.location = page;
		window.close();
	}
}

//AJOUT DANS LE PANIER
function ajoutProduitPanier(id_produit)
{
	sizePanier();
	from = document.location.href;
	document.getElementById('AddToBasket').setAttribute("src", 'ajout-panier.php?id_produit=' + id_produit + '&from=' + from);
}
function ajoutOptionPanier(id_produit,id_option)
{
	sizePanier();
	from = document.location.href;
	document.getElementById('AddToBasket').setAttribute("src", 'ajout-panier.php?id_produit=' + id_produit + '&id_option=' + id_option + '&from=' + from);
}
function poursuivreCommande(){
	if(document.getElementById('cgv').checked){
		document.location = "identification.php";
	}else{
		alert("Vous devez accepter les Conditions Générales de Ventes pour poursuivre votre commande.");
	}
}
function confirmerCommande(){
	r1a = document.getElementById('radio1a');
	r1b = document.getElementById('radio1b');
	//r2 = document.getElementById('radio2');
	r3 = document.getElementById('radio3');
	id_cmd = document.getElementById('id_commande').value;
	
	if(r1a.checked){
		//document.location = "fianet-requete.php?id_commande="+id_cmd;
		document.formFIACPT.submit();
		//alert ("Le système de paiement en ligne \"Receive and Pay\" est en cours d'installation.");
	/*}else if(r2.checked){
		document.location = "call_request.php?id_commande="+id_cmd;
		//alert ("Le système de paiement en ligne de la LCL est en cours d'installation.");*/
	}else if(r1b.checked){
		document.formFIACRED.submit();
	}else if(r3.checked){
		document.location = "recapitulatif-commande.php?id_commande="+id_cmd+"&paiement=Chèque";
	}else{
		alert ("Vous devez choisir un mode de paiement.");
	}
}
/* Popup comparateur */
function popupComparer(){
	titre="comparateurMidimusic";
	prod1 = document.getElementById('prod1').value;
	prod2 = document.getElementById('prod2').value;
	prod3 = document.getElementById('prod3').value;
	prod4 = document.getElementById('prod4').value;
	typeComp = document.getElementById('typeComp').value;
	idType = document.getElementById('idType').value;
	w=open("popup-comparateur.php?prod1="+prod1+"&prod2="+prod2+"&prod3="+prod3+"&prod4="+prod4+"&typeComp="+typeComp+"&idType="+idType,"comparateur","width=400,height=400,toolbar=no,scrollbars=yes,resizable=yes,top=0,left=0");
	//w=open("popup-comparateur.php","comparateurMidimusic","width=400,height=400,toolbar=no,scrollbars=yes,resizable=yes,top=0,left=0");
	w.document.close();
}
/* option fiche produit */
function affCacheDetProd(qui, combien){
	for(i = 1; i<= combien; i++ ){
		if (qui=="Det"+i){
			document.getElementById("layerDet"+i).style.display="block";
			document.getElementById("imgDet-"+i).src="images/defaut/interface/imgDet-"+i+"-on.jpg";
		}else{
			document.getElementById("layerDet"+i).style.display="none";
			document.getElementById("imgDet-"+i).src="images/defaut/interface/imgDet-"+i+"-off.jpg";
		}
	}
}
/* avis fiche produit */
function affCacheAvProd(qui, combien){
	for(i = 1; i<= combien; i++ ){
		if (qui=="Av"+i){
			document.getElementById("layerAv"+i).style.display="block";
			document.getElementById("imgAv-"+i).src="images/defaut/interface/imgAv-"+i+"-on.jpg";
		}else{
			document.getElementById("layerAv"+i).style.display="none";
			document.getElementById("imgAv-"+i).src="images/defaut/interface/imgAv-"+i+"-off.jpg";
		}
	}
}
//coher un produit a comparer
function checkComparer(elt){
	nb = parseInt(document.getElementById('nbCheck').value);
	prod = "prod" + (nb+1);
	
	if(elt.checked){
		if(nb<4){
			elt.checked=true;
			document.getElementById('nbCheck').value = nb+1;
			document.getElementById(prod).value = elt.value;
		}else{
			alert("Vous avez déjà selectionné 4 articles");
			elt.checked=false;
		}
	}else{
		document.getElementById('nbCheck').value = nb-1;
		for(i=1;i<=4;i++){
			prod = "prod" + i;
			if(document.getElementById(prod).value == elt.value){
				document.getElementById(prod).value = "";
			}
		}
		for(i=1;i<4;i++){
			prod = "prod" + i;
			if(document.getElementById(prod).value == ""){
				for(j=i;j<4;j++){
					prod1 = "prod" + j;
					prod2 = "prod" + (j+1);
					document.getElementById(prod1).value = document.getElementById(prod2).value;
				}
				document.getElementById('prod4').value = '';
			}
		}
		elt.checked=false;
	}
}
/* Popup impression produit */
function popupPdtImprimer(prod){
	titre="Impression";
	w=open("popup-imprimer-produit.php?prod="+prod,"impression","width=400,height=400,toolbar=no,scrollbars=yes,resizable=no,top=0,left=0");
	w.document.close();
}

/* affichage des coordonnées de livraison */
function coordonneesLivraison(){
	bt = document.getElementById('livraison');
	table = document.getElementById('tableLivraison');
	if(bt.checked){
		table.className="undisplay";
		document.getElementById('civL1').checked=false;
		document.getElementById('civL2').checked=false;
		document.getElementById('civL3').checked=false;
		document.getElementById('nomL').value="";
		document.getElementById('prenomL').value="";
		document.getElementById('adresseL').value="";
		document.getElementById('adresseL2').value="";
		document.getElementById('cpL').value="";
		document.getElementById('villeL').value="";
	}else{
		table.className="display";
		/*if(document.getElementById('civ1').checked){document.getElementById('civL1').checked=true;}
		if(document.getElementById('civ2').checked){document.getElementById('civL2').checked=true;}
		if(document.getElementById('civ3').checked){document.getElementById('civL3').checked=true;}
		document.getElementById('nomL').value=document.getElementById('nom').value;
		document.getElementById('prenomL').value=document.getElementById('prenom').value;
		document.getElementById('adresseL').value=document.getElementById('adresse').value;
		document.getElementById('adresseL2').value=document.getElementById('adresse2').value;
		document.getElementById('cpL').value=document.getElementById('cp').value;
		document.getElementById('villeL').value=document.getElementById('ville').value;*/
	}
}