//myCalendar = new dhtmlXCalendarObject(["wpdateon", "wpdateoff"]);
//myCalendar.setDateFormat("%Y-%m-%d %H:%m:%s");
/**
 * 
 * @author Martin Rothenberger <martin.rothenberger@dailydeal.de>
 * @author Dirk Gustke <dirk.gustke@dailydeal.de>
 * @param timestamp
 * @return
 */
function dd_countdown(timestamp) {
	var d = timestamp;

	var seconds = Number(d % 60);
	var minutes = Number(((d - seconds) % 3600) / 60);
	var hours = Number((d - minutes * 60 - seconds) / 3600) % 24;
	var days = Number(((d - hours * 60 * 60 - minutes * 60 - seconds) / 3600) / 24);
	// var days = Number((d - hours*60*60 - minutes*60 - seconds));

	// format strings
	if (seconds < 10)
		if (seconds < 1)
			seconds = "00";
		else
			seconds = "0" + seconds;
	else
		seconds = seconds;

	if (minutes < 10)
		if (minutes < 1)
			minutes = "00";
		else
			minutes = "0" + minutes;
	else
		minutes = minutes;

	if (hours < 10)
		if (hours < 1)
			hours = "00";
		else
			hours = "0" + hours;
	else
		hours = hours;

	if (days < 10)
		if (days < 1)
			days = "00";
		else
			days = "0" + days;
	else
		days = days;

	document.getElementById('counter_days').innerHTML = days;
	document.getElementById('counter_hours').innerHTML = hours;
	document.getElementById('counter_minutes').innerHTML = minutes;
	document.getElementById('counter_seconds').innerHTML = seconds;

	if (hours >= 100) {
		document.getElementById('countdown-ticker').className = 'countdown digit3';
	}
	if (hours >= 1000) {
		document.getElementById('countdown-ticker').className = 'countdown digit4';
	}

	if (days >= 100) {
		document.getElementById('countdown-ticker').className = 'countdown digit3';
	}
	if (days >= 1000) {
		document.getElementById('countdown-ticker').className = 'countdown digit4';
	}

	d = d - 1;
	if (d > -1) {
	
	var f = function() {
		dd_countdown(d);
	};
	setTimeout(f, 1000);
}else {
	jQuery('#week_poll').remove();
}
	}


