function loadDot(id, noOfDots, maxDots)
{
	if(noOfDots == null)
	{
		noOfDots = 1;
	}
	if(maxDots == null)
	{
		maxDots = 4;
	}

	var dots = '';

	for(var d = 1; d <= noOfDots; d++)
	{
		dots += '.';
	}

	document.getElementById(id).innerHTML = dots;

	noOfDots++;
	if(noOfDots > maxDots)
	{
		noOfDots = 1;
	}
	setTimeout("loadDot('" + id + "', " + noOfDots + ", " + maxDots + ")", 500);
}

function WriteTimer(tiSeconds)
{
	var Tseconds = tiSeconds % 60;
	var Tminutes = Math.floor(tiSeconds / 60) % 60;
	var Thours = Math.floor(tiSeconds / 3600);
	var Ttext = '';
	var TfSize = false;

	if(Thours > 0)
	{
		Ttext += addzero(Thours) + ':';
		if(Tminutes == 0)
		{
			Ttext += '00:';
		}
		TfSize = 11; // lots of time left, small font size
	}
	if(Tminutes > 0)
	{
		if(Thours > 0)
		{
			Ttext += addzero(Tminutes) + ':';
		}
		else
		{
			Ttext += Tminutes + ':';
			TfSize = 14; // only minutes left, increase font
		}
		if(Tseconds == 0)
		{
			Ttext += '00';
		}
	}
	if(Tseconds > 0)
	{
		if(tiSeconds > 60) // more than a minute left
		{
			Ttext += addzero(Tseconds);
		}
		else
		{
			Ttext += Tseconds;

			TfSize = 16; // seconds left, set font to maximum
		}
	}

	if(timerFontSize != TfSize)
	{
		timerFontSize = TfSize;
		document.getElementById('timerDiv').style.fontSize = TfSize + 'px';
	}

	document.getElementById('timerDiv').innerHTML = Ttext;

}

function OlaNordmannTime(timeInSeconds) // returns time in norwegian human-readable format.
{
	var seconds = timeInSeconds % 60;
	var minutes = Math.floor(timeInSeconds / 60) % 60;
	var hours = Math.floor(timeInSeconds / 3600);

	var readable = '';

	if(hours > 0)
	{
		readable += hours + ' time';
		if(hours > 1) readable += 'r';

	}
	if(minutes > 0)
	{
		if(hours > 0)
		{
			if(seconds > 0)
			{
				readable += ', ';
			}
			else
			{
				readable += ' og ';
			}
		}
		readable += minutes + ' minutt';
		if(minutes > 1) readable += 'er';
	}
	if(seconds > 0)
	{
		if(minutes > 0 || hours > 0)
		{
			readable += ' og ';
		}
		readable += seconds + ' sekund';
		if(seconds > 1) readable += 'er';
	}

	return readable;
}