var interval = 60;
var lastHour = -1;
var onprogress = false;

function startRequest()
{
  if(!onprogress){
    hour = (new Date()).getHours();
    if(hour == lastHour){
      setTimeout("startRequest()", interval * 1000);
      return;
    }
    lastHour = hour;

    url = "http://localhost/adv.php?hour=" + hour;
    onprogress = true;
    startGETRequest(url, onComplete, onEnd);
  }
  setTimeout("startRequest()", interval * 1000);
}

function onComplete(text, xml)
{
  var advBox = document.getElementById("advBox");
  advBox.innerHTML = text;
}

function onEnd(text, xml)
{
  onprogress = false;
}