function checkForm(){
	var theForm = document.ajout_panier;
	if ((theForm.total.value=="0") || (theForm.total.value==""))  {
		alert("Please chose at least one product");
		return;
	}
	if ((theForm.fdp.value=="0") || (theForm.fdp.value=="")) {
		alert("Please chose a country for delivery");
		return;
	}
	if (theForm.pays.value=="") {
		alert("Please chose a country for delivery");
		return;
	}
	theForm.action="index.php";
	theForm.submit();
}

function verif_nombre(champ) {
	var chiffres = new RegExp("[0-9]");
	var verif;
	for(x = 0; x < champ.value.length; x++) {
		verif = chiffres.test(champ.value.charAt(x));
		if(verif == false){
			champ.value = champ.value.substr(0,x) + champ.value.substr(x+1,champ.value.length-x+1);
			x--;
		}
	}
}

function FunctionTotaux() {
	var total = 0;
	var fdp = 0;
	var theForm = document.ajout_panier;
	total = theForm.total.value;
	if (total=="")
		total = 0;
	fdp = theForm.fdp.value;
	if (fdp=="")
		fdp = 0;
	totaux = (parseInt(total) + parseInt(fdp));
	theForm.totaux.value=totaux;
	theForm.totaux2.value=totaux;
}

function FunctionTotal(pays) {
	var total = 0;
	var nb_normaux = 0;
	var nb_fontaines = 0;
	price1 = unescape('%31%36%35');
	price2 = unescape('%32%30%30%30');
	price3 = unescape('%31%33%38%30');
	price4 = unescape('%36%35');
	price5 = unescape('%39%35');
	price6 = unescape('%34%35');
	price7 = unescape('%31%34%30');
	price8 = unescape('%32%39%35');
	price9 = unescape('%32%35%30');
	price10 = unescape('%36%39');
	var theForm = document.ajout_panier;
	pays = theForm.pays.value;
	/*total = theForm.total.value;
	total = (parseInt(total) + (parseInt(euro) * parseInt(nbr.value)));
	theForm.total.value=total;*/
//	alert(pays);
	if (theForm.preludelove1.value!="") {
		total = total + (price1*parseInt(theForm.preludelove1.value));
		nb_normaux += parseInt(theForm.preludelove1.value);
	}/*
	if (theForm.preludelove2.value!="") {
		total = total + (price2*parseInt(theForm.preludelove2.value));
		nb_fontaines += parseInt(theForm.preludelove2.value);
	}
	if (theForm.preludelove3.value!="") {
		total = total + (price3*parseInt(theForm.preludelove3.value));
		nb_normaux += parseInt(theForm.preludelove3.value);
	}*/
	if (theForm.preludelove5.value!="") {
		total = total + (price5*parseInt(theForm.preludelove5.value));
		nb_normaux += parseInt(theForm.preludelove5.value);
	}
	if (theForm.preludelove6.value!="") {
		total = total + (price6*parseInt(theForm.preludelove6.value));
		nb_normaux += parseInt(theForm.preludelove6.value);
	}
	/*if (theForm.preludelove7.value!="") {
		total = total + (price7*parseInt(theForm.preludelove7.value));
		nb_normaux += parseInt(theForm.preludelove7.value);
	}*/
	if (theForm.preludelove8.value!="") {
		total = total + (price10*parseInt(theForm.preludelove8.value));
		nb_normaux += parseInt(theForm.preludelove8.value);
	}
	if (theForm.love1.value!="") {
		total = total + (price1*parseInt(theForm.love1.value));
		nb_normaux += parseInt(theForm.love1.value);
	}/*
	if (theForm.love2.value!="") {
		total = total + (price2*parseInt(theForm.love2.value));
		nb_fontaines += parseInt(theForm.love2.value);
	}
	if (theForm.love3.value!="") {
		total = total + (price3*parseInt(theForm.love3.value));
		nb_normaux += parseInt(theForm.love3.value);
	}*/
	if (theForm.love4.value!="") {
		total = total + (price4*parseInt(theForm.love4.value));
		nb_normaux += parseInt(theForm.love4.value);
	}
	if (theForm.love5.value!="") {
		total = total + (price5*parseInt(theForm.love5.value));
		nb_normaux += parseInt(theForm.love5.value);
	}
	if (theForm.love6.value!="") {
		total = total + (price6*parseInt(theForm.love6.value));
		nb_normaux += parseInt(theForm.love6.value);
	}
	/*if (theForm.love7.value!="") {
		total = total + (price7*parseInt(theForm.love7.value));
		nb_normaux += parseInt(theForm.love7.value);
	}*/
	if (theForm.love8.value!="") {
		total = total + (price10*parseInt(theForm.love8.value));
		nb_normaux += parseInt(theForm.love8.value);
	}
	if (theForm.beyond1.value!="") {
		total = total + (price1*parseInt(theForm.beyond1.value));
		nb_normaux += parseInt(theForm.beyond1.value);
	}/*
	if (theForm.beyond2.value!="") {
		total = total + (price2*parseInt(theForm.beyond2.value));
		nb_fontaines += parseInt(theForm.beyond2.value);
	}
	if (theForm.beyond3.value!="") {
		total = total + (price3*parseInt(theForm.beyond3.value));
		nb_normaux += parseInt(theForm.beyond3.value);
	}*/
	if (theForm.beyond4.value!="") {
		total = total + (price4*parseInt(theForm.beyond4.value));
		nb_normaux += parseInt(theForm.beyond4.value);
	}
	if (theForm.beyond5.value!="") {
		total = total + (price5*parseInt(theForm.beyond5.value));
		nb_normaux += parseInt(theForm.beyond5.value);
	}
	if (theForm.beyond6.value!="") {
		total = total + (price6*parseInt(theForm.beyond6.value));
		nb_normaux += parseInt(theForm.beyond6.value);
	}
	/*if (theForm.beyond7.value!="") {
		total = total + (price7*parseInt(theForm.beyond7.value));
		nb_normaux += parseInt(theForm.beyond7.value);
	}*/
	if (theForm.beyond8.value!="") {
		total = total + (price10*parseInt(theForm.beyond8.value));
		nb_normaux += parseInt(theForm.beyond8.value);
	}
	if (theForm.liaison1.value!="") {
		total = total + (price1*parseInt(theForm.liaison1.value));
		nb_normaux += parseInt(theForm.liaison1.value);
	}/*
	if (theForm.liaison2.value!="") {
		total = total + (price2*parseInt(theForm.liaison2.value));
		nb_fontaines += parseInt(theForm.liaison2.value);
	}
	if (theForm.liaison3.value!="") {
		total = total + (price3*parseInt(theForm.liaison3.value));
		nb_normaux += parseInt(theForm.liaison3.value);
	}*/
	if (theForm.liaison4.value!="") {
		total = total + (price4*parseInt(theForm.liaison4.value));
		nb_normaux += parseInt(theForm.liaison4.value);
	}
	if (theForm.liaison5.value!="") {
		total = total + (price5*parseInt(theForm.liaison5.value));
		nb_normaux += parseInt(theForm.liaison5.value);
	}
	if (theForm.liaison6.value!="") {
		total = total + (price6*parseInt(theForm.liaison6.value));
		nb_normaux += parseInt(theForm.liaison6.value);
	}
	/*if (theForm.liaison7.value!="") {
		total = total + (price7*parseInt(theForm.liaison7.value));
		nb_normaux += parseInt(theForm.liaison7.value);
	}*/
	if (theForm.liaison8.value!="") {
		total = total + (price10*parseInt(theForm.liaison8.value));
		nb_normaux += parseInt(theForm.liaison8.value);
	}
	if (theForm.cruel1.value!="") {
		total = total + (price1*parseInt(theForm.cruel1.value));
		nb_normaux += parseInt(theForm.cruel1.value);
	}/*
	if (theForm.cruel2.value!="") {
		total = total + (price2*parseInt(theForm.cruel2.value));
		nb_fontaines += parseInt(theForm.cruel2.value);
	}
	if (theForm.cruel3.value!="") {
		total = total + (price3*parseInt(theForm.cruel3.value));
		nb_normaux += parseInt(theForm.cruel3.value);
	}*/
	if (theForm.cruel4.value!="") {
		total = total + (price4*parseInt(theForm.cruel4.value));
		nb_normaux += parseInt(theForm.cruel4.value);
	}
	if (theForm.cruel5.value!="") {
		total = total + (price5*parseInt(theForm.cruel5.value));
		nb_normaux += parseInt(theForm.cruel5.value);
	}
	if (theForm.cruel6.value!="") {
		total = total + (price6*parseInt(theForm.cruel6.value));
		nb_normaux += parseInt(theForm.cruel6.value);
	}
	/*if (theForm.cruel7.value!="") {
		total = total + (price7*parseInt(theForm.cruel7.value));
		nb_normaux += parseInt(theForm.cruel7.value);
	}*/
	if (theForm.cruel8.value!="") {
		total = total + (price10*parseInt(theForm.cruel8.value));
		nb_normaux += parseInt(theForm.cruel8.value);
	}
	if (theForm.heaven1.value!="") {
		total = total + (price1*parseInt(theForm.heaven1.value));
		nb_normaux += parseInt(theForm.heaven1.value);
	}/*
	if (theForm.heaven2.value!="") {
		total = total + (price2*parseInt(theForm.heaven2.value));
		nb_fontaines += parseInt(theForm.heaven2.value);
	}
	if (theForm.heaven3.value!="") {
		total = total + (price3*parseInt(theForm.heaven3.value));
		nb_normaux += parseInt(theForm.heaven3.value);
	}*/
	if (theForm.heaven4.value!="") {
		total = total + (price4*parseInt(theForm.heaven4.value));
		nb_normaux += parseInt(theForm.heaven4.value);
	}
	if (theForm.heaven5.value!="") {
		total = total + (price5*parseInt(theForm.heaven5.value));
		nb_normaux += parseInt(theForm.heaven5.value);
	}
	if (theForm.heaven6.value!="") {
		total = total + (price6*parseInt(theForm.heaven6.value));
		nb_normaux += parseInt(theForm.heaven6.value);
	}
	/*if (theForm.heaven7.value!="") {
		total = total + (price7*parseInt(theForm.heaven7.value));
		nb_normaux += parseInt(theForm.heaven7.value);
	}*/
	if (theForm.heaven8.value!="") {
		total = total + (price10*parseInt(theForm.heaven8.value));
		nb_normaux += parseInt(theForm.heaven8.value);
	}
	if (theForm.straight1.value!="") {
		total = total + (price1*parseInt(theForm.straight1.value));
		nb_normaux += parseInt(theForm.straight1.value);
	}/*
	if (theForm.straight2.value!="") {
		total = total + (price2*parseInt(theForm.straight2.value));
		nb_fontaines += parseInt(theForm.straight2.value);
	}
	if (theForm.straight3.value!="") {
		total = total + (price3*parseInt(theForm.straight3.value));
		nb_normaux += parseInt(theForm.straight3.value);
	}*/
	if (theForm.straight4.value!="") {
		total = total + (price4*parseInt(theForm.straight4.value));
		nb_normaux += parseInt(theForm.straight4.value);
	}
	if (theForm.straight5.value!="") {
		total = total + (price5*parseInt(theForm.straight5.value));
		nb_normaux += parseInt(theForm.straight5.value);
	}
	if (theForm.straight6.value!="") {
		total = total + (price6*parseInt(theForm.straight6.value));
		nb_normaux += parseInt(theForm.straight6.value);
	}
	/*if (theForm.straight7.value!="") {
		total = total + (price7*parseInt(theForm.straight7.value));
		nb_normaux += parseInt(theForm.straight7.value);
	}*/
	if (theForm.straight8.value!="") {
		total = total + (price10*parseInt(theForm.straight8.value));
		nb_normaux += parseInt(theForm.straight8.value);
	}
	if (theForm.back2black1.value!="") {
		total = total + (price1*parseInt(theForm.back2black1.value));
		nb_normaux += parseInt(theForm.back2black1.value);
	}/*
	if (theForm.back2black2.value!="") {
		total = total + (price2*parseInt(theForm.back2black2.value));
		nb_fontaines += parseInt(theForm.back2black2.value);
	}
	if (theForm.back2black3.value!="") {
		total = total + (price3*parseInt(theForm.back2black3.value));
		nb_normaux += parseInt(theForm.back2black3.value);
	}*/
	if (theForm.back2black4.value!="") {
		total = total + (price4*parseInt(theForm.back2black4.value));
		nb_normaux += parseInt(theForm.back2black4.value);
	}
	if (theForm.back2black5.value!="") {
		total = total + (price5*parseInt(theForm.back2black5.value));
		nb_normaux += parseInt(theForm.back2black5.value);
	}
	if (theForm.back2black6.value!="") {
		total = total + (price6*parseInt(theForm.back2black6.value));
		nb_normaux += parseInt(theForm.back2black6.value);
	}
	/*if (theForm.back2black7.value!="") {
		total = total + (price7*parseInt(theForm.back2black7.value));
		nb_normaux += parseInt(theForm.back2black7.value);
	}*/
	if (theForm.back2black8.value!="") {
		total = total + (price10*parseInt(theForm.back2black8.value));
		nb_normaux += parseInt(theForm.back2black8.value);
	}
	if (theForm.collection1.value!="") {
		total = total + (price5*parseInt(theForm.collection1.value));
		nb_normaux += parseInt(theForm.collection1.value);
	}/*
	if (theForm.arabian1.value!="") {
		total = total + (price8*parseInt(theForm.arabian1.value));
		nb_normaux += parseInt(theForm.arabian1.value);
	}*/
	if (theForm.arabian2.value!="") {
		total = total + (price8*parseInt(theForm.arabian2.value));
		nb_normaux += parseInt(theForm.arabian2.value);
	}
	if (theForm.arabian3.value!="") {
		total = total + (price9*parseInt(theForm.arabian3.value));
		nb_normaux += parseInt(theForm.arabian3.value);
	}
	if (theForm.arabian4.value!="") {
		total = total + (price8*parseInt(theForm.arabian4.value));
		nb_normaux += parseInt(theForm.arabian4.value);
	}
	if (theForm.arabian5.value!="") {
		total = total + (price9*parseInt(theForm.arabian5.value));
		nb_normaux += parseInt(theForm.arabian5.value);
	}
	
//alert (parseInt(total));
	theForm.total.value=parseInt(total);
	theForm.total2.value=parseInt(total);
	if (pays=="France")
		var fdp = ( Math.ceil( nb_normaux / 2 ) * 10 ) + ( nb_fontaines * 100 );
	else if (pays=="USA")
		var fdp = ( Math.ceil( nb_normaux / 2 ) * 50 ) + ( nb_fontaines * 250 );
	else
		var fdp = ( Math.ceil( nb_normaux / 2 ) * 20 ) + ( nb_fontaines * 180 );
	theForm.fdp.value = fdp;
	theForm.fdp2.value = fdp;
	
	FunctionTotaux();
	
	if (pays=="USA") {
		document.getElementById('result').innerHTML = "For US residents, you can also shop with our US retail  partners: <a href='http://www.luckyscent.com/' target='_blank'>www.luckyscent.com</a>, <a href='http://www.aedes.com/' target='_blank'>www.aedes.com</a> or <a href='http://www.saks.com/' target='_blank'>www.saks.com</a>";
		document.getElementById('result').style.height = "30px";
	}
	else {
		document.getElementById('result').innerHTML = "";
		document.getElementById('result').style.height = "0px";
	}
}

function FunctionFdp(champ) {
	FunctionTotal();
	/*var theForm = document.ajout_panier;
	theForm.fdp.value=theForm.pays.options[theForm.pays.selectedIndex].value;
	theForm.fdp2.value=theForm.pays.options[theForm.pays.selectedIndex].value;
	FunctionTotaux();*/
}

var theDoc = document;
function displaySend() {
	var theForm = document.ajout_panier;
	if (theDoc.getElementById("IdDisplaySend").style.display=="none") {
		theDoc.getElementById("IdDisplaySend").style.display="block";
		swap_m('IdImgSend','checkbox1');
	}
	else {
		theDoc.getElementById("IdDisplaySend").style.display="none";
		swap_m('IdImgSend','checkbox');
	}
}