// JavaScript Document
//utilisation : onLoad="initializeTimer();" 
//
var secs;
var timerIDs = null;
var timerRunning = false;
var delay = 1000;
function initializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 900;
    //secs = 45; //pour les tests
    stopTheClock();
    startTheTimer();
}
function stopTheClock()
{
    if(timerRunning)
        clearTimeout(timerIDs);
    timerRunning = false;
}
function startTheTimer()
{
    if (secs==0)
    {
        stopTheClock();
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        //FDE 126 - ERA - suppression du popup d alerte
        //window.alert("vitrinemagique.com : Votre session est expirée !");
        //redirection vers la page d'accueil
        window.location.replace("/FrontOfficePortailCidal/VitrineMagique.portal");
    }
    else
    {
        //self.status = secs;
        secs = secs - 1;
        timerRunning = true;
        timerIDs = self.setTimeout("startTheTimer()", delay);
    }
}

