function fValidNewsletterForm(argForm)
{
	if (!argForm.email.value.match(/^[a-z0-9]+([\.\-\_][a-z0-9]+)*@[a-z0-9]+([\.\-][a-z0-9]+)*\.[a-z]{2,}$/i)) {
    	alert ("Vous devez saisir une adresse email valide (ex : prenom.nom@monemail.com)");
		return false;
	} else {
		return true;
	}
}

function fUpdatePanier(id,val) {
	quantite = document.form_panier[id].value;
	quantite = 	parseInt(quantite) + parseInt(val);
	if (quantite < 1) { quantite = 1; }
	if (quantite > 99) { quantite = 99; }
    if (val == 0)  { quantite = 0; }
	document.form_panier[id].value = quantite;
	document.form_panier['mode'].value = "panier_recalculer";
	document.form_panier.submit();
}

function fRecalculerPanier(argForm)
{
	argForm.mode.value="panier_recalculer";
	argForm.submit()
}

function fChiffre(event) {
	// Compatibilité IE / Firefox
	if(!event && window.event) {
		event=window.event;
	}
	// IE
	if((event.keyCode < 48 || event.keyCode > 57) && event.keyCode != 46 && event.keyCode != 8 && event.keyCode != 110 && event.keyCode != 37 && event.keyCode != 39 && event.keyCode != 73) {
		event.returnValue = false;
		event.cancelBubble = true;
	}
	// DOM
	if((event.which < 48 || event.which > 57) && event.which != 46 && event.which != 8 && event.which != 110 && event.which != 37 && event.which != 39 && event.which != 73) {
		event.preventDefault();
		event.stopPropagation();
	}
}

function setChoix(argForm,id){
	argForm.mode.value="produit_detail";
	argForm.submit();
}

function fSubmitFiche(argForm) {
	argForm.submit();
}
					 
var min=10;
var max=24;
function increaseFontSize() {
	var p = document.getElementById('detail_description');
	if(p.style.fontSize) {
		var s = parseInt(p.style.fontSize.replace("px",""));
	} else {
		var s = 13;
	}
	if(s<=max) {
		s += 2;
	}
	p.style.fontSize = s+"px"
}

function decreaseFontSize() {
	var p = document.getElementById('detail_description');
	if(p.style.fontSize) {
		var s = parseInt(p.style.fontSize.replace("px",""));
	} else {
		var s = 13;
	}
	if(s>=min) {
		s -= 2;
	}
	p.style.fontSize = s+"px"
}

function vignette(photo){
	var p = document.getElementById('photo');
	p.src='upload/photos/'+photo;
}

function changeLivraison(argForm,prix) {
	argForm.livraison_prix.value=prix;
}