// JavaScript Document
/* -----------------------------------------------
   Floating layer - v.1
   (c) 2006 www.haan.net
   contact: jeroen@haan.net
   You may use this script but please leave the credits on top intact.
   Please inform us of any improvements made.
   When usefull we will add your credits.
  ------------------------------------------------ */
<!--
x = 450;
y = 20;
function setVisible(obj)
{
	obj = document.getElementById(obj);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}
function placeIt(obj)
{
	obj = document.getElementById(obj);
	if (document.documentElement)
	{
		theLeft = document.documentElement.scrollLeft;
		theTop = document.documentElement.scrollTop;
	}
	else if (document.body)
	{
		theLeft = document.body.scrollLeft;
		theTop = document.body.scrollTop;
	}
	theLeft += x;
	theTop += y;
	obj.style.left = theLeft + 'px' ;
	obj.style.top = theTop + 'px' ;
	setTimeout("placeIt('layer1')",500);
}
window.onscroll = setTimeout("placeIt('layer1')",500);
//-->

function getFuture(f){
	var d = new Date();
	d.setTime(d.getTime() + (60000 * f));
	return d;
}

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
 var j = i + alen;
 if (document.cookie.substring(i, j) == arg)
 return getCookieVal (j);
 i = document.cookie.indexOf(" ", i) + 1;
 if (i == 0) break; 
 }
 return null;
 }

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
 endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr));
}

function showImage()
{
	var theImages = new Array()
	
	var j = 0;
	var p = theImages.length;
	var preBuffer = new Array()
	for (var i = 0; i < p; i++)
	{
	   preBuffer[i] = new Image()
	   preBuffer[i].src = theImages[i]
	}
	var whichImage = Math.round(Math.random()*(p-1));
	document.write('<a href="http://www.worldcantwait.net/" rel="nofollow">');
	document.write('<img src="/UserFiles/Image/bush/' + theImages[whichImage] + '" title="The World Can\'t Wait!" alt="Drive Out The Bush Regime" border="0" align="right" /></a>');
}

var win=null;
function NewWindow(){
	if(GetCookie("sid") == "999"){ return; }
	document.cookie="sid=999; Path=/; Expires= " + getFuture(5);
	setVisible("layer1",true)
}
