﻿var Ebiquity;
if (!Ebiquity) Ebiquity = {}
if (!Ebiquity.Modal) Ebiquity.Modal = {};
Ebiquity.Modal = function(speed, opc, el) {        
    this.speed = speed;
    this.opc = opc;
    var self = this;
    this.overlay = $("#modaloverlay");
    this.contents = $("#modalcontents");
    this.width = this.contents.width();
    if (typeof el == 'string' && el != '')
        $("#" + el).click(function() { self.show(); });  
    else     
        $(document).ready(function() { self.show(); });   
    $("#modalcontrol").click(function() { self.hide(); }); 
};
Ebiquity.Modal.prototype.show = function() {
    var width = $(document).width();
    this.contents.css({"left":(width - this.width) / 2 - 8});
    this.overlay.css({"height":$(document).height(), "width":width, opacity:this.opc});
    this.contents.fadeIn(this.speed);
    this.overlay.fadeIn(this.speed);
};
Ebiquity.Modal.prototype.hide = function() {
    this.contents.fadeOut(this.speed);
    this.overlay.fadeOut(this.speed);        
};

