﻿    var timerID = null;
    var timerRunning = false;

    function stopclock ()
    {
        if(timerRunning)
        clearTimeout(timerID);
        timerRunning = false;
    }

    function showtime (strControlID) 
    {
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds()
        var timeValue = hours 
        timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds
        if (document.getElementById(strControlID)!=null)
          document.getElementById(strControlID).innerText = timeValue;
        timerID = setTimeout("showtime('" + strControlID + "')",1000);
        timerRunning = true;
    }
    
    function showdate(strControlID)
    {
        var currentTime = new Date()
        var month = currentTime.getMonth() + 1
        month = ((month < 10) ? "0" + month : month)
        var day = currentTime.getDate()
        day = ((day < 10) ? "0" + day : day)
        var year = currentTime.getFullYear()
        if (document.getElementById(strControlID)!=null)
            document.getElementById(strControlID).innerText = " " + year + "/" + month + "/" + day + " | " ;
    }

function startclock(strHourControlID) 
{
    stopclock();
    showtime(strHourControlID);
}


