// open a pop-up window and load the website tour as specified
function popupTour(Which) {
  aTourPopup=window.open('','_Tour','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=425,height=600')
  aTourPopup.focus()

  aTourPopup.location='tourDisplay.php?Which=' + Which
}


// open a window and load the help system

function displayHelp(Type, Category, Topic) {
  aHelpPopup=window.open('','_Help','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=750,height=600')
  //aHelpPopup=window.open('','_Help')
  aHelpPopup.focus()

  aHelpPopup.location='/Peak/helpMain.php?Type=' + Type + '&Category=' + escape(Category) + '&Topic=' + escape(Topic)
}


// open a window and load the specified help
function popupHelp(Type, Category, Topic, Parms) {
  aHelpPopup = OpenScrollWindow('', '_Help', 500, 750)
  //aHelpPopup=window.open('','_Help')
  aHelpPopup.focus()

  aHelpPopup.location='/Peak/helpDisplay.php?Type=' + Type + '&Category=' + escape(Category) + '&Topic=' + escape(Topic) + '&' + Parms
}


// open a window and load the specified glossary term
function popupGlossary(Category, Topic) {
  aHelpPopup = OpenScrollWindow('', '_Help', 550, 300)
  //aHelpPopup=window.open('','_Help')
  aHelpPopup.focus()

  aHelpPopup.location='helpGlossary.php?Category=' + escape(Category) + '&Entry=' + escape(Topic) + '&Size=single'
}


// open a window and write the given help message to it.

function popQHelp(param,text) {
  if (text == '') return

  aPopup = OpenScrollWindow('', '_Help', 400, 250)
  //aPopup=window.open('','_Help')
  nDoc = aPopup.document
  nDoc.open()
  body = '<html><head><title>Questionnaire Edit Help</title>\n'
  url = location.hostname + location.pathname
  url = url.substr(0, url.lastIndexOf('/'))
  body += '<base href="http://' + url + '/">\n'
  body += '<link rel=\"stylesheet\" href=\"styles/peak-styles.css\" type=\"text/css\">\n'
  body += '<script type=\"text/javascript\" language=\"javascript\" src=\"scripts/tools.js\"></script>\n'
  body += '<script type=\"text/javascript\" language=\"javascript\" src=\"scripts/helpSys.js\"></script>\n'
  body += '</head><body class=\"help\">\n'
  body += '<div class=\"title\">' + param + '</div><br>\n'
  body += '<div class=\"sans10pt\">'
  body += text
  //body += '<script language=\"JavaScript\">\n'
  //body += 'function displayHelp(Type,Category, Topic) {\n'
  //body += '  opener.top.displayHelp(Type, Category, Topic)\n'
  //body += '}\n'
  //body += '</script>\n'
  body += '</div><br>\n'
  body += '<div align="center"><span><a href="javascript:window.self.close()" style="border: solid 1px #336699; font-size: 18px; color: white; text-align: center; background-color: #1277a3" onmouseover="this.style.backgroundColor=\'#4fAfd9\'" onmouseout="this.style.backgroundColor=\'#1277a3\'"><span class="bigButton" style="margin:3px 30px 3px 30px\">OK</span></a></span></div>'
  body += '</body></html>\n'
  nDoc.write(body)
  nDoc.close()
}

