function AfficherPopup() {
    PopupFond.style.width = document.documentElement.clientWidth + 'px';
    PopupFond.style.height = document.documentElement.clientHeight + 'px';
    AscenseurGauche = Math.max(document.body.scrollLeft, document.documentElement.scrollLeft);
    AscenseurHaut = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
    PopupFond.style.left = AscenseurGauche + 'px';
    PopupFond.style.top = AscenseurHaut + 'px';
    PopupImage.style.left = Math.round(Math.max(AscenseurGauche + (document.documentElement.clientWidth - PopupImage.width) / 2, 0)) + 'px';
    PopupImage.style.top = Math.round(Math.max(AscenseurHaut + (document.documentElement.clientHeight - PopupImage.height) / 2, 0)) + 'px';
}

function ChargerSite() {
    if (typeof(ChargerPage) == 'function') ChargerPage();
}

function CreerPopup(Element, Ouvrir, Fermer) {
    PopupFond = document.createElement('div');
    PopupFond.id = 'PopupFond';
    document.body.appendChild(PopupFond);
    PopupImage = document.createElement('img');
    PopupImage.id = 'PopupImage';
    PopupImage.src = Element.src;
    document.body.appendChild(PopupImage);
    PopupFond.title = PopupImage.title = Fermer;
    PopupFond.onclick = PopupImage.onclick = function() {
        document.body.removeChild(PopupImage);
        document.body.removeChild(PopupFond);
    };
    AfficherPopup();
    window.onresize = window.onscroll = AfficherPopup;
}

function DesactiverBoutons(Formulaire) {
    Entrees = Formulaire.getElementsByTagName('input');
    for (Cpt = 0; Cpt < Entrees.length; Cpt++) if (Entrees[Cpt].type == 'submit' || Entrees[Cpt].type == 'reset' || Entrees[Cpt].type == 'button') Entrees[Cpt].disabled = 'disabled';
}

function InitialiserImage(Element, Ouvrir, Fermer) {
    PopupImage = document.createElement('img');
    PopupImage.src = Element.src;
    if (PopupImage.width > Element.width && PopupImage.height > Element.height) {
        Element.style.cursor = 'pointer';
        Element.title = Ouvrir;
        Element.onclick = function() { CreerPopup(this, Ouvrir, Fermer); };
    }
}

function PrechargerImages() {
    for (Cpt = 0; Cpt < PrechargerImages.arguments.length; Cpt++) {
        var ImagePrechargee = new Image();
        ImagePrechargee.src = PrechargerImages.arguments[Cpt];
    }
}

function ValiderEmail(Valeur) {
    return /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/.test(Valeur);
}

function ValiderSaisie(Valeur) {
    return Valeur.replace(/ /g, '') != '' ? true : false;
}

function ValiderSelection(Element) {
    for (Cpt = 0; Cpt < Element.length; Cpt++) if (Element[Cpt].checked) return true;
    return false;
}