/********** Fonction pour ouvrir une popup *******************************************************/
var newWin = null;
function closeWin() {
    if (newWin != null) {
        if(!newWin.closed)
            newWin.close(); } }

function popUp(psURL, psType, psHeight, psWidth) {
    closeWin();
    var sOptions = "";
    if (psType == "console") sOptions = "resizable, height = " + psHeight + ", width = " + psWidth;
    if (psType == "fixed") sOptions = "status, height = " + psHeight + ", width = " + psWidth;
    if (psType == "elastic") sOptions = "toolbar, menubar, scrollbars, resizable, location, height = " + psHeight + ", width = " + psWidth;
    newWin = window.open(psURL, 'newWin', sOptions);
    newWin.focus(); }

function PopupCentrer(psUrl, piWidth, piHeight, psOptions) {
    var liTop = (screen.height - piHeight) / 2;
    var liLeft = (screen.width - piWidth) / 2;
    /*var w =*/ window.open(psUrl, "", "top=" + liTop + ",left=" + liLeft + ",width=" + piWidth + ",height=" + piHeight + "," + psOptions);
    /*w.onresize = function(){w.resizeTo(piWidth, piHeight);}*/ }

/********** Fonction Gest_Saisie() qui empêche l'entrée de caractère alpha ***********************/
function Gest_Saisie(TxT) {
    //Plage de caractères
    var saisie = new RegExp("[0-9]");
    //booléen
    var bool;

    //On parcour la chaîne
    for(var i = 0 ; i < TxT.value.length ; i++) {
        //On test si chaque caractères sont dans la plage
        bool = saisie.test(TxT.value.charAt(i));
        //Si pas dans la plage
        if(bool == false) {
            //On cocatène avant et après le caractère erronné
            TxT.value = TxT.value.substr(0, i) + TxT.value.substr(i + 1, TxT.value.length - i + 1);
            i--; } } }

/********** Fonction pop_jaq() qui redirige sur le fichier ***************************************/
function pop_jaq(nom, psNomJag) {
    x = (640 - 800) / 2;
    y = (480 - 600) / 2;

    if (screen) {
        y = (screen.availHeight - 600) / 2;
        x = (screen.availWidth - 800) / 2; }
    if (screen.availWidth > 1800)
        x = ((screen.availWidth / 2) - 800) / 2;

    window_name = window.open("../scripts/redirect_files_for_log.asp?files=" + nom + "&name=" + psNomJag + "","" + nom + "","location=0, toolbar=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=1, width=850, height=650,top=" + y + ",left=" + x + "",""); }
/*************************************************************************************************/