function Countdown(yr, mo, dy, hr, mn, sc, str_bgcolor, str_endtext, display_string){
	//modified 28/04/06 to receive new color param in constrcutor
	//modified 12/04/07 to recieve optional text as a param in constructor
	//modified 20/11/07 to receive optional display format string
	this.yr=yr; this.mo=mo; this.dy=dy; this.hr=hr; this.mn=mn; this.sc=sc;
	document.getElementById("cd_holder").style.backgroundColor = str_bgcolor;
	// added 12/04/07 
	this.str_endtext = str_endtext
	if (this.str_endtext == undefined)
	{
	 this.str_endtext = "to go..."
	}
	// end
	
	// added 20/11/07
	this.raw_display_string = display_string || Countdown.DEFAULT_DISPLAY_STRING
	// end
	
	this.countTime();
}

Countdown.DEFAULT_DISPLAY_STRING = "<b>%days%</b> %d% <b>%hours%</b> %h% <b>%mins%</b> %endtext%";

Countdown.prototype.timeBetween = function(yr, mo, dy, hr, mn, sc) {
	  this.nDate = new Date(); // current date (local)
	  this.nTime = this.nDate.getTime(); // current time (UTC)
	  this.dTime = Date.UTC(yr, mo - 1, dy, hr, mn, sc); // specified time (UTC)
	  this.bTime = Math.abs(this.nTime - this.dTime)  // time difference
	  return Math.round(this.bTime/1000); //return seconds not milliseconds
}

Countdown.prototype.countTime=function()
{
	var MINUTE = 60; // the number of seconds in a minute
	var HOUR = MINUTE * 60; // the number of seconds in an hour
	var DAY = HOUR * 24; // the number of seconds in a day

	var totalSecs=this.timeBetween(this.yr,this.mo,this.dy,this.hr,this.mn,this.sc);

	var daysUntil=Math.floor(totalSecs/DAY);
	var hrsUntil= Math.floor(totalSecs/HOUR)-(daysUntil*24);
	var minsUntil=Math.floor(totalSecs/MINUTE)-((daysUntil*24*60)+(hrsUntil*60));
	var secsUntil=totalSecs-((daysUntil*24*60*60)+(hrsUntil*60*60)+(minsUntil*60));

	//if(daysUntil<10){ this.dayStr="00"+String(daysUntil);
	//}else if(daysUntil<100){this.dayStr="0"+String(daysUntil);
	//}else{this.dayStr=String(daysUntil);}
	this.dayStr=String(daysUntil);

	if(hrsUntil<10){ this.hrStr="0"+String(hrsUntil);
	}else{this.hrStr=String(hrsUntil);}

	if(minsUntil<10){ this.minStr="0"+String(minsUntil);
	}else{this.minStr=String(minsUntil);}

	if(secsUntil<10){ this.secStr="0"+String(secsUntil);
	}else{this.secStr=String(secsUntil);}

	this.d=(this.dayStr >1||this.dayStr==0)?" days ":" day ";
	this.h=(this.hrStr >1||this.hrStr==0)?" hours ":" hour ";
	this.m=(this.minStr >1||this.minStr==0)?" minutes ":" minute ";
	
	this.displayString = this._formatDisplayString( this.raw_display_string );

	this.displayNums();
	setTimeout('thisCountdown.countTime()',60000);
}

Countdown.prototype.displayNums=function()
{
	document.getElementById("cd_clock").innerHTML=this.displayString;
}

Countdown.prototype._formatDisplayString=function(formatter) 
{
	var output = formatter;
	
	if(formatter.match("%days%")) output = output.replace("%days%", this.dayStr)
	if(formatter.match("%hours%")) output = output.replace("%hours%", this.hrStr)
	if(formatter.match("%mins%")) output = output.replace("%mins%", this.minStr)
	
	if(formatter.match("%d%")) output = output.replace("%d%", this.d)
	if(formatter.match("%h%")) output = output.replace("%h%", this.h)
	if(formatter.match("%m%")) output = output.replace("%m%", this.m)
	
	if(formatter.match("%endtext%")) output = output.replace("%endtext%", this.str_endtext)
	
	return output;
}