function renderMessage(dateStr, msg1, msg2, countFrom)
{
	var date = new Date(dateStr);
	var now = new Date();
	var diff = date.getTime() - now.getTime();
	var days = Math.floor(diff / (1000 * 60 * 60 * 24)) + 1;
	
	if(days < 1)
		document.write(msg1);
	else
	{
		if(countFrom)
			days = countFrom - days;
		//document.write(msg2.replace(/%days%/g, number_format(days)));
//		document.write("<p style=\"text-align:center; color: red\">" + msg2.replace(/%days%/g, number_format(days)) + "</p>");

		document.write("<p style=\"font-size:10px; text-align:center; color: black\"><span style=\"font-size:15px; color:red;\"><b>" + number_format(days) + "</b></span> days remain to<img src=\"images/highsmall.png\"></img><br>start!</p>");
	}
}

function number_format(num)
{
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	num = Math.floor(num/100).toString();
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num);
}
