function digital_clock()
{
var date=new Date()
var hours=date.getHours()
var minutes=date.getMinutes()
var seconds=date.getSeconds()

var datum=date.getDate();
var month=date.getMonth()+1;
var year=date.getFullYear();

/*
*Calls the addZero function to add a zero infront of hours, minutes or seconds if they are below 10, i.e.
*to make it look like 12:07:09, not 12:7:9
*/
minutes=addZero(minutes)
seconds=addZero(seconds)
hours=addZero(hours)
datum=addZero(datum)
month=addZero(month)

/*
*Puts hours in the element with the hours id,
*minutes in the element with the minutes id,
*and seconds in the element with the seconds id etc
*/
document.getElementById('hours')
.innerHTML = hours 
document.getElementById('minutes')
.innerHTML = minutes
document.getElementById('seconds')
.innerHTML = seconds

document.getElementById('datum')
.innerHTML = datum
document.getElementById('month')
.innerHTML = month
document.getElementById('year')
.innerHTML = year

/*
*Runs every half second
*/
setTimeout('digital_clock()', 500)
}
/*
Adds a zero infront of minutes or seconds
*/
function addZero(min_or_sec)
{
if (min_or_sec < 10)
{min_or_sec="0" + min_or_sec}
return min_or_sec
}
