<head><title>zoom3.html</title>
<script src=../window.js></script>
<script src=../examples.js></script>
</head>
<body>
<script>
w1 = new win(10,150,200,200,"First Window")
w1.setServerURL(MSURL)
w1.setVar("map",MSMAP)
w1.setVar("map_countries_class_color","255 0 0")
w2 = new win(220,150,200,200,"Second Window")
w2.setServerURL(MSURL)
w2.setVar("map",MSMAP)
w2.setVar("map_countries_class_color","0 255 0")
w3 = new win(100,370,200,200,"Third Window")
w3.setServerURL(MSURL)
w3.setVar("map",MSMAP)
w3.setVar("map_countries_class_color","0 0 255")
var zooming = false
function submitwin(w) {
if (!zooming) {
var mapext = w.getReturnedVar("mapext")
if (mapext) w.setVar("mapext",mapext)
} else {
w.removeVar("mapext")
}
w.setVar("mapsize",w.contentWidth + " " + w.contentHeight)
w.submit()
}
w1.setExecOnResize(submitwin)
w2.setExecOnResize(submitwin)
w3.setExecOnResize(submitwin)
function submitAll() {
submitwin(w1)
submitwin(w2)
submitwin(w3)
}
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)
zooming = true
submitwin(w)
zooming = false
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)
zooming = true
submitwin(w)
zooming = false
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)
zooming = true
submitwin(w)
zooming = false
w.removeVar("imgext")
w.removeVar("imgxy")
w.removeVar("zoom")
}
function submitZoomAll() {
var w = WinList[0]
w.setVar("mapext","-180 -90 180 90")
w.submit()
}
var wins = new Array(w1,w2,w3)
function setZoomAll() {
globalZoom(submitZoom,wins)
}
function setPanAll() {
globalPan(submitPan,wins)
}
function setZoomOutAll() {
globalClick(submitZoomOut,wins)
}
m = new menu(
"submit 3 maps",submitAll,
"zoom in",setZoomAll,
"zoomout",setZoomOutAll,
"pan",setPanAll,
"zoom all",submitZoomAll
)
m.realSticky(true)
m.stickyButtons(true)
m.showAt(160,10)
</script>