var image="selected";

function MsgBox(Titre,Texte,source){
var html="";
        html+="<table width='500' style='border:1px #000000 solid;' border='0' cellspacing='0' style='border:1 #3333AA solid;'>";
        html+="<tr><td style='background-color:#AAAAAA;color:#EEEEEE;border:1px #000000 solid;'><b style='font-family:times new roman;font-size:20px;'>"+Titre+"</b></td></tr>";
        html+="<tr><td style='background-color:#EEEEEE' align='center'><br><b style='font-family:times new roman;font-size:24px;color:#555555'>"+Texte+"</b></td></tr>";
        html+="<tr style='background-color:#EEEEEE'><td>&nbsp;</td></tr><tr>";              
        html+="<td align='center' style='background-color:#EEEEEE'><input type='button' class='button' style='background-color:#DDDDDD;color:#000000;' onclick='javascript:";
        html+="MsgB.style.visibility=\"hidden\"' value='Fermer' /></td></tr>";
        html+="<tr style='background-color:#EEEEEE'><td style='height:10px;'></td></tr></table>";
    source.innerHTML=html;
    //alert(source.);
    source.style.visibility="visible";
}

function MouseOver(id){
id.style.backgroundImage="url(images/select_m.jpg)";
id.style.color="#000000";
id.style.cursor="pointer";
}

function MouseOut(id){
id.style.backgroundImage="url(images/menu.jpg)";
id.style.color="#FFFFFF";
}

// ************************************************
//            Tester la validité de l'email s
//  ***********************************************

function Verifmail(s){
adresse_email = s;
if (adresse_email != ""){
arobase = adresse_email.indexOf("@");
point = adresse_email.indexOf(".",arobase);
mauvais_endroit_point = arobase+1;
double_point = adresse_email.indexOf("..",arobase);
nbre_carac = adresse_email.length - point;
double_arobase = adresse_email.indexOf("@",arobase+1);

if ( (arobase < 1) ||  
    (point <= mauvais_endroit_point) || 
    (adresse_email.length < 5) || 
    (double_point >= 0) ||
    (nbre_carac < 3) ||
    (double_arobase >= 0) )
   {
   return false;
    }else return true;
 }else return true;
 }


// **************************************************




function notVide(form,tab,source){    
    var ok=false;
    var champvide=null;
    var i=0;
    //for(i=0;i<tab.length;i++) alert(form.elements[tab[i]].name);
    while(i < tab.length && ! ok){
        if(form.elements[tab[i]].value==""){
			ok=true;
            champvide=form.elements[tab[i]].name;                        
        }
        i++;
    }
    if( ! ok ){
        return true;
    }else{
        MsgBox("Erreur d'envoi","Le champ  (<b style='font-family:times new roman;font-size:24px;color:#FF0000'>"+champvide+"</b>) ne doit pas etre vide !",source);
        return false;
    }
}

function valideDate(form,dat,source){
    d=form.elements[dat].value;
    day=d.substring(0,2); //XX-00-0000
    month=d.substring(3,5);//00-XX-0000
    year=d.substring(6,10);//00-00-XXXX
    test=new Date();
    test.setDate(day);
    test.setMonth(month-1);
    test.setYear(year);  
   if ((day=="08")||(day=="09") ){//cas exeptionel
     return true;  
   }else{
    if(parseInt(test.getDate())- parseInt(day.toString()) != 0){
    MsgBox("Erreur de saisie","La date que vous avez saisi est invalide !",source);
    return false;
    }else 
        return true;
   }
}

function valideMail(form,mail,source){
    if(Verifmail(form.elements[mail].value)){
        return true;
    }else{
        MsgBox("Erreur de saisie","L'E-mail que vous avez saisi est invalide !",source);
        return false;       
    } 

}

