aimsClickPresent=true;var onOVArea=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;var totalMeasure=0;var currentMeasure=0;var lastTotMeasure=0;var clickCount=0;var	clickPointX=new Array();var clickPointY=new Array();var clickMeasure=new Array();var clickType=1;var shapeSelectBuffer=false;var panning=false;var zooming=false;var selectBox=false;var blankImage="/website/ImageArchive/secondary/map.gif";var leftButton=1;var rightButton=2;if(isNav){leftButton=1;rightButton=3;};function clickAddPoint(){var theX=mouseX;var theY=mouseY;getMapXY(theX,theY);clickPointX[clickCount]=mapX;clickPointY[clickCount]=mapY;clickCount+=1;selectCount=0;totalMeasure=totalMeasure+currentMeasure;clickMeasure[clickCount]=totalMeasure;legendTemp=legendVisible;legendVisible=false;var theString=writeXML();var theNum=99;sendToServer(imsURL,theString,theNum);};function resetClick(){var c1=clickCount;clickCount=0;clickPointX.length=1;clickPointY.length=1;currentMeasure=0;totalMeasure=0;lastTotMeasure=0;clickMeasure.length=1;selectCount=0;legendTemp=legendVisible;legendVisible=false;var theString=writeXML();var theNum=99;sendToServer(imsURL,theString,theNum);if(toolMode==20){updateMeasureBox();}};function deleteClick(){var c1=clickCount;clickCount=clickCount-1;selectCount=0;if(clickCount<0){clickCount=0;};if(clickCount>0){totalMeasure=clickMeasure[clickCount];clickPointX.length=clickCount;clickPointY.length=clickCount;clickMeasure.length=clickCount;}else{totalMeasure=0;clickMeasure[0]=0;}currentMeasure=0;if(c1>0){legendTemp=legendVisible;legendVisible=false;var theString=writeXML();var theNum=99;sendToServer(imsURL,theString,theNum);}};function clickFunction(toolName){if(typeof aimsCustom_ModifyClickFunction=="function"){toolName=aimsCustom_ModifyClickFunction(toolName);};var isOk;var j;if(toolName!="zoomin"){parent.MapFrame.showGreeting=false;};if(hasLayer("measureBox")){hideLayer("measureBox");};if((toolName!="downloadrect")&&(toolName!="fullextent")){hideLayer("xBoxTop");hideLayer("xBoxLeft");hideLayer("xBoxRight");hideLayer("xBoxBottom");xTop=eTop;xBottom=eBottom;xRight=eRight;xLeft=eLeft;};if((toolName!="downloadrect")&&(toolName!="fullextent")){hideLayer("xBoxTop");hideLayer("xBoxLeft");hideLayer("xBoxRight");hideLayer("xBoxBottom");xTop=eTop;xBottom=eBottom;xRight=eRight;xLeft=eLeft;};switch(toolName){case "zoomInCenter":toolMode=1001;panning=false;selectBox=false;modeBlurb=modeList[21];zoomButton(1);break;case "zoomOutCenter":toolMode=1002;panning=false;selectBox=false;modeBlurb=modeList[22];zoomButton(2);break;case "zoomin":toolMode=1;panning=false;selectBox=false;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[0];break;case "zoomout":toolMode=2;panning=false;selectBox=false;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[1];break;case "zoomlast":zoomBack();panning=false;zooming=false;selectBox=false;break;case "zoomactive":var q=LayerExtent[ActiveLayerIndex].split("|");panning=false;zooming=false;selectBox=false;var l=parseFloat(setDecimalString(q[0]));var b=parseFloat(setDecimalString(q[1]));var r=parseFloat(setDecimalString(q[2]));var t=parseFloat(setDecimalString(q[3]));var w=r-l;var h=t-b;var wm=w*(5/100);var hm=h*(5/100);l=l-wm;r=r+wm;b=b-hm;t=t+hm;zoomToEnvelope(l,b,r,t);break;case "fullextent":fullExtent();break;case "pan":toolMode=3;zooming=false;selectBox=false;if(isIE){document.all.theTop.style.cursor="move";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[2];break;case "identify":panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;if(canQuery){toolMode=4;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[3];}else{alert(msgList[46]);};showGeocode=false;if(useTextFrame){parent.TextFrame.document.location=appDir+"blank.htm";};hideLayer("measureBox");break;case "identifyall":panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;toolMode=5;if(canQuery){if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[20];}else{alert(msgList[46]);};showGeocode=false;drawSelectBoundary=false;if(useTextFrame){parent.TextFrame.document.location=appDir+"blank.htm";};hideLayer("measureBox");break;case "hyperlink":isOk=false;j=-1;panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;toolMode=15;modeBlurb=modeList[9];showGeocode=false;if(useTextFrame){parent.TextFrame.document.location=appDir+"blank.htm";};hideLayer("measureBox");isOk=checkHyperLinkLayer(ActiveLayerIndex);if(isOk){if(canQuery){if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;}}else{alert(msgList[46]);}}else{currentHyperLinkLayer="";currentHyperLinkField="";alert(msgList[47]);};break;case "hyperlinkany":j=-1;panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;toolMode=30;modeBlurb=modeList[9];showGeocode=false;if(useTextFrame){parent.TextFrame.document.location=appDir+"blank.htm";};hideLayer("measureBox");if(canQuery){if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;}}else{alert(msgList[46]);};break;case "measure":panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;if(clickCount>0){if(totalMeasure==0){resetClick();}};toolMode=20;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[12];if(clickType==1){showLayer("measureBox");updateMeasureBox();};showGeocode=false;if(useTextFrame){parent.TextFrame.document.location=appDir+"blank.htm";};break;case "setunits":toolMode=52;modeBlurb=modeList[25];if(useTextFrame){parent.TextFrame.location="setUnits.htm";}else{window.open((appDir+"setUnits.htm"),"OptionWindow","width=575,height=120,scrollbars=yes,resizable=yes");};break;case "shape":panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;toolMode=21;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[13];showGeocode=false;hideLayer("measureBox");break;case "selectbox":panning=false;zooming=false;if(canQuery){toolMode=10;queryTool=0;clickCount=0;showBuffer=false;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[4];}else{alert(msgList[46]);};showGeocode=false;if(useTextFrame){parent.TextFrame.document.location=appDir+"blank.htm";};hideLayer("measureBox");break;case "selectpoint":panning=false;zooming=false;shapeSelectBuffer=false;if(canQuery){toolMode=11;queryTool=0;clickCount=0;resetClick();if(isIE){document.all.theTop.style.cursor="hand";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[5];}else{alert(msgList[46]);};showGeocode=false;showBuffer=false;hideLayer("measureBox");break;case "selectline":panning=false;zooming=false;shapeSelectBuffer=false;if(canQuery){toolMode=12;queryTool=0;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};hideLayer("measureBox");if(useTextFrame){parent.TextFrame.document.location=appDir+"selectline.htm";}else{Win1=open("selectline.htm","QueryWindow","width=575,height=150,scrollbars=yes,resizable=yes");};modeBlurb=modeList[6];}else{alert(msgList[46]);};showGeocode=false;showBuffer=false;break;case "selectpoly":panning=false;zooming=false;shapeSelectBuffer=false;if(canQuery){toolMode=13;queryTool=0;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};hideLayer("measureBox");if(useTextFrame){parent.TextFrame.document.location=appDir+"selectpoly.htm";}else{Win1=open("selectpoly.htm","QueryWindow","width=575,height=150,scrollbars=yes,resizable=yes");};modeBlurb=modeList[7];}else{alert(msgList[46]);};showGeocode=false;showBuffer=false;break;case "selectshape":panning=false;zooming=false;shapeSelectBuffer=false;if(canQuery){toolMode=16;queryTool=0;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};hideLayer("measureBox");if(useTextFrame){parent.TextFrame.document.location=appDir+"select.htm";}else{Win1=open("select.htm","QueryWindow","width=575,height=150,scrollbars=yes,resizable=yes");};modeBlurb=modeList[8];}else{alert(msgList[46]);};showGeocode=false;showBuffer=false;break;case "buffershape":panning=false;zooming=false;if(canQuery){toolMode=17;queryTool=0;shapeSelectBuffer=true;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;};hideLayer("measureBox");if(useTextFrame){parent.TextFrame.document.location=appDir+"shapeBuffer.htm";}else{Win1=open("shapeBuffer.htm","QueryWindow","width=575,height=150,scrollbars=yes,resizable=yes");};modeBlurb=modeList[11];}else{alert(msgList[46]);};showGeocode=false;showBuffer=false;break;case "geocode":panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;hideLayer("measureBox");modeBlurb=modeList[14];setupGeocode();break;case "query":panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;queryStartRecord=1;queryTool=51;if(canQuery){LayerFields.length=1;LayerFieldType.length=1;LayerFieldCount=0;toolMode=8;modeBlurb=modeList[15];fieldIndex=0;setQueryString="";hideLayer("measureBox");queryForm();}else{alert(msgList[46]);};showGeocode=false;showBuffer=false;break;case "storedquery":panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;queryStartRecord=1;queryTool=1;toolMode=51;modeBlurb="Search";if(canQuery){toolMode=51;modeBlurb=modeList[16];fieldIndex=0;setQueryString="";hideLayer("measureBox");getStoredQueries();}else{alert(msgList[46]);};showGeocode=false;showBuffer=false;break;case "find":toolMode=9;panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;queryStartRecord=1;queryTool=1;if(canQuery){LayerFields.length=1;LayerFieldType.length=1;LayerFieldCount=0;fieldIndex=0;setQueryString="";hideLayer("measureBox");modeBlurb=modeList[17];findForm();}else{alert(msgList[46]);};showGeocode=false;showBuffer=false;break;case "clearsel":clearSelection();break;case "buffer":if(useBuffer){if(checkSelected()){toolMode=25;shapeSelectBuffer=false;modeBlurb=modeList[18];writeBufferForm();}else{showBuffer=false;alert(msgList[48]);}}else{alert(msgList[49]);};break;case "options":writeOptionForm();break;case "mapinfo":toolMode=51;modeBlurb=modeList[24];displayMapServicesInfo();break;case "print":toolMode=50;modeBlurb=modeList[23];printIt();break;case "dbidentify":panning=false;zooming=false;selectBox=false;shapeSelectBuffer=false;if(canQuery){toolMode=40;if(isIE){document.all.theTop.style.cursor="hand";theCursor=document.all.theTop.style.cursor;};modeBlurb=modeList[3];}else{alert(msgList[46]);};showGeocode=false;if(useTextFrame){parent.TextFrame.document.location=appDir+"blank.htm";};hideLayer("measureBox");break;case "extract":extractIt();break;case "legend":if(aimsLegendPresent){if(imsURL!=""){if(hasTOC){if(legendVisible){legendVisible=false;parent.TOCFrame.document.location=appDir+"toc.htm";}else{legendVisible=true;getLegend();}}else{legendVisible=true;getLegend();}}else{alert(msgList[45]);}}else{alert(msgList[50]);};break;case "layerlist":writeLayerListForm();break;default:alert(msgList[51]);};modeName=modeBlurb;if(useModeFrame){writeModeFrame(modeBlurb);}else if((drawFloatingMode)&&(modeLayerOn)){writeModeLayers(modeBlurb);}else if((modeRefreshMap)&&(drawModeOnMap)){sendMapXML();}};function chkMouseUp(e){if((toolMode==1)&&(zooming)){stopZoomBox(e);}else if((toolMode==2)&&(zooming)){stopZoomOutBox(e);}else if((toolMode==3)&&(panning)){stopPan(e);}else if((toolMode==10)&&(selectBox)){stopSelectBox(e);}else if((toolMode==1204)&&(xBox)){stopSelectExBox(e);}else if((toolMode==1204)&&(xBox)){stopSelectExBox(e);}else if((toolMode==1700)&&(selectBox)){stopSelectBoxMeta(e);}else if((toolMode==1084)&&(selectBox)){stopSelectUSGSBox(e);}else if((toolMode==2000)&&(selectBox)){stopSelectBoxMeta(e);}else{if(typeof aimsCustom_chkMouseUp=="function"){aimsCustom_chkMouseUp(e);}};return false;};function mapTool(e){parent.MapFrame.showGreeting=false;var theButton=0;if(isNav){theButton=e.which;}else{theButton=window.event.button;};if(theButton==leftButton){getImageXY(e);if((mouseX>=0)&&(mouseX<iWidth)&&(mouseY>=0)&&(mouseY<iHeight)){if((hasOVMap)&&(ovIsVisible)&&(mouseX<i2Width+ovBoxSize)&&(mouseY<i2Height)&&(ovMapIsLayer)){ovMapClick(mouseX,mouseY);window.status="On OV Map Area";}else{switch(toolMode){case 1:startZoomBox(e);return false;case 2:startZoomOutBox(e);return false;case 3:startPan(e);return false;case 4:identify(e);break;case 5:identifyAll(e);break;case 1204:startSelectExBox(e);return false;break;case 1700:startSelectMetaBox(e);return false;break;case 2000:startSelectMetaBox(e);return false;break;case 10:startSelectBox(e);return false;case 11:if(checkIfActiveLayerAvailable()){select(e);};break;case 12:if(checkIfActiveLayerAvailable()){clickType=2;clickAddPoint();if(useTextFrame){if(parent.TextFrame.document.title!==modeList[60]){parent.TextFrame.document.location=appDir+"selectline.htm";}}};break;case 13:if(checkIfActiveLayerAvailable()){clickType=3;clickAddPoint();if(useTextFrame){if(parent.TextFrame.document.title!==modeList[7]){parent.TextFrame.document.location=appDir+"selectpoly.htm";}}};break;case 15:hyperLink(e);break;case 16:if(checkIfActiveLayerAvailable()){clickType=2;clickAddPoint();if(useTextFrame){if(parent.TextFrame.document.title!==modeList[8]){parent.TextFrame.document.location=appDir+"select.htm";}}};break;case 17:if(checkIfActiveLayerAvailable()){clickType=2;clickAddPoint();if(useTextFrame){if(parent.TextFrame.document.title!=modeList[11]){parent.TextFrame.document.location=appDir+"shapeBuffer.htm";}}};break;case 20:clickType=1;clickAddPoint();break;case 21:clickType=4;clickAddPoint();break;case 30:hyperLinkAny(e);break;case 40:if(aimsDBPresent){matchDBLinkLayer(dbLinkLayer);dbIdentify(e);};break;case 50:break;case 51:break;case 52:break;default:if(toolMode>=1000){customMapTool(e);}}}}}};function updateMeasureBox(){var theForm;if(isNav4){theForm=document.layers["measureBox"].document.forms[0];}else{theForm=document.forms[0];};var j=1;for(var i=0;i<sUnitList.length;i++){if(ScaleBarUnits==sUnitList[i]){j=i;}};var u=Math.pow(10,numDecimals);var tMeas=0;if(totalMeasure!=0){tMeas=parseInt(totalMeasure*u+0.5)/u;};theForm.theMeasTotal.value=tMeas+" "+unitList[j];theForm.theMeasSegment.value=currentMeasure+" "+unitList[j];showLayer("measureBox");}

