function submitZoom(x1,y1,x2,y2,w) {
    var zx1 = x1 - w.contentLeft
    var zy1 = y1 - w.contentTop
    var zx2 = x2 - w.contentLeft
    var zy2 = y2 - w.contentTop
    if (zx1 > zx2) {
        var t = zx1
        zx1 = zx2
        zx2 = t
    } 
    if (zy1 > zy2) {
        var t = zy1
        zy1 = zy2
        zy2 = t
    } 
    var mapext = w.getReturnedVar("mapext")
    if (!mapext) mapext = "-180 -90 180 90"
    w.setVar("imgext",mapext)
    w.setVar("imgbox",zx1 + " " + zy1 + " " + zx2 + " " + zy2)
    winSubmit(w,true)
    w.removeVar("imgext")
    w.removeVar("imgbox")
}

function submitPan(x1,y1,x2,y2,w) {
    var zx1 = x1 - x2
    var zy1 = y1 - y2
    var zx2 = zx1 + w.contentWidth
    var zy2 = zy1 + w.contentHeight
    var mapext = w.getReturnedVar("mapext")
    if (!mapext) mapext = "-180 -90 180 90"
    w.setVar("imgext",mapext)
    w.setVar("imgbox",zx1 + " " + zy1 + " " + zx2 + " " + zy2)
    winSubmit(w,true)
    w.removeVar("imgext")
    w.removeVar("imgbox")
}

function submitZoomOut(x1,y1,x2,y2,w) {
    var zx1 = x1 - w.contentLeft
    var zy1 = y1 - w.contentTop
    var mapext = w.getReturnedVar("mapext")
    if (!mapext) mapext = "-180 -90 180 90"
    w.setVar("imgext",mapext)
    w.setVar("imgxy",zx1 + " " + zy1)
    w.setVar("zoom",-1.5)
    winSubmit(w,true)
    w.removeVar("imgext")
    w.removeVar("imgxy")
    w.removeVar("zoom")
}

function submitZoomAll() {
    var w = WinList[0]
    w.setVar("mapext","-180 -90 180 90")
    w.submit()
	w.removeVar("mapext")
}

var wins = new Array(w1,w2a,w2b,w3a,w3b,w3c)

function setZoomAll() {
    globalZoom(submitZoom,wins)
}
function setPanAll() {
    globalPan(submitPan,wins)
}
function setZoomOutAll() {
    globalClick(submitZoomOut,wins)
}

m = new menu(
    "zoom in",setZoomAll,
    "zoomout",setZoomOutAll,
    "pan",setPanAll,
    "zoom all",submitZoomAll
)
m.realSticky(true)
m.stickyButtons(true)
m.showAt(10,300)

