var timer;

var h = -450; 	// -450 set this to the same value of the top property for the popup div in the style sheet

var w = 800;	// 250 set this to the same value of the width property for the popup div in the style sheet, smaller to move it to the right, larger to move it to the left

var t = 200;	// 100 set this to the actual pixel distance from the top where you want the popup div to be at the end of the descent



function startAp() {

	setLeft();

	showAp();

}



function hideAp() { 

	if (document.layers) document.layers.popup.visibility = 'hide';

	else if (document.all) document.all.popup.style.visibility = 'hidden';

	else if (document.getElementById) document.getElementById("popup").style.visibility = 'hidden';

}



function showAp() { 

	state=typeof tPos;

	if(state=='undefined') tPos = h;

	if(tPos < t) { 

		tPos+=25;

		if (document.layers) document.layers.popup.top = tPos+"px";

		else if (document.all) document.all.popup.style.top = tPos+"px";

		else if (document.getElementById) document.getElementById("popup").style.top = tPos+"px";

	}



	if(timer!=null) clearInterval(timer);

	timer = setTimeout("showAp()",25);

}



function getoPos() {

	if (document.layers) alert(document.layers.popup.top);

	else if (document.all) alert(document.all.popup.style.top);

	else if (document.getElementById) alert(document.getElementById("popup").style.top);

}



function setLeft() {

	if (document.layers) document.layers.popup.left = ((window.innerWidth / 2) - (w / 2))+"px";

	else if (document.all) document.all.popup.style.left = ((document.body.offsetWidth / 2) - (w / 2))+"px";

	else if (document.getElementById) document.getElementById("popup").style.left = ((window.innerWidth / 2) - (w / 2))+"px";

}
