String.prototype.trim=function(){
	a = this.replace(/^\s+/, '');
    return a.replace(/\s+$/, ''); 
}

function Timer(t)
{
	var time=t;
 
	this.start=function()
	{
		this.next();
	}
	this.next= function ()
	{
		if(time>0){
			time--;
			this.nextEvent();
		}else{
			this.endEvent();
		}
	}
	
	this.getDays =function (){
		return Math.floor(time/(3600*24));
	}
	this.getHours =function (){
		return Math.floor((time-(this.getDays()*3600*24))/(3600));
	}
	this.getMinutes =function (){
		return Math.floor((time-(this.getDays()*3600*24)-(this.getHours()*3600))/60);
	}
	this.getSeconds= function (){
		return Math.floor(time-(this.getDays()*3600*24)-(this.getHours()*3600)-(this.getMinutes()*60));
	}
	
	this.nextEvent=function (){}
	
	this.endEvent = function (){
		
	}
}
