﻿var autoAktualisieren;

function startUp()
{   
  if(document.getElementById('ctl00_btnAutoReload').value > 0)
  {
    //document.getElementById("reloadTxt").innerHTML = "Sekunden bis zur n&auml;chsten Aktualisierung";         
    autoAktualisieren = document.getElementById('ctl00_btnAutoReload').value;
    InitializeTimer(autoAktualisieren);    
  }  
  PositionMenue();
}

//#################################################
//#################################################
//--------------- AutoPostBack Timer --------------
//#################################################
//#################################################

var secs
var timerID = null
var timerRunning = false
var delay = 1000
function InitializeTimer(seconds)
{
    // Set the length of the timer,
    // in seconds. Your choise
    secs = seconds;

    StopTheClock();
    StartTheTimer();
}
function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID);
    timerRunning = false;
}
function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock();

        // Form1.Post1 is a HTML an input button
        // on your Design form. See below.
        document.getElementById('ctl00_btnAutoReload').click();
        //Generate a Postback to the server
        InitializeTimer(autoAktualisieren);
        // Start the timer again
    }
    else
    {        
        //document.getElementById("reloadSek").innerHTML = secs;
        secs = secs - 1;                
        timerRunning = true;        
        timerID = self.setTimeout("StartTheTimer()", delay);
    }        
}
