function showMask(str)
{
    hideMask();
    if (document.getElementById('mask').style.display == 'none')
    {
            showElement('mask');
            document.getElementById('mask').setAttribute("title", "Cliquez pour fermer");
            document.getElementById('body').style.overflow = "hidden";
            document.getElementById(str).style.display = 'inline';
            
    }
}

function hideMask()
{
    if (document.getElementById('mask').style.display == 'inline')
    {
            document.getElementById('body').style.overflow = "visible";
            hideElement('mask');
            hideElement('legale');
            hideElement('credits');
            hideElement('googlemap');
    }
}
// affiche un composant html en manipulant la propriété <display> de l'attribut <style>.
// paramètre : string (valeur de l'attribut <Id> du composant à afficher)
function showElement(id){
    if (id.length !=0)
        document.getElementById(id).style.display = 'inline';
}

// masque un composant html en manipulant la propriété <display> de l'attribut <style>.
// paramètre : string (valeur de l'attribut <Id> du composant à masquer)
function hideElement(id){
    if (id.length !=0)
        document.getElementById(id).style.display = 'none';
}

function saisieValide() {
    var err="";
    var reg=new RegExp("^[a-zA-Z0-9_-]+[a-zA-Z0-9\._-]*@[a-zA-Z0-9_-]+\.[a-zA-Z\._-]{1,}[a-zA-Z_-]+");
    //
    if (!document.monform.lib_mail.value.match(reg)) {
        err="L'adresse est dans un format incorrect.\n";
    }
    //
    if (err!="") {
        alert(err);
        return false;
    } else {
        return true;
    }
}
//
function envoyerSaisie() {
    if (saisieValide()) {
        document.monform.action="newsletter.php?etape=1";
        document.monform.method="post";
        document.monform.submit();
    }
}
//
function annulerSaisie() {
    nav1(4);
}

