var GUU=(typeof GUU=='undefined'?{}:GUU);
GUU.classes=(typeof GUU.classes=='undefined'?{}:GUU.classes);
GUU.classes.Countdown=function(container, year, month, day, hour, minute, second){
	var _this=this, d = new Date();
	this.targetDate = new Date(year, month - 1, day, hour, minute, second);
	if(this.targetDate.getTime() < d.getTime()) return;
	if(!(this.container=document.getElementById(container))) return;
	this.para = Shine.createHTMLElement('p');
	this.para.className = 'countdown';
	this.para.appendChild(this.days = Shine.createHTMLElement('span'));
	this.days.style.display = 'none';
	this.para.appendChild(this.hours = Shine.createHTMLElement('span'));
	this.hours.style.display = 'none';
	this.para.appendChild(this.mins = Shine.createHTMLElement('span'));
	this.mins.style.display = 'none';
	this.para.appendChild(this.secs = Shine.createHTMLElement('span'));
	this.secs.style.display = 'none';
	this.container.appendChild(this.para);
	this.updateCountdown();
	window.setInterval(function(){_this.updateCountdown();},500);
}
GUU.classes.Countdown.prototype.updateCountdown = function() {
	var n = new Date(), s = Math.round((this.targetDate.getTime() - n.getTime())/1000);
	var d, h, m;
	d = Math.floor(s / (24 * 60 * 60));
	s %= (24 * 60 * 60);
	h = Math.floor(s / (60 * 60));
	s %= (60 * 60);
	m = Math.floor(s / 60);
	s %= 60;
	this.setCounter(this.days, d, 'days', 'day');
	this.setCounter(this.hours, h, 'hours', 'hour');
	this.setCounter(this.mins, m, 'minutes', 'minute');
	this.setCounter(this.secs, s, 'seconds', 'second');
}
GUU.classes.Countdown.prototype.setCounter = function(el, value, suffix, singular)
{
	if(typeof el.counterValue=='undefined'||el.counterValue!=value)
	{
		el.counterValue = value;
		while(el.firstChild) el.removeChild(el.firstChild);
		if(value == 1) suffix = singular;
		el.appendChild(document.createTextNode(value + ' ' + suffix + ' '));
		el.style.display = 'block';
	}
}
if(typeof document.loadHooks=='undefined')document.loadHooks=[];
document.loadHooks.push(function(){ GUU.daftfriday=new GUU.classes.Countdown('hp-daft-friday', 2008, 12, 19, 18, 0, 0)});
document.loadHooks.push(function(){ GUU.seamushaji=new GUU.classes.Countdown('hp-seamus-haji', 2008, 10, 25, 22, 0, 0)});
