// need to do some special stuff to handle MSIE.
-var toggleModal = function () {
+var toggleModal = function (b) {
+
+ if (modalShowing && b) return;
+ if (!modalShowing && !b) return;
html.className=modalShowing?'':'modal';
+
modalShowing = !modalShowing;
+
if (modalShowing) {
dialog.focus();
} else if (focusedElement) {