+function show_dialog (extern) {\r
+ var default_close_function = function($diag) {\r
+ $diag.fadeOut('fast', function() {\r
+ $diag.remove();\r
+ });\r
+ }\r
+\r
+ var options = {\r
+ extra_class: '',\r
+ pos: {\r
+ x: ($(window).width() / 2) + $(window).scrollLeft(),\r
+ y: ($(window).height() / 2) + $(window).scrollTop()\r
+ },\r
+ dim: false, \r
+ yes_text: messages.ok,\r
+ yes_callback: default_close_function,\r
+ no_text: messages.cancel,\r
+ show_no: false,\r
+ close_on_clickoutside: false\r
+ }\r
+\r
+ $.extend(options, extern);\r
+\r
+ if (options.event != undefined) {\r
+ options.pos = {x: options.event.pageX, y: options.event.pageY};\r
+ }\r
+\r
+ var html = '<div class="dialog ' + options.extra_class + '" style="display: none;">'\r
+ + '<div class="dialog-content">' + options.html + '</div><div class="dialog-buttons">';\r
+\r
+ if (options.show_no) {\r
+ html += '<button class="dialog-no">' + options.no_text + '</button>';\r
+ }\r
+\r
+ html += '<button class="dialog-yes">' + options.yes_text + '</button>'\r
+ + '</div></div>';\r
+\r
+ $dialog = $(html);\r
+ $('body').append($dialog);\r
+ var message = $('.dialog-content')[0];\r
+ message.style.visibility = "hidden";\r
+\r
+ if (options.dim === false) {\r
+ $dialog.css({\r
+ visibility: 'hidden',\r
+ display: 'block'\r
+ });\r
+\r
+ options.dim = {w: $dialog.width(), h: $dialog.height()};\r
+\r
+ $dialog.css({\r
+ width: 1,\r
+ height: 1,\r
+ visibility: 'visible'\r
+ });\r
+ }\r
+\r
+ $dialog.css({\r
+ top: options.pos.y,\r
+ left: options.pos.x\r
+ });\r
+\r
+ $dialog.animate({\r
+ top: "-=" + (options.dim.h / 2),\r
+ left: "-=" + (options.dim.w / 2),\r
+ width: options.dim.w,\r
+ height: options.dim.h\r
+ }, 200, function() {\r
+ message.style.visibility = "visible";\r
+ });\r