﻿Type.registerNamespace('FlightView.Script.DateTimeStamp');

FlightView.Script.DateTimeStamp = function (elementId) {
    this._elementObj = $get(elementId);
    this._timer = null;
    
    var owner = this;
    this._updateDateTimeFunc = function () {
        var now = new Date();
        owner._elementObj.innerHTML = now.format("h:mm tt");
    }
}

FlightView.Script.DateTimeStamp.prototype = {
    
    stop: function () {
        if (this._timer != null) {
            clearInterval(this._timer);
            this._timer = null;
        }
    },

    start: function () {
        if (this._timer == null) {
            this._timer = setInterval(this._updateDateTimeFunc, 1000);
        }
    }

}

FlightView.Script.DateTimeStamp.registerClass('FlightView.Script.DateTimeStamp');

if (typeof('Sys') != 'undefined') Sys.Application.notifyScriptLoaded();

