/*   4/22/2005 - ALIWEB's JavaScript for searches and popup windows

Function List:

// openMultDialog() - Load a multiple search dialog window
// openPopup() - Open a generic popup window

*/

var currValues = "";        // For multiple searches

// openMultDialog() - Load a multiple search dialog window
function openMultDialog(width, height, objName, rowOrFunc, title, currVal, dest)    {

    // Open the window only if needed
    if (dialogWin.win && (!dialogWin.win.closed)) {
        dialogWin.win.focus();
        return;
    }

    // Initialize the window properties including a unique name
    dialogWin.width = width;
    dialogWin.height = height;
    dialogWin.arrayName = objName;
    dialogWin.currValues = currVal;
    dialogWin.title = title;
    dialogWin.returnFunc = rowOrFunc;
    dialogWin.name = (new Date()).getSeconds().toString();

    // Assemble window attributes and try to center the dialog.
    if (Nav4) {

        // 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 +
          ",width=" + dialogWin.width + ",height=" + dialogWin.height;
    } else {

        // The best we can do here is to center in the screen
        dialogWin.left = (screen.width - dialogWin.width) / 2;
        dialogWin.top = (screen.height - dialogWin.height) / 2;
        var attr = "left=" + dialogWin.left + ",top=" + dialogWin.top +
          ",width=" + dialogWin.width + ",height=" + dialogWin.height;
    }
    attr = attr + ",resizable=yes";
    //    attr = attr + ",menubar=yes";

    // Open our dialog window
    dialogWin.win = window.open("", dialogWin.name, attr);
//  dialogWin.win.location.href = "file:///g:/javascrp/search/MultSrch/MultSrch.htm";
    dialogWin.win.location.href = dest;
    dialogWin.win.focus();
}

// openPopup() - Open a generic popup window
function openPopup(width, height, doScroll, doResize, dest, cParam, retFunc, showMenu)  {

    // Open the window only if needed
    if (dialogWin.win && (!dialogWin.win.closed)) {
        dialogWin.win.focus();
        return;
    }

    // Initialize the window properties including a unique name
    dialogWin.width = width;
    dialogWin.height = height;
    dialogWin.name = (new Date()).getSeconds().toString();

    // Assemble window attributes and try to center the dialog.
    if (Nav4) {

        // 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 +
          ",width=" + dialogWin.width + ",height=" + dialogWin.height;
    } else {

        // The best we can do here is to center in the screen
        dialogWin.left = (screen.width - dialogWin.width) / 2;
        dialogWin.top = (screen.height - dialogWin.height) / 2;
        var attr = "left=" + dialogWin.left + ",top=" + dialogWin.top +
          ",width=" + dialogWin.width + ",height=" + dialogWin.height;
    }
    attr = attr + ",resizable=" + doResize + "," + "scrollbars=" + doScroll;
    if (showMenu)   {
        attr = attr + ",menubar";
    }

    // Open our dialog window
    dialogWin.win = window.open("", dialogWin.name, attr);
    dialogWin.returnFunc = retFunc;
    dialogWin.win.paramSTR = cParam;
    dialogWin.win.location.href = dest;
    dialogWin.win.focus();
    return dialogWin.win;
}
