//window.onload = function() {start('2009','12','25',0,-7,'tzcd','http://www.google.com',250,150);}
//start('2009','8','25',0,-7,'tzcd','http://www.myphoneroom.com/offerexpired.php',100,0);
function start(year,month,day,hour,tz,lab,exit,top,left)
{
	displayTZCountDown(setTZCountDown(year,month,day,hour,tz),lab,exit);
	var w = 0;
	var h = 0;

	//IE
	if(!window.innerWidth)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}
		//quirks mode
		else
		{
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	}
	//w3c
	else
	{
		w = window.innerWidth;
		h = window.innerHeight;
	}
	
	if (h>350)
	{
		h=h-350;	
	}
	else
	{
		h=0;	
	}
	floatingDiv(h,left);
	showit("floatbar");
}
function showit(id)
{
	//alert(id);
	document.getElementById(id).style.display="block";
}
function setTZCountDown(year,month,day,hour,tz) 
{
var toDate = new Date();

if (year < toDate.getFullYear())
{
	return 0;
}

if (month == '*')
{
	toDate.setMonth(toDate.getMonth() + 1);
}
else if (month > 0) 
{ 
	toDate.setMonth(month-1);//because month is 0-11 in javascript
}

if (day.substr(0,1) == '+') 
{
	var day1 = parseInt(day.substr(1));
	toDate.setDate(toDate.getDate()+day1);
} 
else
{
	toDate.setDate(day);
}

toDate.setHours(hour);
toDate.setMinutes(0-(tz*60));
toDate.setSeconds(0);
var fromDate = new Date();
fromDate.setMinutes(fromDate.getMinutes() + fromDate.getTimezoneOffset());
//var diffDate = new Date(0);
//diffDate.setMilliseconds(toDate - fromDate);
var diffDate = 600000;
return Math.floor(diffDate.valueOf()/1000);
}

function displayTZCountDown(countdown,lab,exit) 
{
	if (countdown <= 0)
	{
		document.getElementById(lab).innerHTML = "Offer Expired";
	}
	
	else
	{
		var secs = countdown % 60; 
		if (secs < 10)
		{
			secs = '0'+secs;
		}
		var countdown1 = (countdown - secs) / 60;
		var mins = countdown1 % 60; 
		if (mins < 10)
		{
			mins = mins;
		}
		countdown1 = (countdown1 - mins) / 60;
		var hours = countdown1 % 24;
		var days = (countdown1 - hours) / 24;
		//document.getElementById(lab).innerHTML = "There's Only " + days + " day" + (days == 1 ? '' : 's') + '' +hours+ ' hours & ' +mins+ ' minutes<br>& '+secs+' seconds till Christmas!';
		document.getElementById(lab).innerHTML = "Join within the next " + mins + " min" + (mins < 10 ? '' : 's') + ' ' +secs+' seconds<br>and claim a FREE Demo a $79.99 value';
		setTimeout('displayTZCountDown('+(countdown-1)+',\''+lab+'\');',999);
	}
}



function floatingDiv(top,left)
{
	var startX = left, startY = top;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	var px = document.layers ? "" : "px";
function ml(id)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	if(d.layers)el.style=el;
	el.sP=function(x,y){this.style.right=x+px;this.style.top=y+px;};
	el.x = startX; el.y = startY;
	return el;
}
	window.floatDiv=function()
{
 	var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
 
	var dY = startY;
 	if (pY+top > startY)
	{
		dY = pY+top;
	}
 	else
	{
		dY = startY;
 	}
	 ftlObj.y += (dY - ftlObj.y);
	 ftlObj.sP(ftlObj.x, ftlObj.y);
	 setTimeout("floatDiv()", 5);
}
	ftlObj = ml("floatbar");
	floatDiv();
}

