var timer;
var h = -450;	// set this to the same value of the top property for the Flyer div in the style sheet
var w = 330;	// set this to the same value of the width property for the Flyer div in the style sheet, smaller to move it to the right, larger to move it to the left
var t = 80;	// set this to the actual pixel distance from the top where you want the Flyer div to be at the end of the descent

function start() 
{
    if (CanShow() == false)
    {
	hideAd ();
	return;
    }
    // Popup shown?
    if (document.cookie && document.cookie.indexOf ("popup=1") > -1)
    {
        hideAd();
        return;
    }
    else
    {
        var expires = new Date();
        var newtime = expires.getTime() + (3 * 60 * 60 * 1000);
        expires.setTime(newtime);
        document.cookie = "popup=1; expires=" + expires.toGMTString();  
    }

       show();
}

function CanShow ()
{
 today=new Date();
 startDate = new Date (2010, 3, 20);

 if ( (today - startDate) > 0 )
  return true;
 else
  return false;
}


function hideAd() { 
	if (document.layers) document.layers.Flyer.visibility = 'hide'; 
	else if (document.all) document.all.Flyer.style.visibility = 'hidden';
	else if (document.getElementById) document.getElementById("Flyer").style.visibility = 'hidden'; 

	document.getElementById("Flyer").innerHTML='';
}

function show() { 
	state=typeof tPos;
	if(state=='undefined') tPos = h;
	if(tPos < t) { 
		tPos+=4;
		if (document.layers) document.layers.Flyer.top = tPos+"px";
		else if (document.all) document.all.Flyer.style.top = tPos+"px";
		else if (document.getElementById) document.getElementById("Flyer").style.top = tPos+"px";
	}

	if(timer!=null) clearInterval(timer);
	timer = setTimeout("show()",1);
}

function getoPos() {
	if (document.layers) alert(document.layers.Flyer.top);
	else if (document.all) alert(document.all.Flyer.style.top);
	else if (document.getElementById) alert(document.getElementById("Flyer").style.top);
}

function setLeft() {
	if (document.layers) document.layers.Flyer.left = ((window.innerWidth ) - w )+"px";
	else if (document.all) document.all.Flyer.style.left = ((document.body.offsetWidth ) - (w))+"px";
	else if (document.getElementById) document.getElementById("Flyer").style.left = ((window.innerWidth) - (w ))+"px";
}