function alreadyin, list, token {
rv = 0
for i=1, nelements(list) {
if (list[i] == token) {
rv = 1
}
}
alreadyin = rv
}

function unify, input {
list = input
replace list, "\.", " "
replace list, ",", " "
replace list, "\"", " "
list = lower(list)
list = simplifywhitespace(list)
list = strsplit(list)
rv = stringarray(0)
rv += list[1]
for i=2, nelements(list) {
bla = list[i]
if (alreadyin(rv, bla) == 0) {
rv += bla
}
}
unify = rv[1]
for i=2, nelements(rv) {
if (strlen(rv[i]) > 2) {
unify += " " + rv[i]
}
}
replace unify, "  ", " "
}

function menu, header, current {
 rv = stringarray(0)
 for i=1, nelements(header) {
  if (strpos(header[i], current) == -1) {
   rv += header[i]
  } else {
   rv += "
- <a class=\"current\"" + header[i][7:strlen(header[i])]
  }
 }
 menu = rv
}

function html_header {
html_header = stringarray(0)
html_header += "
DPUSER - The Next Generation
"
html_header += "
"
html_header += "
"
html_header += "
- Introduction"
//html_header += "
- Installation"
html_header += "
- History"
html_header += "
- Syntax"
html_header += "
- Operators"
html_header += "
- Structural commands"
html_header += "
- Data types"
html_header += "
- Graphics"
html_header += "
- Fits files"
html_header += "
- Calling PYTHON/GDL"
html_header += "
- Category index"
html_header += "
- Function index"
html_header += "
- Procedure index"
html_header += "
- Pgplot index"
html_header += "
- Examples"
html_header += "
"
html_header += "
- QFitsView documentation"
html_header += "
"
html_header += "
"
html_header += "
"
html_header += ""
html_header += ""
html_header += "
"
html_header += "
"
html_header += "
"
}

function footer {
footer = stringarray(0)
footer += "
"
footer += "
"
footer += version()
footer += " - Imprint - Privacy Policy"
footer += "
"
}

function nohtml, input {
nohtml = stringarray(0)
i = 1
while (strpos(input[i], "<h1") == -1) i++
//print i
while (i < nelements(input)) {
line = input[i]
replace line, "<h1>", ""
replace line, "<[^>]+>", ""
replace line, "<div[^>]+>", ""
nohtml += line
i++
}
}

