﻿//*************************************** Timer *****************************************//
function timer(quize_time)
{
	this.quizTime = quize_time ;
	this.sec = 0 ;
	this.min = 0 ;
	this.uhr = 0 ;
}


timer.prototype.chronoStart = function()
{
	this.sec = Math.abs( -- this.quizTime ) ;
	this.min = Math.floor( this.sec / 60 ) ;
	this.sec = this.sec - this.min * 60 ;
	this.uhr = Math.floor( this.min / 60 ) ;
	this.min = this.min - this.uhr * 60 ;
	
	if (this.uhr < 10)this.uhr = "0" + this.uhr ;
	if (this.min < 10)this.min = "0" + this.min ;
	if (this.sec < 10)this.sec = "0" + this.sec ;
	if ( this.quizTime > 0 ){
		
		document.getElementById("chronotime").innerHTML = this.uhr + ":" + this.min + ":" + this.sec ;
		
		
	}else {
		document.getElementById("chronotime").style.color = "#FF0000";
		document.getElementById("chronotime").innerHTML = this.uhr + ":" + this.min + ":" + this.sec  ;
	}
	
}
