/* simModal.js *//*     Example File From "JavaScript and DHTML Cookbook"     Published by O'Reilly & Associates     Copyright 2003 Danny Goodman*/// Global flag for Netscape 4-only event handling branches.var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))// One object tracks the current modal dialog opened from this window.var dialogWin = new Object();// Generate a modal dialog.// Parameters://    url -- URL of the page/frameset to be loaded into dialog//    width -- pixel width of the dialog window//    height -- pixel height of the dialog window//    returnFunc -- reference to the function (on this page)//                  that is to act on the data returned from the dialog//    args -- [optional] any data you need to pass to the dialog//function openSimDialog(url, width, height, returnFunc, args) {function openDialog(choice, reg_id, co_id, wdth, hght, su_id) {// SK if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed)) {            // Initialize properties of the modal dialog object.                     dialogWin.url = "dialogwindow.php?model=" + choice ;        dialogWin.width = wdth;        dialogWin.height = hght;        dialogWin.returnFunc = submitIt;        //dialogWin.args = args;        dialogWin.returnedValue = "";        // Keep name unique.             dialogWin.name = "new_window";               //dialogWin.name = (new Date()).getSeconds().toString();        //dialogWin.name = choice;//       alert("New window name: " + dialogWin.name);        // Assemble window attributes and try to center the dialog.        if (window.screenX) {              // Netscape 4+            // Center on the main window.            dialogWin.left = window.screenX +                ((window.outerWidth - dialogWin.width) / 2);            dialogWin.top = window.screenY +                ((window.outerHeight - dialogWin.height) / 2);            var attr = "screenX=" + dialogWin.left +                ",screenY=" + dialogWin.top + ",toolbar=no,scrollbars=no,status=no,directories=no,resizable=no,location=no,menubar=no,width=" +                dialogWin.width + ",height=" + dialogWin.height + ",scrollbars=0";        } else if (window.screenLeft) {    // IE 5+/Windows             // Center (more or less) on the IE main window.            // Start by estimating window size,             // taking IE6+ CSS compatibility mode into account            var CSSCompat = (document.compatMode && document.compatMode != "BackCompat");            window.outerWidth = (CSSCompat) ? document.body.parentElement.clientWidth : document.body.clientWidth;            window.outerHeight = (CSSCompat) ? document.body.parentElement.clientHeight : document.body.clientHeight;            window.outerHeight -= 80;            dialogWin.left = parseInt(window.screenLeft+                ((window.outerWidth - dialogWin.width) / 2));            dialogWin.top = parseInt(window.screenTop +                ((window.outerHeight - dialogWin.height) / 2));            var attr = "left=" + dialogWin.left +                ",top=" + dialogWin.top + ",toolbar=no,scrollbars=no,status=no,directories=no,resizable=no,location=no,menubar=no,width=" +                dialogWin.width + ",height=" + dialogWin.height;        } else {                           // all the rest            // The best we can do is center in screen.            dialogWin.left = (screen.width - dialogWin.width) / 2;            dialogWin.top = (screen.height - dialogWin.height) / 2;            var attr = "left=" + dialogWin.left + ",top=" +                dialogWin.top + ",toolbar=no,scrollbars=no,status=no,directories=no,resizable=no,location=no,menubar=no,width=" + dialogWin.width +                ",height=" + dialogWin.height;        }                //       alert("The window parameters are:" + attr);                // Generate the dialog and make sure it has focus.    if (dialogWin.win && !dialogWin.win.closed) {//       alert("The window is already open2");dialogWin.win.close();//        dialogWin.win.focus();//        return false;    }        dialogWin.win=window.open(dialogWin.url, dialogWin.name, attr);        dialogWin.win.focus();//       alert("Message test1");       // SK  } else {//       alert("The window is already open");// SK       dialogWin.win.close(); //       dialogWin.win=window.open(dialogWin.url, dialogWin.name, attr);    //       dialogWin.win.focus();// SK   }}//// Invoked by onfocus event handler of EVERY frame,// return focus to dialog window if it's open.function checkModal() {    setTimeout("finishChecking()", 50);    return true;}function finishChecking() {   if (dialogWin.win && !dialogWin.win.closed) {        dialogWin.win.focus();    }}//alert("The Script is Completed");  