﻿general.namespace('SW.Controls');

(function () {
    /* CLASS LoadingIndicator */
    var LoadingIndicator = SW.Controls.LoadingIndicator = function () {
        this.loadingCount = 0;
        this.thumper = document.getElementById('map-thumper');
        
        // cache image
        var temp = new Image();
        temp.src = '/assets/images/loading-map.gif';
    };
    LoadingIndicator.prototype.constructor = LoadingIndicator;
    
    /**/
    LoadingIndicator.prototype.addLoad = function () {
        this.loadingCount++;
        this.thumper.src = '/assets/images/loading-map.gif';
    };
    
    /**/
    LoadingIndicator.prototype.removeLoad = function () {
        this.loadingCount--;
        if (this.loadingCount <= 0) {
            this.loadingCount = 0;
            this.thumper.src = '/assets/images/loading-map-still.gif';
        }
    };
})();
