@tools.dpuser

function fixpgplot, current {
    fixpgplot = stringarray(0)
    n = 1
    while (strpos(current[n], "<table CELLSPACING=0") == -1) {
        fixpgplot += current[n]
        n++
    }
    n += 2
    fixpgplot += "<h1 class=\"declaration\">" + current[n] + "</h1>"
    n += 2
    while (n <= nelements(current)) {
        fixpgplot += current[n]
        n++
    }
}

files = ["qfitsview.html","viewingtools.html","maindisplay.html","toolbar.html","dpuserwindow.html","cubespectrum.html"]

style = import("style.html", /text);

for n=1, nelements(files) {
    print files[n]
    content = import("../" + files[n], /text)
    output = stringarray(0)
    j = 1
    while (strpos(content[j], "</head>") == -1) {
        output += content[j]
        j++
    }
    output += style
    while (strpos(content[j], "<h1") == -1) {
        output += content[j]
        j++
    }
    output += menu(html_header(), files[n])
    while (strpos(content[j], "</body>") == -1) {
        output += content[j]
        j++
    }
    output += footer()
    while (j <= nelements(content)) {
        output += content[j]
        j++
    }
    export "../../../dpuser/doc/www/" + files[n], output
}

exec "cp ../*.png ../../../dpuser/doc/www"
exec "cp tel.gif ../../../dpuser/doc/www"
