﻿/*____________________________________________
|     _     _ ___      __ _                   |
|    (_)___(_) __|___ / _| |_ __ _ _ _ ___    |
|    | |_ /| \__ | _ \  _|  _/ _` | '_/ -_)   |
|    |_/__||_|___|___/_|  \__\__,_|_| \___|   |
|                                             |
|       ©2010 iziSoftware - Version 1.0       |
|_____________________________________________|

CLASSE D'OUTILS JAVASCRIPT POUR L'ENSEMBLE DU PROJET

OECenterLoading : Ouverture d'un loading modal centré sur la fenetre
OEPopupModalJs : Affiche un message par popup en mode popup dialog
*/


//Démarrage
$(document).ready(function() {
});

var OECenterLoading = {

    Open: function() {
        var CenterLoading = $("#CenterLoading");

        if (CenterLoading.size() == 0) {
            var html = "<div id='CenterLoading'>";
            html += "</div>";
            $("body").append(html);
            CenterLoading = $("#CenterLoading");
        } else {
            CenterLoading.show();
        }

        //Taille du masque

        CenterLoading.height(WEEdSiteCommon.GetTotalHeight());
        CenterLoading.width(WEEdSiteCommon.GetTotalWidth());


    },
    Close: function() {
        var CenterLoading = $("#CenterLoading");
        if (CenterLoading.size() != 0) {
            CenterLoading.hide();
        }

    }
}

var OEPopupModalJs = {
    ShowModalPopup: function(Text, ImgMsg) {

        var ShowText = "<div style='margin-left: auto; margin-right:auto; margin-top:10px;' ><img id='ImgCloseC'  style='float:left; margin: 0px 20px 10px 10px; ' src=" + ImgMsg + " /> <div style='width:250px;margin:10px auto 0px auto'>" + Text + "</div></div>";

        var ModalPopup = $("#ModalPopup");

        if (ModalPopup.size() == 0) {
            var html = "<div id='ModalPopup'>";
            html += "<div id='ModalPopupBlock'>";
            html += "<div id='ModalPopupBlockTop'></div>";
            html += "<div id='ModalPopupBlockBottom'></div>";
            html += "</div>";
            html += "</div>";
            $("body").append(html);
            ModalPopup = $("#ModalPopup");
        } else {
            ModalPopup.show();
        }

        var ModalPopupBlock = ModalPopup.children("#ModalPopupBlock");
        var ModalPopupBlockTop = ModalPopupBlock.children("#ModalPopupBlockTop");
        var ModalPopupBlockBottom = ModalPopupBlock.children("#ModalPopupBlockBottom");

        //taille de la fenetre
        var scrollTop = document.documentElement.scrollTop;
        var scrollLeft = document.documentElement.scrollLeft;

        //Taille du masque
        ModalPopup.height(WEEdSiteCommon.GetTotalHeight());
        ModalPopup.width(WEEdSiteCommon.GetTotalWidth());

        //Positionement du message
        ModalPopupBlock.css("left", (($(window).width() - ModalPopupBlock.width()) / 2) + scrollLeft);
        ModalPopupBlock.css("top", (($(window).height() - ModalPopupBlock.height()) / 2) + scrollTop);

        //Ajout du text
        ModalPopupBlockBottom.html(Text);

        //Ajout de l'evenement de fermeture
        ModalPopupBlockTop.click(function(e) {
            ModalPopup.hide();
        });
    },

    CloseModalPopup: function(dialog) {
        var ModalPopup = $("#ModalPopup");

        if (ModalPopup.size() != 0) {
            ModalPopup.hide();
        }
    }
}






