schedule1.html

    <head><title>scheduling.html</title></head>
    <script src=../window.js></script>
    <script src=../examples.js></script>

    <body>

    <input value="Send Query" type=button onclick="submits2()">
    <br>
    <br>
    Enter filter:
    <input type=text id="filterexpr">

    <script>

    w = new win(50,100,700,400,"query window","querywindow.html")

    function submits1() {
        s1.setVar("map_countries_class_color",
            Math.round(Math.random() * 255) + " "  +
            Math.round(Math.random() * 255) + " "  +
            Math.round(Math.random() * 255)
        )
        s1.submit()
    }

    function submits2() {
        var queryString = document.getElementById("filterexpr").value
        if (queryString != "" ) s2.setVar("qstring",querystring)
        else s2.setVar("qstring","/.*/")
        s2.submit()
    }

    function displayMap(s) {
        var mapimg = w.contentWindow.document.getElementsByTagName("img")[0]
        var mapurl = s.getVar("img")
        mapimg.src = mapurl
    }

    function displayQuery(s) {
        var windowSpan = w.contentWindow.document.getElementsByTagName("span")[0]
        var extentSpan = w.contentWindow.document.getElementsByTagName("span")[1]
        var serverFrameBody =s.contentWindow.document.body
        windowSpan.innerHTML = serverFrameBody.innerHTML
        var tbl = s.contentWindow.document.getElementsByTagName("table")[0]
        minx = miny = Number.POSITIVE_INFINITY
        maxx = maxy = Number.NEGATIVE_INFINITY
        for (var i=1;i<tbl.rows.length;i++) {
            var r = tbl.rows[i].cells[1].innerHTML.split(" ")
            for (var j=0;j<4;j++) r[j] = parseInt(r[j])
            if (r[0]<minx) minx = r[0]
            if (r[1]<miny) miny = r[1]
            if (r[2]>maxx) maxx = r[2]
            if (r[3]>maxy) maxy = r[3]
        }
        extentSpan.innerHTML = "Returned extent: " + minx + "/" + miny + " - " + maxx + "/" + maxy
        s1.setVar("mapext",minx + " " + miny + " " + maxx + " " + maxy)
        submits1()

    }

    w.setExecOnResize(submits2)

    s1 = w.addServerFrame()
    s1.setServerURL(MSURL)
    s1.setVar("map",MSMAP)

    s2 = w.addServerFrame()
    s2.setServerURL(MSURL)
    s2.setVar("map",MSMAP)
    s2.setVar("mode","itemnquery")
    s2.setVar("qlayer","countries")
    s2.setVar("qitem","NAME")

    s3 = w.addServerFrame()
    s3.setExecOnReturn(displayMap)

    s4 = w.addServerFrame()
    s4.setExecOnReturn(displayQuery)

    s1.setTarget(s3)
    s2.setTarget(s4)
    </script>
    </body>