/* Minification failed. Returning unminified contents.
(1,19): run-time error CSS1031: Expected selector, found '='
(1,19): run-time error CSS1025: Expected comma or open brace, found '='
(6,24): run-time error CSS1031: Expected selector, found '='
(6,24): run-time error CSS1025: Expected comma or open brace, found '='
(58,1): run-time error CSS1019: Unexpected token, found '$'
(58,2): run-time error CSS1019: Unexpected token, found '('
(58,11): run-time error CSS1031: Expected selector, found ')'
(58,11): run-time error CSS1025: Expected comma or open brace, found ')'
(60,2): run-time error CSS1019: Unexpected token, found ')'
 */
var WGAD_Opinions = {
    init: function () {
    }
}

WGAD_Opinions.messages = {
    init: function () {
        var mm = $('.modal-message');
        mm.each(function (i, el) {
            var m = $(el);
            m.dialog({
                modal: true,
                autoOpen: false,
                buttons: {
                    Ok: function () {
                        $(this).dialog('close');
                        WGAD_Opinions.messages.performAction(this);
                    }
                },
                close: function () {
                    WGAD_Opinions.messages.performAction(this);
                }
            });
        });
        var mc = $('.modal-confirm');
        mc.each(function (i, el) {
            var c = $(el);
            c.dialog({
                modal: true,
                autoOpen: false,
                buttons: {
                    Ok: function () {
                        WGAD_Opinions.messages.performAction(this);
                    },
                    Cancel: function () {
                        $(this).dialog('close');
                    }
                }
            });
        });
    },
    performAction: function (dialog, close) {
        var url = $(dialog).attr('data-redirect');
        if (url && url.length > 0) {
            document.location.href = url;
        }
        var action = $(dialog).attr('data-action');
        if (action && action.length > 0) {
            eval(action);
        }
        if (close) {
            $(dialog).dialog("close");
        }
    }
}


$(document).ready(function () {
    WGAD_Opinions.init();
});
