if (typeof (Tody) === "undefined") var Tody = {};

(function($) {

    Tody.ChooseReports = new function() {

        var self = this;

        //$('#freeOrderLink').click(self.getChooseReportsForm);

        self.getChooseReportsForm = function() {
            if ($("#ClientQuestionary_QuestionaryId").length == 0) {
                Tody.ContentMenu.deleteCookie();

                self.showBoxy(actionUrl('/choosereports'), ' ');
            }
        };

        self.showBoxyHtml = function(resultHtml, canClose) {
            var result = $('<div></div>').append(resultHtml);
            contactBoxy = new Boxy(result[0], {
                title: " ",
                draggable: false,
                modal: true,
                show: true,
                closeable: canClose !== undefined ? canClose : true
            });

            return contactBoxy;
        };

        self.showBoxy = function(address, title) {

            var boxyToClose = Tody.MasterPage.showBoxyHtml("<div><img src='content/ajax-loader-large.gif' style='padding-left:170px' alt='loader'/></div>", false);

            Boxy.load(address, {
                title: title,
                draggable: false,
                modal: true,
                show: true,
                unloadOnHide: true,
                afterShow: function() {
                    boxyToClose.hideAndUnload();
                }
            });
        };

    };
})(jQuery);
