<!-- Hide this script from old browsers --
var expDays = 90;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

// this will increment visits and return visits to you
function getSetVisits () {
	var visits = GetCookie('DeadMikeVisits');
	if (visits == null) {
		SetCookie('DeadMikeVisits','1', exp);
		return 0;
	} else {
		var newcount = parseInt(visits) + 1;
		DeleteCookie('DeadMikeVisits');
		SetCookie('DeadMikeVisits', newcount, exp);
		return visits;
	}
}

// global
var lastVisit;
var intLastVisit;
var dayOfWeek;
var timeOfDay;
var lastYear;
var lastMonth;
var lastDay;

function getSetLastVisitDate() {
	var today = new Date();
	var retVal;

	lastVisit = GetCookie('DeadMikeLastVisit');
	if (lastVisit == null) {
		lastVisit = today.getTime();
	} else {
		DeleteCookie('DeadMikeLastVisit');
	}

	SetCookie('DeadMikeLastVisit', today.getTime(), exp);
	formatLastVisit();
	return intLastVisit;
}

function formatLastVisit() {
	lastVisit = 1 * lastVisit;  // integerize that stringy cookie
	var lastHereFormatting = new Date(lastVisit);  // Date-i-fy that number
	var lastHereInDateFormat = "" + lastHereFormatting;  // Gotta use substring 

	dayOfWeek = lastHereInDateFormat.substring(0,3)
//        htm += dayOfWeek + ", " + dateMonth + " at " + timeOfDay // display
	lastYear = lastHereFormatting.getYear() * 10000;
	lastMonth = lastHereFormatting.getMonth() * 100;
	lastDay = lastHereFormatting.getDate();
	intLastVisit = lastYear + lastMonth + lastDay;
//	alert(intLastVisit.toString());
}

	if (getSetLastVisitDate() < 990007) {	// month is -1
		saveLastOne();
	}

	var NUMPOPUPS = 6;
	var MAXPINGCOUNT = 18;

	 var newx;
 	 var yend;
	 var ystart;
	 var ydiff;
	 var xincrement;
	 var yincrement;
	 var alayer;
	 var whatsNewVisible = true;
    var lastOne = -1, whichOne = -1;
    var myLayer;
    var pingCount=0;
    var doPingPong = true;
    var pingPongID = -1;
    var origX, origY;
    var temp;
    var paused = false;
    temp = GetCookie('DeadMikeLastOne');
    if (temp == null) saveLastOne();
    else lastOne = parseInt(temp);
    whichOne = lastOne;

function saveLastOne() {
	SetCookie('DeadMikeLastOne', whichOne + "", exp);
}

function pause() {
	if (pingPongID != -1) {
		clearInterval(pingPongID);
		pingPongID = -1;
	}
	paused=true;
}

function go() {
	paused=false;
	if (doPingPong)	// long delay turns off, when expires turns back on
		pingPongID = setInterval('pingPong();', 500);
}

var pingPongID = -1;

function pingPong() {

	if (paused == true) return;

	if (pingCount++ < MAXPINGCOUNT) {
		if (pingCount==1) {
			origX = myLayer.style.pixelLeft;
			origY = myLayer.style.pixelTop;
		}
		myLayer.style.pixelLeft = origX + Math.round((Math.random()*20) - 10);
		myLayer.style.pixelTop = origY + Math.round((Math.random()*20) - 10);
	} else {
		clearInterval(pingPongID);
		pingPongID = -1;
		pingCount = 0;
		Ypick();
	}
}

function doWhatsNew() {
	if (paused) return;

	switch (whichOne) {
			case 0:
				myLayer = document.all.aande;
//				myLayer = document.all.gear;
				break;
			case 1:
				myLayer = document.all.link;
//				myLayer = document.all.iclick;
				break;
			case 2:
				myLayer = document.all.vote;
				break;
			case 3:
				myLayer = document.all.aande;
				break;
			case 4:
				myLayer = document.all.logbook;
				break;
			case 5:
//				myLayer = document.all.rc5;
				myLayer = document.all.link;
				break;
			case 6:
				myLayer = document.all.whatsNew;
				break;
			default:
				myLayer = document.all.whatsNew;
				whichOne = 0;
				break;
		}

		switch (whatsNewVisible) {
			case true:
				whatsNewVisible = false;
				if (whichOne > 6) {
					whichOne = 0;
					myLayer = document.all.iclick;
				}
				if (whichOne != -1) {
//					myLayer.filters[0].Apply();
//					myLayer.filters[0].transition = Math.round(Math.random()*23);
					myLayer.style.visibility = "hidden";
//					myLayer.filters[0].Play();
				}
			break;

			case false:
				var myClientWidth = document.body.clientWidth;
				var temp = myClientWidth >> 1;	// middle coord
				var x1 = temp - 140 - myLayer.style.pixelWidth;	// 1/2 width of table with flame
				var x2 = temp + 140;	// 1/2 width of table with flame
				var tempx = 0;
				var mult = myClientWidth - myLayer.style.pixelWidth;

				tempx = Math.round(Math.random()*mult);
				while (tempx >= x1 && tempx <= x2)
					tempx = Math.round(Math.random()*mult);
				myLayer.style.pixelLeft = tempx;
				myLayer.style.pixelTop = Math.round(Math.random() * 200) + 235;

				whatsNewVisible = true;
//				myLayer.filters[0].Apply();
//				myLayer.filters[0].transition = Math.round(Math.random()*23);
				myLayer.style.visibility = "visible";
//				myLayer.filters[0].Play();
			break;
		}
}

function Ypick(){
	newx = document.body.clientWidth - 96;
	xincrement = (newx/10);
	clientHeight = document.body.clientHeight;
	ystart = Math.round(Math.random()*clientHeight);
	yend = Math.round(Math.random()*clientHeight);

 	doWhatsNew();
	//whatsNewVisible = false;
	if (!whatsNewVisible) {
		alayer = document.all.swooper;
		alayer.style.top=ystart;

		if (ystart > yend){
			ydiff = (ystart-yend);
			yincrement = (ydiff/xincrement);
			Moveneg();
		} else {
			ydiff = (yend-ystart);
			yincrement = (ydiff/xincrement);
			Movepos();
		}

		if (whichOne < NUMPOPUPS)
			whichOne++;
		else whichOne = 0;
	} else if (whichOne == 0 || whichOne == 1 || whichOne == 5 || whichOne == 7) {
		if (paused == true) {
			doPingPong = false;
			setTimeout('doPingPong=true;Ypick();', 50);
		} else {
			doPingPong = false;
			setTimeout('doPingPong=true;Ypick();', 9000);
		}
	} else {
		pingPongID = setInterval('pingPong()', 500);
	}

}

function Moveneg(){
	if (newx >= alayer.style.pixelLeft) {
      with (alayer) {
			style.pixelLeft += 10;
			style.pixelTop -= yincrement;
		}
		setTimeout('Moveneg()',40);
	} else if (!whatsNewVisible) {
		with (alayer) {
			style.left=-96;
			style.top=yend;
		}
		Ypick();
	}
}

function Movepos(){
	if (newx >= alayer.style.pixelLeft) {
    	   with (alayer) {
				style.pixelLeft += 10;
				style.pixelTop += yincrement;
			}
			setTimeout('Movepos()',40);
	} else if (!whatsNewVisible) {
		with (alayer) {
			style.left=-96;
			style.top=yend;
		}
		Ypick();
	}
}

function msover(num) {
	document.images[num+4].src = over[2].src;
	window.status = blurb[num];
	document.images[3].src = picture[num].src;
}

function msout(num) {
	document.images[num+4].src = normal[1].src;
	document.images[3].src = over[1].src;
	window.status = blurb[10];
}

// -->
