﻿ModalClass = function () {
    this._action = null;
    this._controller = null;
}

ModalClass.Load = function () {
    var _dados = new ModalClass();
    _dados.initialize();
    return _dados;
}

ModalClass.prototype = {

    initialize: function () { },

    _fecharModal: function (elem) {
        $('#overlay').hide();
        $('#' + elem.data).hide();
    },

    _abrirModal: function (elem) {
        $('#overlay').show();
        $('#' + elem).show();

        var modal_height = $('#' + elem).height();
        var modal_width = $('#' + elem).width();

        var margin_left = '-' + Math.floor(modal_width / 2) + 'px';
        var margin_top = '-' + Math.floor(modal_height / 2) + 'px';

        $('#' + elem).css({
            'margin-left': margin_left,
            'margin-top': margin_top
        });
        $('#fecharModal').live('click', elem, $.methodDelegate(this, this._fecharModal));
    }
}

