/* ----------------------------------------------------------------------------- *
 * SAS Institute, Inc.                                                           *
 *                                                                               *
 * Copyright (c) 2003 by SAS Institute Inc., Cary, NC, USA. All Rights Reserved. *
 *                                                                               *
 * Contains general JS code which brings up the SASDoc window in a common        *
 * fashion.                                                                      *
 *                                                                               *
 * Dependencies: none                                                            *
 *                                                                               *
 * @author David Cagle (dacagl)                                                  *
 * ----------------------------------------------------------------------------- */
// globals
var g_contentsDialog = null; // Navigation window
var g_helpDialog = null;     // Documentation window

// methods
function openHelpDocDialog(event, helpPath) {
    // nav.jsp is used for TOC, Index, and Search
    if ( helpPath.indexOf( "nav.jsp" ) != -1 ) {
        g_contentsDialog = window.open(helpPath, "SASHelpNavV",
                           'width=400px,height=480px,left=5px,top=5px,resizable=yes');
        g_contentsDialog.focus();
    } else {
        g_helpDialog = window.open(helpPath, "SASHelpV",
                       'width=450px,height=480px,left=420px,top=5px,resizable=yes');
        g_helpDialog.focus();
    }
}

function closeHelpDocDialog() {
    // Close the Navigation Window
    if (g_contentsDialog != null) {
        if (!g_contentsDialog.closed) {
            g_contentsDialog.close();
        }
        g_contentsDialog = null;
    }
    
    // Close the Documentation Window
    if (g_helpDialog != null) {
        if (!g_helpDialog.closed) {
            g_helpDialog.close();
        }
        g_helpDialog = null;
    }
}