﻿(function ($) {

    var defTitle = "Default Title";
    var defMsg = "Default Msg";

    var _isOpen = false;
    var methods = {
        init: function () {

        }
        ,
        show: function (description) {

            //console.log(description);

            
            var _title = defTitle;
            var _msg = defMsg;

            if (arguments.length > 1) {
                _title = arguments[1];
                _msg = arguments[2];
            }

            RenderModalDialog("error", "__error", function () {

                $('a[bind="error"][name="try"]').click(function () {
                    $.fancybox.close();
                    _isOpen = false;
                })

            }, { model: { Title: _title, Msg: description} });
            TE('/error/' + _title);
            _isOpen = true;


        },
        log: function (description) {
            //console.log(description);
        }

    };


    $.fn.Errors = function (method) {
        if (methods[method]) {


            return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
        } else if (typeof method === 'object' || !method) {
            return methods.init.apply(this, arguments);
        } else {
            $.error('Method ' + method + ' does not exist on jQuery.My');
        }
    };




    //  ...
    // end of closure
})(jQuery);
