--- /dev/null
+var focusedElement = null;
+
+var modal = document.getElementById('modal');
+var dialog = document.getElementById('dialog');
+var body = document.getElementById('global');
+var html = document.documentElement;
+
+var modalShowing = (html.className === 'modal');
+
+
+// Have to hack for Safari, due to poor support for the focus() function.
+try {
+ var isSafari = window.navigator.vendor.match(/Apple/);
+} catch (ex) {
+ isSafari = false;
+}
+if ( isSafari ) {
+ var dialogFocuser = document.createElement('a');
+ dialogFocuser.href="#";
+ dialogFocuser.style.display='block';
+ dialogFocuser.style.height='0';
+ dialogFocuser.style.width='0';
+ dialogFocuser.style.position = 'absolute';
+ dialog.insertBefore(dialogFocuser, dialog.firstChild);
+} else {
+ dialogFocuser = dialog;
+}
+
+window.onunload = function () {
+ dialogFocuser = focusedElement = modal = dialog = body = html = null;
+};
+
+var onfocus = function (e) {
+ e = e || window.event;
+ var el = e.target || e.srcElement;
+
+ // save the last focused element when the modal is hidden.
+ if ( !modalShowing ) {
+ focusedElement = el;
+ return;
+ }
+
+ // if we're focusing the dialog, then just clear the blurring flag.
+ // else, focus the dialog and prevent the other event.
+ var p = el.parentNode;
+ while ( p && p.parentNode && p !== dialog ) {
+ p=p.parentNode;
+ }
+ if ( p !== dialog ) {
+ dialogFocuser.focus();
+ }
+};
+
+
+
+var onblur = function () {
+ if ( !modalShowing ) {
+ focusedElement = body;
+ }
+};
+
+html.onfocus = html.onfocusin = onfocus;
+html.onblur = html.onfocusout = onblur;
+if ( isSafari ) {
+ html.addEventListener('DOMFocusIn',onfocus);
+ html.addEventListener('DOMFocusOut',onblur);
+}
+// focus and blur events are tricky to bubble.
+// need to do some special stuff to handle MSIE.
+
+
+var toggleModal = function () {
+
+ html.className=modalShowing?'':'modal';
+ modalShowing = !modalShowing;
+ if (modalShowing) {
+ dialog.focus();
+ } else if (focusedElement) {
+ try {
+ focusedElement.focus();
+ } catch(ex) {}
+ }
+
+};
<script type="text/javascript" src="static/wclib.js"></script>
<script type="text/javascript" src="static/roomops.js"></script>
<script type="text/javascript" src="static/ctdldragdrop.js"></script>
+ <script type="text/javascript" src="static/modal.js"></script>
</head>
<body>
<??("COND:LOGGEDIN",1)>
<?ICONBAR>
<??("X",1)>
+<!--("begin modal container")-->
+<div id="modal">
+ <div class="md-overlay-decorator"></div>
+ <div class="md-overlay-wrap">
+ <div class="md-overlay">
+ <div class="md-dialog-decorator"></div>
+ <div class="md-dialog-wrap">
+ <div class="md-dialog" id="dialog">
+ <div class="md-content">
+
+This is the modal dialog box. If you are seeing this message, the
+modal dialog was invoked without first populating its contents, which
+is a mistake.
+<br>
+<h2><a href="javascript:toggleModal();">Dismiss</a></h2>
+
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+<!--("end modal container")-->
<div id="global">
<!--("end head.html")-->