var min = 10;
var sec = 0;
function twoDigits(n)
{
	return (n>9) ?n :'0'+n
}

function startTimer()
{
	var m = twoDigits(min), s = twoDigits(sec);
	document.getElementById('countDown').innerHTML = m +':'+ s;
	document.getElementById('floatCountDown').innerHTML = m +':'+ s;
	
	sec--;
	if(sec < 0 && min > 0)
	{
		sec = 59;
		min--;
	}
	if(min == 4 && sec == 59) alert('Hurry, you have 5 minutes left to get your free trial of NaturaLift MD today!');
	if(min == 0 && sec < 0)
	{
		//alert('Time expired!! Take your last chance now!!');
		execPopup('popupcode.html');
		showingOnce = true;
		setInterval('flashTimer(true)', 1000);
	} else setTimeout('startTimer()', 999);
	flashTimer();
}

function flashTimer(is_down)
{
	if(is_down) sec=(sec%2>0)?2 :1;
	var t1 = document.getElementById('countDown'), t2 = document.getElementById('floatCountDown');
	var col = (sec % 2 > 0) ?'rgb(204, 0, 0)' :'rgb(221, 255, 221)';
	t1.style.backgroundColor = col;
	t2.style.backgroundColor = col;				
}

function checkScrollPos()
{
var iebody = (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;
var dsoctop = document.all? iebody.scrollTop : pageYOffset;

if ( dsoctop < 1500 )
 {
 document.getElementById("floatBox").style.position = "absolute";
 document.getElementById("floatBox").style.top = "1500px";
 }
else {
     document.getElementById("floatBox").style.position = "fixed";
     document.getElementById("floatBox").style.top = "1px";
     }
}

//window.onload=function(){ setPopupTimer(30, 'popupcode.html'); };
window.onbeforeunload=function(){ return ExitPage(); };
window.onscroll=checkScrollPos;