var agt=navigator.userAgent.toLowerCase();var is_major=parseInt(navigator.appVersion);var is_minor=parseFloat(navigator.appVersion);var is_nav=((agt.indexOf('mozilla')!=-1)&&(agt.indexOf('spoofer')==-1)&&(agt.indexOf('compatible')==-1)&&(agt.indexOf('opera')==-1)&&(agt.indexOf('webtv')==-1)&&(agt.indexOf('hotjava')==-1));var is_nav4=(is_nav&&(is_major<=4));var is_ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));var is_ie3=(is_ie&&(is_major<4));var is_ie4=(is_ie&&(is_major==4)&&(agt.indexOf("msie 4")!=-1));var is_ie5=(is_ie&&(is_major==4)&&(agt.indexOf("msie 5")!=-1));var box,inhalt;var deltaX,deltaY;var zielX,zielY,zielW,zielH;var aX,aY;var g,s,r;var inAnimation=false;var zeit=(new Date()).getTime();var cookies=document.cookie.split("; ");var cookie;var textlinks=new Array(4);
textlinks[0] = 'Webseite besuchen: <a rel="nofollow" href="http://partners.webmasterplan.com/click.asp?ref=438484&site=3749&type=text&tnb=2" target="_blank">Die Flatrate fürs Handy ist da: BASE</a><br><img src="http://banners.webmasterplan.com/view.asp?ref=438484&site=3749&type=text&tnb=2&js=1" BORDER="0" WIDTH="1" HEIGHT="1">';
textlinks[1] = 'Webseite besuchen: <a rel="nofollow" href="http://partners.webmasterplan.com/click.asp?ref=438484&site=3657&type=text&tnb=34" target="_blank">www.quelle.de</a><br><img src="http://banners.webmasterplan.com/view.asp?ref=438484&site=3657&type=text&tnb=34&js=1" BORDER="0" WIDTH="1" HEIGHT="1"><BR>';
textlinks[2] = 'Webseite besuchen: <a rel="nofollow" href="http://partners.webmasterplan.com/click.asp?ref=438484&site=3354&type=text&tnb=2" target="_blank">neckermann - Preiswert mit Service</a><br><img src="http://banners.webmasterplan.com/view.asp?ref=438484&site=3354&type=text&tnb=2&js=1" BORDER="0" WIDTH="1" HEIGHT="1"><BR>';
textlinks[3] = 'Webseite besuchen: <a rel="nofollow" href="http://partners.webmasterplan.com/click.asp?ref=438484&site=2897&type=text&tnb=1" target="_blank">BAUR.de - Online Shopping - TÜV geprüft!</a><br><img src="http://banners.webmasterplan.com/view.asp?ref=438484&site=2897&type=text&tnb=1&js=1" BORDER="0" WIDTH="1" HEIGHT="1">';

footerlinks = '<img src="http://banners.webmasterplan.com/view.asp?ref=438484&site=3749&type=text&tnb=2&js=1" BORDER="0" WIDTH="1" HEIGHT="1">';
footerlinks += '<img src="http://banners.webmasterplan.com/view.asp?ref=438484&site=3657&type=text&tnb=34&js=1" BORDER="0" WIDTH="1" HEIGHT="1">';
footerlinks += '<img src="http://banners.webmasterplan.com/view.asp?ref=438484&site=3354&type=text&tnb=2&js=1" BORDER="0" WIDTH="1" HEIGHT="1">';
footerlinks += '<img src="http://banners.webmasterplan.com/view.asp?ref=438484&site=2897&type=text&tnb=1&js=1" BORDER="0" WIDTH="1" HEIGHT="1">';

var werbungen = new Array(4);
werbungen[0] = '<DIV ID="popup" STYLE="top: 100px; left: 150px; width: 820px; height: 504px;"><DIV ID="popup_kopf"><DIV ID="popup_titel" onMousedown="schiebe_box();">Tipp by HeavyGaming.de</DIV><DIV ID="popup_icons"><A HREF="#" onClick="klappe_inhalt(); return false;"><IMG SRC="http://www.heavygaming.de/aufundzu.png" WIDTH=16 HEIGHT=16 BORDER=0 HSPACE=2 ALT="Auf-/Zuklappen" TITLE="Auf-/Zuklappen"></A><A HREF="#" onClick="schliesse_box(); return false;"><IMG SRC="http://www.heavygaming.de/schliessen.png" WIDTH=16 HEIGHT=16 BORDER=0 HSPACE=2 ALT="Schlie&szlig;en" TITLE="Schlie&szlig;en"></A><BR></DIV></DIV><DIV ID="popup_inhalt"><iframe src="http://partners.webmasterplan.com/click.asp?ref=438484&site=3749&type=text&tnb=2" height="456" width="800" frameborder="0" scrolling="yes">Base</iframe><BR></DIV><DIV ID="popup_fuss">' + textlinks[0] + footerlinks + '</DIV></DIV>';
werbungen[1] = '<DIV ID="popup" STYLE="top: 100px; left: 150px; width: 820px; height: 504px;"><DIV ID="popup_kopf"><DIV ID="popup_titel" onMousedown="schiebe_box();">Tipp by HeavyGaming.de</DIV><DIV ID="popup_icons"><A HREF="#" onClick="klappe_inhalt(); return false;"><IMG SRC="http://www.heavygaming.de/aufundzu.png" WIDTH=16 HEIGHT=16 BORDER=0 HSPACE=2 ALT="Auf-/Zuklappen" TITLE="Auf-/Zuklappen"></A><A HREF="#" onClick="schliesse_box(); return false;"><IMG SRC="http://www.heavygaming.de/schliessen.png" WIDTH=16 HEIGHT=16 BORDER=0 HSPACE=2 ALT="Schlie&szlig;en" TITLE="Schlie&szlig;en"></A><BR></DIV></DIV><DIV ID="popup_inhalt"><iframe src="http://partners.webmasterplan.com/click.asp?ref=438484&site=3657&type=text&tnb=34" height="456" width="800" frameborder="0" scrolling="yes"">Quelle</iframe><BR></DIV><DIV ID="popup_fuss">' + textlinks[1] +  footerlinks + '</DIV></DIV>';
werbungen[2] = '<DIV ID="popup" STYLE="top: 100px; left: 150px; width: 820px; height: 504px;"><DIV ID="popup_kopf"><DIV ID="popup_titel" onMousedown="schiebe_box();">Tipp by HeavyGaming.de</DIV><DIV ID="popup_icons"><A HREF="#" onClick="klappe_inhalt(); return false;"><IMG SRC="http://www.heavygaming.de/aufundzu.png" WIDTH=16 HEIGHT=16 BORDER=0 HSPACE=2 ALT="Auf-/Zuklappen" TITLE="Auf-/Zuklappen"></A><A HREF="#" onClick="schliesse_box(); return false;"><IMG SRC="http://www.heavygaming.de/schliessen.png" WIDTH=16 HEIGHT=16 BORDER=0 HSPACE=2 ALT="Schlie&szlig;en" TITLE="Schlie&szlig;en"></A><BR></DIV></DIV><DIV ID="popup_inhalt"><iframe src="http://partners.webmasterplan.com/click.asp?ref=438484&site=3354&type=text&tnb=2" height="456" width="800" frameborder="0" scrolling="yes"">Neckermann</iframe><BR></DIV><DIV ID="popup_fuss">' + textlinks[2] +  footerlinks + '</DIV></DIV>';
werbungen[3] = '<DIV ID="popup" STYLE="top: 100px; left: 150px; width: 820px; height: 504px;"><DIV ID="popup_kopf"><DIV ID="popup_titel" onMousedown="schiebe_box();">Tipp by HeavyGaming.de</DIV><DIV ID="popup_icons"><A HREF="#" onClick="klappe_inhalt(); return false;"><IMG SRC="http://www.heavygaming.de/aufundzu.png" WIDTH=16 HEIGHT=16 BORDER=0 HSPACE=2 ALT="Auf-/Zuklappen" TITLE="Auf-/Zuklappen"></A><A HREF="#" onClick="schliesse_box(); return false;"><IMG SRC="http://www.heavygaming.de/schliessen.png" WIDTH=16 HEIGHT=16 BORDER=0 HSPACE=2 ALT="Schlie&szlig;en" TITLE="Schlie&szlig;en"></A><BR></DIV></DIV><DIV ID="popup_inhalt"><iframe src="http://partners.webmasterplan.com/click.asp?ref=438484&site=2897&type=text&tnb=1" height="456" width="800" frameborder="0" scrolling="yes"">Karstadt</iframe><BR></DIV><DIV ID="popup_fuss">' + textlinks[3] +  footerlinks + '</DIV></DIV>';



function init( verzoegerung, geschwindigkeit, schrittweite, richtung) {
  if (is_ie5) { box    = document.all.popup;
                inhalt = document.all.popup_inhalt; }
  else        { box    = document.getElementById('popup');
                inhalt = document.getElementById('popup_inhalt'); }

  g = geschwindigkeit;
  s = schrittweite;
  r = richtung;

  if ((box != null) && (inhalt != null)) {
    setTimeout( "zeige_box()", verzoegerung);
  }
}

function hole_width( div) {
  var w;

  if (is_ie5) { w = div.style.pixelWidth; }
  else        { w = parseInt( div.style.width); }

  return w;
}

function setze_width( div, w) {
  if (is_ie5) { div.style.pixelWidth = w; }
  else        { div.style.width = w + "px"; }
}

function hole_height( div) {
  var h;

  if (is_ie5) { h = div.style.pixelHeight; }
  else        { h = parseInt( div.style.height); }

  return h;
}

function setze_height( div, h) {
  if (is_ie5) { div.style.pixelHeight = h; }
  else        { div.style.height = h + "px"; }
}

function hole_left( div) {
  var x;

  if (is_ie5) { x = div.style.pixelLeft; }
  else        { x = parseInt( div.style.left); }

  return x;
}

function hole_top( div) {
  var y;

  if (is_ie5) { y = div.style.pixelTop; }
  else        { y = parseInt( div.style.top); }

  return y;
}

function hole_clientWidth() {
  var w = 0;

  if (typeof( window.innerWidth) == 'number') {
    w = window.innerWidth;
  } else if (document.documentElement &&
             document.documentElement.clientWidth) {
    w = document.documentElement.clientWidth;
  } else if (document.body &&
             document.body.clientWidth) {
    w = document.body.clientWidth;
  }

  return w;
}

function hole_clientHeight() {
  var h = 0;

  if (typeof( window.innerHeight) == 'number') {
    h = window.innerHeight;
  } else if (document.documentElement &&
             document.documentElement.clientHeight) {
    h = document.documentElement.clientHeight;
  } else if (document.body &&
             document.body.clientHeight) {
    h = document.body.clientHeight;
  }

  return h;
}

function hole_visibility( div) {
  return div.style.visibility;
}

function setze_visibility( div, v) {
  div.style.visibility = v;
}

function hole_cookie( name) {
  if (cookies != null) {
    for (var i = 0; i < cookies.length; i++) {
      cookie = cookies[i].split( "=");
      if (cookie[0] == name)
        return unescape( cookie[1]);
    }
  }

  return null;
}

function setze_cookie( name, wert) {
  var ablauf  = new Date( zeit + (14 * 24 * 60 * 60 * 1000));

  document.cookie = name + "=" + escape( wert) + "; expires=" + ablauf.toGMTString() + "; path=/";
}

function bewegen() {
  var stop = 0;

  if (inAnimation) {
    if (r == 1) { aX += s; aY += s; }
    if (r == 2) {          aY += s; }
    if (r == 3) { aX -= s; aY += s; }
    if (r == 4) { aX += s; }
    if (r == 5) { }
    if (r == 6) { aX -= s; }
    if (r == 7) { aX += s; aY -= s; }
    if (r == 8) {          aY -= s; }
    if (r == 9) { aX -= s; aY -= s; }

    if ((r == 1) && (aX >= zielX) && (aY >= zielY)) { stop = 1; }
    if ((r == 2) &&                  (aY >= zielY)) { stop = 1; }
    if ((r == 3) && (aX <= zielX) && (aY >= zielY)) { stop = 1; }
    if ((r == 4) && (aX >= zielX))                  { stop = 1; }
    if ((r == 5))                                   { stop = 1; }
    if ((r == 6) && (aX <= zielX))                  { stop = 1; }
    if ((r == 7) && (aX >= zielX) && (aY <= zielY)) { stop = 1; }
    if ((r == 8) &&                  (aY <= zielY)) { stop = 1; }
    if ((r == 9) && (aX <= zielX) && (aY <= zielY)) { stop = 1; }

    if (stop == 1) {
      inAnimation = false;
      setze_position( box, zielX, zielY);
    }
    else {
      setze_position( box, aX, aY);
      setTimeout( "bewegen()", g);
    }
  }
}

function zeige_box() {
  if ((!is_nav4) && (!is_ie3) && (!is_ie4)) {
    zielX = hole_left( box);
    zielY = hole_top( box);
    zielW = hole_width( box);
    zielH = hole_height( box);

    var dw = 0;
    var dh = 0;

    if (r == 1) {
      dw = zielX + zielW;
      dh = zielY + zielH;
    }
    if (r == 3) {
      dw = hole_clientWidth() - zielX;
      dh = zielY + hole_height( box);
    }
    if (r == 7) {
      dw = zielX + hole_width( box);
      dh = hole_clientHeight() - zielY;
    }
    if (r == 9) {
      dw = hole_clientWidth()  - zielX;
      dh = hole_clientHeight() - zielY;
    }

    if (dw > dh) { dw = dw - dh; dh = 0; }
    else         { dh = dh - dw; dw = 0; }

    if ((r == 1) || (r == 4) || (r == 7)) {
      aX = -zielW + dw;
    }
    if ((r == 2) || (r == 5) || (r == 8)) {
      aX = zielX;
    }
    if ((r == 3) || (r == 6) || (r == 9)) {
      aX = hole_clientWidth() - dw;
    }

    if ((r == 1) || (r == 2) || (r == 3)) {
      aY= -zielH + dh;
    }
    if ((r == 4) || (r == 5) || (r == 6)) {
      aY = zielY;
    }
    if ((r == 7) || (r == 8) || (r == 9)) {
      aY = hole_clientHeight() - dh;
    }

    setze_position( box, aX, aY);

    setze_visibility( box, "visible");
    setze_visibility( inhalt, "visible");

    inAnimation = true;
    setTimeout( "bewegen()", g);
  }
}

function schliesse_box() {
  setze_visibility( box, "hidden");
  setze_visibility( inhalt, "hidden");
}

function klappe_inhalt() {
  if (hole_visibility( inhalt) == "visible")
    setze_visibility( inhalt, "hidden");
  else
    setze_visibility( inhalt, "visible");
}

function setze_position( div, x, y) {
  if ((aX + zielW) > hole_clientWidth()) {
    setze_width( div, hole_clientWidth() - aX);
  }
  else {
    setze_width( div, zielW);
  }

  if ((aY + zielH) > hole_clientHeight()) {
    setze_height( div, hole_clientHeight() - aY);
  }
  else {
    setze_height( div, zielH);
  }

  if (is_ie5) { div.style.pixelLeft = x;
                div.style.pixelTop  = y; }
  else        { div.style.left = x + "px";
                div.style.top  = y + "px"; }
}

function position( e) {
  if (is_ie) { deltaX = event.clientX - hole_left( box);
               deltaY = event.clientY - hole_top( box); }
  else       { document.captureEvents( Event.MOUSEMOVE | Event.MOUSEUP);
               deltaX = e.clientX - hole_left( box);
               deltaY = e.clientY - hole_top( box); }

  document.onmousemove = drag;
  document.onmouseup   = drop;

  return false;
}

function drag( e) {
  if (is_ie) {
    setze_position( box, event.clientX - deltaX,
                         event.clientY - deltaY);
  }
  else {
    setze_position( box, e.clientX - deltaX,
                         e.clientY - deltaY);
  }

  return false;
}

function drop() {
  if (!is_ie) {
    document.releaseEvents( Event.MOUSEMOVE | Event.MOUSEUP);
  }

  document.onmousemove = null;
  document.onmouseup   = null;
  box.onmousedown = null;
}

function schiebe_box() {
  box.onmousedown = position;
}

function waehle_werbung( sperrzeit) {
  var zuletzt = hole_cookie( "popup");

  if ((zuletzt == null) || ((zeit - zuletzt) > sperrzeit)) {
    setze_cookie( "popup", zeit);

    var zufall  = Math.floor( Math.random() * werbungen.length);
    document.writeln( werbungen[zufall]);
  }
}

function zeige_werbung() {
	document.writeln('<p align=center>');
   var zufall = Math.floor( Math.random() * textlinks.length);
   document.writeln(textlinks[zufall]);
   document.writeln(footerlinks);
	/*for (var i = 0; i < footerlinks.length; i++) {
	 	document.writeln(footerlinks[i]);
	}*/
	document.writeln('</ p>');
}