function Popup() {
    this._popup = $('#message-popup');
    this.active = false;
    this.on_exit = null;
    var that = this;
    this._popup.find('span.ui-icon-close').click(function(){
        that.hide();
    });
    this.hide();
};

Popup.prototype.get = function() {
    return this;
};

Popup.prototype.set_header = function(text) {
    this._popup.children('h3.popUpHeader').text(text);
};

Popup.prototype.set_message = function(text) {
    //this._popup.find('p.red strong').text(text);
    this._popup.find('p.red').text(text);
};

Popup.prototype.clear = function() {
    this.set_header('');
    this.set_message('');
};

Popup.prototype.show = function(on_exit) {
    this._popup.removeClass('hide');
    this.on_exit = on_exit;
};

Popup.prototype.hide = function() {
    this._popup.addClass('hide');
    if (this.on_exit){
        this.on_exit.call(this);
    }
};

var popup = null;
$(document).ready(function(){
    popup = new Popup();
});

