func = function() {	usePopUp(10, 30); }
if (typeof window.addEventListener!='undefined') { window.addEventListener('load',func,false); } else { window.attachEvent('onload',func); }


//Launches a pop-up layer after a delay and closes again shortly.
function usePopUp(start, stop) {
	if(!document.getElementById("popup")) return;
	if(!start) start = 60;
	if(!stop) stop = 2;
	
	if(document.all) {
		fixPopUp();
		onscroll = function() { fixPopUp(); };
	} else {
		document.getElementById("popup").style.position = "fixed";
	}
	
	setTimeout(showPopUp, start*1000);
	setTimeout(hidePopUp, (start+stop)*1000);
}

//Makes the pop-up visible (wherever the user is on the page).
function showPopUp() {
	document.getElementById("popup").style.display = "block";
	fadePopUp(0, 10);
}

//Makes the pop-up invisible.
function hidePopUp() {
	fadePopUp(90, -5);
}

//Moves the pop-up for browsers that don't understand "position: fixed".
function fixPopUp() {
	offset = 0;
	if(document.body && document.body.scrollTop) offset = document.body.scrollTop;
	else if(document.documentElement && document.documentElement.scrollTop) offset = document.documentElement.scrollTop;
	else if(typeof(pageYOffset) == "number") offset = pageYOffset;
	document.getElementById("popup").style.top = offset;
}

//Adjusts the pop-up's opacity bit by bit until a limit is reached.
function fadePopUp(o, oi) {
	var p = document.getElementById("popup").style;
	
	if(document.all) p.filter = "Alpha(opacity="+o+")";
	else p.opacity = o*0.01;
	o += oi;
	if(o <= 0) p.display = "none";
	else if(o <= 90) setTimeout("fadePopUp("+o+", "+oi+")", 50);
}