//--------------------------------------------------------------------------------------------------------
// Definition
//--------------------------------------------------------------------------------------------------------
var borderColor = "#D00000";                    // border color
var borderWidth = 2;                            // border width (pixels); set to 0 for no border
// var imgPath = "/srv/www/htdocs/img";            // path to images (digits)
var imgPath = "http://www.sdps-bbs.com/img";     // url to images (digits)

//--------------------------------------------------------------------------------------------------------
// Build clock
//--------------------------------------------------------------------------------------------------------
document.write('<table border=0 cellspacing=0 cellpadding=' + borderWidth + '><tr><td bgcolor=' + borderColor + '>');
document.write('<table border=0 cellspacing=0 cellpadding=1 width=135 bgcolor=black><tr align=center>');
document.write('<td nowrap>');
document.write('<img src="' + imgPath + '/wd8.png" name="wd" width=39 height=15 />');
document.write('<img src="' + imgPath + '/dk8.png" name="m1" width=10 height=15 />');
document.write('<img src="' + imgPath + '/dk8.png" name="m2" width=10 height=15 />');
document.write('<img src="' + imgPath + '/dkc.png" width=5 height=15 />');
document.write('<img src="' + imgPath + '/dk8.png" name="d1" width=10 height=15 />');
document.write('<img src="' + imgPath + '/dk8.png" name="d2" width=10 height=15 />');
document.write('<img src="' + imgPath + '/dkc.png" width=5 height=15 />');
document.write('<img src="' + imgPath + '/dk8.png" name="y1" width=10 height=15 />');
document.write('<img src="' + imgPath + '/dk8.png" name="y2" width=10 height=15 />');
document.write('<img src="' + imgPath + '/dk8.png" name="y3" width=10 height=15 />');
document.write('<img src="' + imgPath + '/dk8.png" name="y4" width=10 height=15 />');
document.write('</td></tr><tr align=center><td nowrap>');
document.write('<img src="' + imgPath + '/dg8.png" name="hr1" width=16 height=24 />');
document.write('<img src="' + imgPath + '/dg8.png" name="hr2" width=16 height=24 />');
document.write('<img src="' + imgPath + '/dgc.png" width=8 height=24>');
document.write('<img src="' + imgPath + '/dg8.png" name="mn1" width=16 height=24 />');
document.write('<img src="' + imgPath + '/dg8.png" name="mn2" width=16 height=24 />');
document.write('<img src="' + imgPath + '/nix.png" width=4 height=24 />');
document.write('<img src="' + imgPath + '/dk8.png" name="se1" width=10 height=15 />');
document.write('<img src="' + imgPath + '/dk8.png" name="se2" width=10 height=15 />');
document.write('</td></tr></table></td></tr></table>');

//--------------------------------------------------------------------------------------------------------
// Functions
//--------------------------------------------------------------------------------------------------------

var dg0 = new Image();  dg0.src = imgPath + '/dg0.png';
var dg1 = new Image();  dg1.src = imgPath + '/dg1.png';
var dg2 = new Image();  dg2.src = imgPath + '/dg2.png';
var dg3 = new Image();  dg3.src = imgPath + '/dg3.png';
var dg4 = new Image();  dg4.src = imgPath + '/dg4.png';
var dg5 = new Image();  dg5.src = imgPath + '/dg5.png';
var dg6 = new Image();  dg6.src = imgPath + '/dg6.png';
var dg7 = new Image();  dg7.src = imgPath + '/dg7.png';
var dg8 = new Image();  dg8.src = imgPath + '/dg8.png';
var dg9 = new Image();  dg9.src = imgPath + '/dg9.png';
var dk0 = new Image();  dk0.src = imgPath + '/dk0.png';
var dk1 = new Image();  dk1.src = imgPath + '/dk1.png';
var dk2 = new Image();  dk2.src = imgPath + '/dk2.png';
var dk3 = new Image();  dk3.src = imgPath + '/dk3.png';
var dk4 = new Image();  dk4.src = imgPath + '/dk4.png';
var dk5 = new Image();  dk5.src = imgPath + '/dk5.png';
var dk6 = new Image();  dk6.src = imgPath + '/dk6.png';
var dk7 = new Image();  dk7.src = imgPath + '/dk7.png';
var dk8 = new Image();  dk8.src = imgPath + '/dk8.png';
var dk9 = new Image();  dk9.src = imgPath + '/dk9.png';

function viewTime() {
    var d = new Date();

    var weekday = d.getDay();

    var day = d.getDate() + 100;

    var month = d.getMonth() + 101;

    var year = d.getYear();

    if (year < 1900) {
        year += 1900;
    }

    var date = '' + month + day + year;

  document.wd.src = imgPath + '/wd' + weekday + '.png';
  document.m1.src = imgPath + '/dk' + date.substr(1, 1) + '.png';
  document.m2.src = imgPath + '/dk' + date.substr(2, 1) + '.png';
  document.d1.src = imgPath + '/dk' + date.substr(4, 1) + '.png';
  document.d2.src = imgPath + '/dk' + date.substr(5, 1) + '.png';
  document.y1.src = imgPath + '/dk' + date.substr(6, 1) + '.png';
  document.y2.src = imgPath + '/dk' + date.substr(7, 1) + '.png';
  document.y3.src = imgPath + '/dk' + date.substr(8, 1) + '.png';
  document.y4.src = imgPath + '/dk' + date.substr(9, 1) + '.png';

  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) + '.png';
  document.hr2.src = imgPath + '/dg' + time.substr(2, 1) + '.png';
  document.mn1.src = imgPath + '/dg' + time.substr(4, 1) + '.png';
  document.mn2.src = imgPath + '/dg' + time.substr(5, 1) + '.png';
  document.se1.src = imgPath + '/dk' + time.substr(7, 1) + '.png';
  document.se2.src = imgPath + '/dk' + time.substr(8, 1) + '.png';
}

var interval = setInterval('viewTime()', 1000);
