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

    <script>

    w = new win(400,100,400,400,"Hello World")

    w.setServerURL(MSURL)
    w.setVar("map",MSMAP)

    function submitWin() {
        w.setVar("mapsize",w.contentWidth + " " + w.contentHeight)

    //Read all name-value pairs from first table
        var names = document.getElementsByName("ms_name")
        var values = document.getElementsByName("ms_value")
    //and set the corresponding CGI variables
        mapextSet = false
        for (var i = 0;i<names.length;i++) {
            var n = names[i].value
            var v = values[i].value
            if (n) {
                w.setVar(n,v)
                if (n == "mapext") mapextSet = true
            }
        }

    //read the projection from the textfield
        var projName = document.getElementById("proj").value
        if (!projName ) projName = "latlong"
        projString = "proj=" + projName + ",ellps=clrk66"

    //read all proj parameters  from the second table
        var parms = document.getElementsByName("proj_parm")
        for (var i = 0;i < parms.length; i++) {
            var parm = parms[i].id
            var val = parms[i].value
            if (val) projString = projString + "," + parm + "=" + val

        }
        w.setVar("map_projection",projString)

    //check for default coordinates either in degrees or meters
        if (!mapextSet) {
        if (projName == "latlong") {
                w.setVar("mapext","-180 -90 180 90")
            } else {
                w.setVar("mapext","-20000000 -10000000 20000000 10000000")
            }
        }
        w.submit()
    }

    w.setExecOnResize(submitWin)

    </script>

    <input type=button value="Click!" onclick="submitWin()">

    <!-- Text fields with name-value pairs for CGI variables -->
    <br><br>
    <table>
      <tr><td colspan=2 align=center>CGI Variables
      <tr><th>name<th>value
      <tr>
         <td><input type=text name=ms_name>
         <td><input type=text name=ms_value>
      <tr>
         <td><input type=text name=ms_name>
         <td><input type=text name=ms_value>
      <tr>
         <td><input type=text name=ms_name>
         <td><input type=text name=ms_value>
      <tr>
         <td><input type=text name=ms_name>
         <td><input type=text name=ms_value>
    </table>

    <br><br>

    <table>
      <tr><td colspan=2 align=center> Projection Parameters
      <tr><td>proj<td><input type=text  id=proj>
      <tr><td>lon_0<td><input type=text name=proj_parm id=lon_0>
      <tr><td>lat_0<td><input type=text name=proj_parm id=lat_0>
      <tr><td>lat_1<td><input type=text name=proj_parm id=lat_1>
      <tr><td>lat_2<td><input type=text name=proj_parm id=lat_2>
    </table>

    </body>