function mmFormat(x,v,p) {
    x = Math.floor(x);
    if(p) {
        if(x.toString().length < 2) {
            x = '0'+x.toString();
        }
    }

    return '<span>'+x.toString()+'</span>'+v;
}

function checkTime() {
	
	var d = new Date();
	var future = new Date(2012, 02, 10, 0, 0, 0, 0);
	//var future = new Date(2012, 11, 21, 0, 0, 0, 0);
	var diff = future-d;
	
	var days = (diff/1000/60/60/24); //days
	var hours = (days - Math.floor(days)) * 24;
	var mins = (hours - Math.floor(hours)) * 60;
	var secs = (mins - Math.floor(mins)) * 60;
	//var msecs = (secs - Math.floor(secs)) * 1000;
	
	
	$('#days').html(mmFormat(days,'d',false));
	$('#hours').html(mmFormat(hours,'h',true));
	$('#mins').html(mmFormat(mins,'m',true));
	$('#sec').html(mmFormat(secs,'s',true));
	//$('#milsec').html(mmFormat(msecs,'ms',true));
	Cufon.replace('#counter div', { fontFamily: 'TradeGothicLTStd'});

}


$(document).ready(function() {

Cufon.replace('#count_header', { fontFamily: 'TradeGothicLTStd'});
	checkTime();
	setInterval(checkTime,1000);
});

