function show_sb(dir){
  http_request.onreadystatechange = function()
  {
    if(http_request.readyState == 4)
    {
      document.getElementById("contentshout").innerHTML = http_request.responseText;
      setTimeout("show_sb('');", 10000);
    }
  }
  http_request.open('POST',dir+"modules/shoutbox/index.php?refresh=1", true);
  http_request.send(null);
}

function insert_shout(dir){
 var array = "input=" + encodeURI(document.getElementById("sb_input").value);
  http_request.onreadystatechange = function()
  {
    if(http_request.readyState == 4)
    {
      show_sb(dir)
    }
  }
  http_request.open('POST',dir+"modules/shoutbox/do.php?action=input", true);
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", array.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(array);
}

function del_shout_one(dir,id){
  var array = "del=" + id;
  http_request.onreadystatechange = function()
  {
    if(http_request.readyState == 4)
    {
      show_sb(dir)
    }
  }
  http_request.open('POST',dir+"modules/shoutbox/do.php?action=del", true);
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", array.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(array);
}

function del_shout(dir){
  if(window.confirm("Wirklich komplett leeren?"))
  {
    var array = "del=all";
    http_request.onreadystatechange = function()
    {
      if(http_request.readyState == 4)
      {
        show_sb(dir)
      }
    }
    http_request.open('POST',dir+"modules/shoutbox/do.php?action=del", true);
    http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http_request.setRequestHeader("Content-length", array.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(array);
  }
}

window.onload = function (){
  setTimeout("show_sb('');", 10000);
}
