function montre(id)	{
    var d = document.getElementById(id);
    for (var i = 1; i<=10; i++)
    {
        if (document.getElementById('smenu'+i))	document.getElementById('smenu'+i).style.display='none';
    }
    if (d)	d.style.display='block';
}

function popup(url,nom,w,h,s) {
    fen=open(url,nom,'width='+w+',height='+h+',toolbar=no,location=no,status=no,menubar=no,scrollbars='+s+',resizable=no');
    fen.focus();
}

function addFav() { 
    if (document.all)	window.external.AddFavorite(location.href, document.title); 
    else 				alert('Vous pouvez faire CTRL + D pour ajouter cette page dans vos signets, ou favoris.');
}

function EnvoiAmi(url) {
    popup('./Outils/EnvoiAmi.php?URL='+url,'EnvoiAmi',650,600);
}

function Imprimer(url) {
    popup(url,'EnvoiAmi',700,400,'yes');
}

function getTheDate(){
    var today = new Date();
    var iday = today.getDay();
    var imonth = today.getMonth();
    var idate = today.getDate();

    var day = new Array();
    var month = new Array();

    day[0] = "Dimanche";
    day[1] = "Lundi";
    day[2] = "Mardi";
    day[3] = "Mercredi";
    day[4] = "Jeudi";
    day[5] = "Vendredi";
    day[6] = "Samedi";

    month[0]  = "Janvier";
    month[1]  = "Février";
    month[2]  = "Mars";
    month[3]  = "Avril";
    month[4]  = "Mai";
    month[5]  = "Juin";
    month[6]  = "Juillet";
    month[7]  = "Août";
    month[8]  = "Septembre";
    month[9]  = "Octobre";
    month[10] = "Novembre";
    month[11] = "Décembre";

    var s;
    s = day[iday] + ' ' + idate + ' ' + month[imonth];


    return s;
}

function addCatalogue(elt) {
	if (elt.checked) {
		textarea=document.getElementById('commentaires');
		val="Je souhaite recevoir le catalogue\n"+textarea.value;
		textarea.value=val;
	}

}
function controlPaiement(cb) {

if (cb==true) {
			cb=document.getElementById("cb");
			var res=updatePaiement(document.getElementById('cmd').value);
			if (res==true) cb.submit();
			return false;
		}

for (var i=0;i<paiement.length;i++) {
	val=document.getElementById("p"+paiement[i]).checked;
	
	if (val) { 
		if (paiement[i]==1) {
			cb=document.getElementById("cb");
			var res=updatePaiement(document.getElementById('cmd').value);
			if (res==true) cb.submit();
			return false;
	
		}
		document.getElementById("mode_paiement").value=paiement[i];
		form=document.getElementById("choixPaiement");
		form.submit();
		return false;
		
	}

}
alert("Vous devez saisir un mode de paiement");
return false;
}


function updatePaiement(cmd) {
		s="mod=processus_commande&action=updatePaiement&commande="+cmd;
		s+="&commentaires="+document.getElementById('commentaires').value+"&mode=1";
		// on utilise json 
		var mess=json_form(s,"ajax.php");
		if (mess!="ok") { 
			alert(mess);
			return false;
		}
		else {
			return true;
		}
}	

function abonne(etat,email) {

		if (etat==true) s="mod=emailing&action=abonne&email="+email;
		else s="mod=emailing&action=desabonne&email="+email;			
		json_form(s,"ajax.php");


}
