//Cocher ou décocher toutes les cases d'un formulaire
 var checkflag = "false";
 function check(f) {
 var e = document.panier1.elements ;
 
 if (checkflag == "false") {
 	for (i = 0; i < e.length; i++) {
 	
 if (e[i].type == 'checkbox') {
 e[i].checked = true;
 }
}
 checkflag = "true";
 	return "Tout décocher"; }
 else {
 	for (i = 0; i < e.length; i++) {
 
 if (e[i].type == 'checkbox') {
 e[i].checked = false;
 }
 }
 	checkflag = "false";
 	return "Tout cocher"; }
 }

var t = 0 ;
function coche(frm) {

var z = document.panier1.elements ;

 	for (i = 0; i < z.length; i++) {

if (z[i].type == 'checkbox' && z[i].checked == true) {

t += 1;

}
}


if (t == 0) {

alert('Veuillez cocher au moins une case !') ;
return false;
}
return true ;
}


//verifie une adresse email
function validniouze(form) {

function cleanEmail(email)
{
	var sCleanedEmail = "";
	
    for (var i = 0; i < email.length; i++)
    {
        ch = email.substring(i, i + 1)
        if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
            || (ch == "\@") || (ch == ".") || (ch == "_")
            || (ch == "-") || (ch >= "0" && ch <= "9"))
		{
            sCleanedEmail += ch;
        }
    }
    return sCleanedEmail;
}// cleanEmail


function validateEmail(email)
{
	return ((email.indexOf("\@") != -1) &&		// Contains a '@' character
	    	(email.indexOf(".") != -1));		// Contains a '.' character
}// validateEmail

if (!validateEmail(form.email.value))
	{
		alert ("Désolé, votre adresse email n'a pas un format correct.");
		form.email.focus();
		form.email.select();
		return false;
	}
	
if (form.email.value == "vous@quelquepart.com") { 
alert ("Veuillez saisir votre propre email !") ;
form.email.focus();
form.email.select();
return false; 
}
return true;
}


function Open_new_window(adresse,largeur,hauteur) {
new_win=window.open(adresse,'couv','toolbar=no,scrollbars=yes,resizable=yes,status=no,width='+largeur+',height='+hauteur);
new_win.focus();
}
