var the_timeout;

function openDiv() {
   the_timeout = setTimeout('openWerbung()',1000);
   document.getElementById("werbung").style.visibility = "visible";
}

function openWerbung()
{

  var the_style = getStyleObject("werbung");
  if (the_style)
  {
    var current_left = parseInt(the_style.left);
    var current_width = parseInt(the_style.width);
    var new_left = current_left + 15;

    if (document.layers)
    {
      the_style.left = new_left;
    }
    else
    {
      the_style.left = new_left + "px";
    }

    var position = document.body.offsetWidth/2-(current_width/2);
    if (new_left < position)
    {
      the_timeout = setTimeout('openWerbung();',10);
    }
  }
}


function getStyleObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	  return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	  return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	  return document.layers[objectId];
    } else {
	  return false;
    }
}

function closeWerbung()
{
  var the_style = getStyleObject("werbung");
  if (the_style)
  {
    var current_left = parseInt(the_style.left);
    var new_left = current_left - 15;

    if (document.layers)
    {
      the_style.left = new_left;
    }
    else
    {
      the_style.left = new_left + "px";
    }

    if (new_left > -640)
    {
      the_timeout = setTimeout('closeWerbung();',10);
    }
  }
}
