window.addEvent('domready', function(){

  var anzahl_suchanfragen = $$('.info').length;
  var i = 0;

  update_all = function(host)
  {
    if (host != '')
    {
      console.log(overlay);
      if (overlay == undefined)
      {
        var myMask = new Mask();
        myMask.show();
        var overlay = new Element('div', {id: 'overlay'}).inject($(document.body));
        overlay.setPosition({x: (($(window).getSize().x-300)/2), y: (($(window).getSize().y-150)/2+$(window).getScroll().y)});
        overlay.pin();
        console.log(overlay);
      }

      /*
      new Request({
        method: 'get',
        url: 'ajax_update_all.php',
        data:
        {
          'host' : host,
          'step' : i
        },
        onRequest: function()
        {
          i++;
          overlay.set('html', 'Aktualisiere Suchanfrage ' + i + ' von ' + anzahl_suchanfragen);
        },
        onComplete: function(response)
        {
          console.log(response);
          if (i < anzahl_suchanfragen)
          {
            update_all(host);
          }
        }
      }).send();
      */
    }
    else
    {
      return false;
    }
  }

});
