// JavaScript Document
<!-- Original:  Mark Lockwood (sy161e.net@namezero.com) -->
<!-- Web Site:  http://www.sy161e.net -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

function syeClock() {
timePortion = new Array;
maxLength = new Array;
var runTime = new Date();
timePortion[0] = runTime.getHours();
timePortion[1] = runTime.getMinutes();
timePortion[2] = runTime.getSeconds();
maxLength[0] = 5;
maxLength[1] = 6;
maxLength[2] = 6;
var decValue = 0;
var decMod = 0;
var temp = "";
var hoursBackground = "#33FFFF";
var minutesBackground = "#FFFF99";
var secondsBackground = "#FFCCCC";
var colonBackground = "#FFFFFF";
var textColor = "#000000";
for (var curPor = 0; curPor <= 2; curPor++) {
decValue = timePortion[curPor];
timePortion[curPor] = "";
while (decValue != 0) {
decMod = decValue % 2;
decValue = Math.floor(decValue / 2);
timePortion[curPor] = decMod + timePortion[curPor];
}
if (timePortion[curPor].length < maxLength[curPor]) {
for (var i = 1; i <= maxLength[curPor] - timePortion[curPor].length; i++) {
temp += "0";
   }
}
timePortion[curPor] = temp + timePortion[curPor];
temp = "";
}
document.getElementById('clock').innerHTML =
'<table border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor='+ hoursBackground  +'><font color='+ textColor +'>' + timePortion[0] + '</font></td><td bgcolor='+ colonBackground +'>:</td><td bgcolor='+ minutesBackground +'><font color='+ textColor +'>' + timePortion[1] + '</font></td><td bgcolor='+ colonBackground +'>:</td><td bgcolor='+ secondsBackground +'><font color='+ textColor +'>' + timePortion[2] + '</font></td></tr></table>';
setTimeout("syeClock()", 1000)
}

window.onload = syeClock;

