/**
 * @author phOnkEE <phonkee@phonkee.eu>
 */

 var Loader = {

    loaderText : null,
    timeout : 20,
    element : null,
    elementId : 'loaderElement',
    timeoutObject : null,

    init : function(loaderText)
    {
        this.loaderText = loaderText
        this.createElement();
    },

    // -------------------------------------------------------------------------

    createElement : function()
    {
        this.element = $('<div />', {
            id : this.elementId,
            text : this.loaderText
        });
        this.element.css('width', '100px').center().css('top','160px').css('display', 'none');
        this.element.prependTo('body');
    },

    // -------------------------------------------------------------------------

    show : function()
    {
        this.element.css('display', 'block');
        this.timeoutObject = setTimeout(Loader.hide, this.timeout * 1000);
    },

    // -------------------------------------------------------------------------

    hide : function()
    {
        clearTimeout(this.timeoutObject)
        this.element.css('display', 'none');
    }

};


