var camImage = 'nexstorm.jpg';
var refreshIntervalSeconds = 60;
var secondsLeft = refreshIntervalSeconds;
var reloadCount = 4;

function startCountL() {
  if (reloadCount < 1) {
     document.webCam.timer.value = "-----";
    return;
  } else {
      startClockL();
      }
}


function startClockL() {
  if (secondsLeft > 0) {
    if (secondsLeft < 10) {
      document.webCam.timer.value = '0' + secondsLeft;
    } else {
      document.webCam.timer.value = secondsLeft;
    }
    secondsLeft = secondsLeft - 1
    timerID = setTimeout('startClockL()', 1000);
  } else {
  date = new Date();
  imageNumber = date.getTime();
  document.webCamImage.src = camImage + '?' + imageNumber;
  secondsLeft = refreshIntervalSeconds;
  reloadCount = reloadCount - 1;
  startCountL();
  }
}