I am catching click on website and closing modal window.
But how to actually check if click occured inside or outside of modal window?
    $(document).click(callself(this, function (inst, event) {
        var modalElement = $(selector);
        if (modalElement.css("display") == "block") {
            this.closeButtonClicked();
        }
    }));
 
    