/*
 +-------------------------------------------------------------------+
 |                      J S - C L O C K   (v1.0)                     |
 |                                                                   |
 | Copyright Gerd Tentler                www.gerd-tentler.de/tools   |
 | Created: Dec. 6, 2002                 Last modified: Feb. 5, 2005 |
 +-------------------------------------------------------------------+
 | This program may be used and hosted free of charge by anyone for  |
 | personal purpose as long as this copyright notice remains intact. |
 |                                                                   |
 | Obtain permission before selling the code for this program or     |
 | hosting this software on a commercial website or redistributing   |
 | this software over the Internet or in any other medium. In all    |
 | cases copyright must remain intact.                               |
 +-------------------------------------------------------------------+
*/
//--------------------------------------------------------------------------------------------------------
// Definition
//--------------------------------------------------------------------------------------------------------

var imgPath     = "images/clock_images";       // path to images (digits)
var borderColor = "#D00000";      // border color
var borderWidth = 0;              // border width (pixels); set to 0 for no border

//--------------------------------------------------------------------------------------------------------
// Build clock
//--------------------------------------------------------------------------------------------------------

document.write('<table border=0 cellspacing=0 cellpadding=' + borderWidth + '><tr><td>');
document.write('<table border=0 cellspacing=0 cellpadding=1 width=135><tr align=center>');
document.write('<td nowrap class="fSubtitle" valign=middle><font color=red> Local Time </font>');
document.write('&nbsp');
document.write('<img src="' + imgPath + '/dg8.gif" name="hr1" width=10 height=12>');
document.write('<img src="' + imgPath + '/dg8.gif" name="hr2" width=10 height=12>');
document.write('<img src="' + imgPath + '/dgc.gif" width=8 height=12>');
document.write('<img src="' + imgPath + '/dg8.gif" name="mn1" width=10 height=12>');
document.write('<img src="' + imgPath + '/dg8.gif" name="mn2" width=10 height=12>');
document.write('<img src="' + imgPath + '/nix.gif" width=4 height=12>');
document.write('<img src="' + imgPath + '/dk8.gif" name="se1" width=10 height=12>');
document.write('<img src="' + imgPath + '/dk8.gif" name="se2" width=10 height=12>');
document.write('</td></tr></table></td></tr></table>');

//--------------------------------------------------------------------------------------------------------
// Functions
//--------------------------------------------------------------------------------------------------------

var dg0 = new Image();  dg0.src = imgPath + '/dg0.gif';
var dg1 = new Image();  dg1.src = imgPath + '/dg1.gif';
var dg2 = new Image();  dg2.src = imgPath + '/dg2.gif';
var dg3 = new Image();  dg3.src = imgPath + '/dg3.gif';
var dg4 = new Image();  dg4.src = imgPath + '/dg4.gif';
var dg5 = new Image();  dg5.src = imgPath + '/dg5.gif';
var dg6 = new Image();  dg6.src = imgPath + '/dg6.gif';
var dg7 = new Image();  dg7.src = imgPath + '/dg7.gif';
var dg8 = new Image();  dg8.src = imgPath + '/dg8.gif';
var dg9 = new Image();  dg9.src = imgPath + '/dg9.gif';

function viewTime() {
  var d = new Date();
  
  var hr = d.getHours() + 100;
  var mn = d.getMinutes() + 100;
  var se = d.getSeconds() + 100;
  var time = '' + hr + mn + se;

  document.hr1.src = imgPath + '/dg' + time.substr(1, 1) + '.gif';
  document.hr2.src = imgPath + '/dg' + time.substr(2, 1) + '.gif';
  document.mn1.src = imgPath + '/dg' + time.substr(4, 1) + '.gif';
  document.mn2.src = imgPath + '/dg' + time.substr(5, 1) + '.gif';
  document.se1.src = imgPath + '/dk' + time.substr(7, 1) + '.gif';
  document.se2.src = imgPath + '/dk' + time.substr(8, 1) + '.gif';
}

var interval = setInterval('viewTime()', 1000);
