var BoxColor = "#000000"; // color of box var BoxSize = 1; // box line width; // Global vars var iWidth = 400; // image width (default) var iHeight = 300; // image height (default) var hspc = 0; // horizontal image offset var vspc = 0; // vertical image offset var ovBoxSize = 1; // Zoombox line width; var zbMapImage = "MapImage"; // default var MODE_BOX = 1; var currMode = MODE_BOX; var zooming = false; var mouseX=0; var mouseY=0; var x1=0; var y1=0; var x2=0; var y2=0; var zleft=0; var zright=0; var ztop=0; var zbottom=0; // Global vars for browser type and version var isNav = (navigator.appName.indexOf("Netscape")>=0); var isNav4 = false; var isIE4 = false; var is5up = false; if (isNav) { if (parseFloat(navigator.appVersion)<5) { isNav4=true; } else { is5up = true; } } else { isIE4=true; if (navigator.appVersion.indexOf("MSIE")>0) { isIE4 = false; is5up = true; } } function initZoomBox(iMapWidth, iMapHeight, MapImageName) { iWidth = iMapWidth; iHeight = iMapHeight; zbMapImage = MapImageName; // zoom/selection box content = ''; createLayer("zoomBoxTop",0,0,iWidth,iHeight,false,content); content = ''; createLayer("zoomBoxLeft",0,0,iWidth,iHeight,false,content); content = ''; createLayer("zoomBoxRight",0,0,iWidth,iHeight,false,content); content = ''; createLayer("zoomBoxBottom",0,0,iWidth,iHeight,false,content); // set zoom box color setLayerBackgroundColor("zoomBoxTop", BoxColor); setLayerBackgroundColor("zoomBoxLeft", BoxColor); setLayerBackgroundColor("zoomBoxRight", BoxColor); setLayerBackgroundColor("zoomBoxBottom", BoxColor); if (isNav) { document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP); } document.onmousedown = mapTool; document.onmouseup = chkMouseUp; document.onmousemove = getMouse; updateZoomBoxCursor(); } function setZoomBoxMode(mode) { if ( mode == MODE_BOX) { currMode = mode; updateZoomBoxCursor(); } } /**************************************************************************************** DHTML layer functions ****************************************************************************************/ // Create a DHTML layer function createLayer(name, inleft, intop, width, height, visible, content) { var layer; if (isNav4) { document.writeln(''); document.writeln(content); document.writeln(''); } else { document.writeln('
iWidth) mouseX = iWidth - 1; if (mouseY>iHeight) mouseY = iHeight - 1; if (mouseX<=0) mouseX = 1; if (mouseY<=0) mouseY = 1; if (zooming) { x2=mouseX; y2=mouseY; setClip(); } return false; } // clip zoom box layer to mouse coords function setClip() { var tempX=x1; var tempY=y1; if (x1>x2) { zright=x1; zleft=x2; } else { zleft=x1; zright=x2; } if (y1>y2) { zbottom=y1; ztop=y2; } else { ztop=y1; zbottom=y2; } if ((x1 != x2) && (y1 != y2)) { boxIt(zleft,ztop,zright,zbottom); } } /**************************************************************************************** Click/Mouse functions - used to catch mouse button events ****************************************************************************************/ // check for mouseup function chkMouseUp(e) { if ((currMode == MODE_BOX) && (zooming)) { stopZoomBox(e); if (zleft == zright && ztop == zbottom) onZoomXY(zleft, ztop); else onZoomBox(zleft, ztop, zright, zbottom); } return false; } // perform appropriate action with mapTool function mapTool (e) { // check mouse left button var button; if (document.layers) { button = e.which; } else { if (!isNav) button = event.button; else button = (e.button == 0 ? 1 : 0); } if( button != 1) return; // adjust left-top onResize(); getImageXY(e); if ( (currMode == MODE_BOX) && (!zooming) && (mouseX>=0) && (mouseX=0) && (mouseY