
/* -----------------------------------------------------------------
    
    Name:   yHelp_Mgmt.js   (previously zTwn_Rng.js)
    Author: Todd Stille - USDI, Bureau Land Management, Oregon State Office
    Date:   


    August 21, 2007  -  By Stille
                        Y version, Version Y.1.0 mod 0 (stille)  
         
    This script must be included in the Plats and Notes server
    directory.  
    
    This stuff is for loading/managing the HelpWindow that
    is linked from various display pages (such as ySrvy2.php).

         
  ----------------------------------------------------------------- */    

var helpWindow    // this is the handle for the help window


// -----  FUNCTION Check_Help_Key  -  key press event in body - if its a qmark then open help

function Help_Key(HELP_LINK) {
  if ((window.event.keyCode == 63) || (window.event.keyCode == 47)) {
       if (helpWindow) {   // there is-or-was a window - is it "is" or "was"?  better check
              if (helpWindow.closed) {
                    helpWindow = window.open (HELP_LINK,"Help_Window","height=300,width=530,left=1,top=1,resizable=yes,scrollbars=yes,status=no,toolbar=yes,menubar=no,location=no");
                   } else {
                       // do nothing
                   }   
           } else {   // you haven't got a help window and never did ... make one:
            helpWindow = window.open (HELP_LINK,"Help_Window","height=300,width=530,left=1,top=1,resizable=yes,scrollbars=yes,status=no,toolbar=yes,menubar=no,location=no");
       }  //  end if helpWindow - at this point you've got a help window opened - now, set focus to it: 
       helpWindow.focus();
  } 
}


// -----  FUNCTION Help_Click_B  -  click event for <a> object in main window - load help in its own window

function Help_Click_B(HELP_LINK) {
  if (helpWindow) {   // there is-or-was a window - is it "is" or "was"?  better check
         if (helpWindow.closed) {
               helpWindow = window.open (HELP_LINK,"Help_Window","height=300,width=530,left=1,top=1,resizable=yes,scrollbars=yes,status=no,toolbar=yes,menubar=no,location=no");
              } else {
                  // do nothing
              }   
      } else {   // you haven't got a help window and never did ... make one:
       helpWindow = window.open (HELP_LINK,null,"height=300,width=530,left=1,top=1,resizable=yes,scrollbars=yes,status=no,toolbar=yes,menubar=no,location=no");
  }  //  end if helpWindow - at this point you've got a help window opened - now, set focus to it:
 
  helpWindow.focus();
}

// -----  FUNCTION Help_Click_C  -  click event for <a> object in main window - load help in the calling window


function Help_Click_C(HELP_LINK) {
     window.open (HELP_LINK,"_self","height=200,width=500,left=1,top=1,resizable=yes,scrollbars=yes,status=no,toolbar=yes,menubar=no,location=no",bReplace=false);
}


// ----  get rid of a help window if one is open when unloading body -- use this for unload event on main window body

function Help_Off() {
  if (helpWindow) {   // there is-or-was a window - is it "is" or "was"?  better check
         if (helpWindow.closed) {
                  // do nothing
              } else {
                   helpWindow.close();
              }   // end if helpWindow.closed
  } // end if helpWindow 
} // end function
