/******************************************
* Popup Box
* By Jim Silver @ jimsilver47@yahoo.com
* Visit http://www.dynamicdrive.com/
* for full source code
* This notice must stay intact for use
******************************************/

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////
function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx
crossobj.style.top=tempy+e.clientY-offsety
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage

var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"

while (firedobj.tagName!=topelement&&firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////
function hidebox(){
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showimage.visibility="hide"
}

function showbox() {
crossobj=ns6? document.getElementById("showimage") : document.all.showimage;
if (ie4||ns6)
crossobj.style.visibility="visible"
else if (ns4)
document.showimage.visibility="visible"
}


function makeSticky() {

if(ie4) {
element = "showimage";
prop = ".style.pixelTop=";
y_pos = document.body.scrollTop + 80;
}
else if(ns6) {
element = "document.getElementById('showimage')";
prop = ".style.top=";
y_pos = window.pageYOffset + 80;
}
else if(ns4) {
element = "document.showimage";
prop = ".top=";
y_pos = window.pageYOffset + 8;
}

eval(element + prop + y_pos);
setTimeout("makeSticky()",10);
}

function getWidth() {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function getHeight() {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}

var left  = true;
var right = false;

//Anpassen von links nach rechzts und dann zur Mitte
function flyingLayer() {

crossobj=ns6? document.getElementById("showimage") : document.all.showimage;

var breite = getWidth();
var hoehe  = getHeight();

var lposx = parseInt(crossobj.style.left);
var lposy = parseInt(crossobj.style.top);

if(right==false && left==true) {
  left = lposx < (breite-700);
  if(!left) {
    right = true;
  }
}
if(left==false && right==true) {
  right = lposx > 100;
}


if(left) {
  lposx += 10;
}
if(right) {
  lposx -= 10;
}

if(lposx < (breite-700)) {
  lposy +=2;
}else{
  lposy -=2;
}


if(left || right) {
  crossobj.style.left = lposx;
  crossobj.style.top = lposy;
  window.setTimeout("flyingLayer()",250);
}

}

function movingLayer() {

crossobj=ns6? document.getElementById("showimage") : document.all.showimage;

var hoehe  = getHeight();

var lposy = parseInt(crossobj.style.top);

if(lposy == 0) {
  if (ie4||ns6)
    crossobj.style.visibility="hidden"
  else if (ns4)
    document.showimage.visibility="hide"
  crossobj.style.top = lposy+1;
  window.setTimeout("movingLayer()",2000);
  return;
}
if(lposy == 1) {
  if (ie4||ns6)
    crossobj.style.visibility="visible"
  else if (ns4)
    document.showimage.visibility="visible"
}

lposy+=2;

if(lposy < (hoehe/3)) {
  crossobj.style.top = lposy;
  window.setTimeout("movingLayer()",10);
}

}

function hidebox2() {

crossobj=ns6? document.getElementById("showimage") : document.all.showimage;

var lposy = parseInt(crossobj.style.top);

if(lposy < 0) {
  if (ie4||ns6)
    crossobj.style.visibility="hidden"
  else if (ns4)
    document.showimage.visibility="hide"
  return;
}

lposy-=2;

if(lposy > -100) {
  crossobj.style.top = lposy;
  window.setTimeout("hidebox2()",10);
}


}

document.write("<div id=\"showimage\" style=\"position:absolute;width:130;height:610;left:10px;top:10px;visibility:visible;\"><table bgcolor=\"#000000\" border=\"0\" width=\"130\" cellspacing=\"1\" cellpadding=\"0\" height=\"36\"><tr><td id=\"dragbar\" style=\"cursor:hand\" width=\"130\"><ilayer width=\"100%\" onSelectStart=\"return false\><layer width=\"100%\" onMouseover=\"dragswitch=1;if (ns4) drag_dropns(showimage)\ onMouseout=\"dragswitch=0\"></layer></ilayer></td><td style=\"cursor:hand\" align=\"right\" valign=\"middle\"><a href=\"#\" onClick=\"hidebox();return false;\"><b><font face=\"Arial\" color=\"#FFFFFF\"><strong><small>Close</small></strong></font></b></a></td></tr><tr><td bgcolor=\"#FFFFFF\" style=\"padding:0px\" colspan=\"2\" align=\"center\" valign=\"middle\"><iframe width=130 height=610 border=0 frameborder=0 src=\"http://www.starfakes.org/banner.html\" scrolling=no></iframe></td></tr></table></div>");
