
var teleZoomLocation=true;var teleClipShip=true;var teleZoomScale=true;var telePPI=96;var teleScale=0;var teleIsIE=true;if(navigator.appName=="Netscape")
teleIsIE=false;var MapUnits="METERS";var slidepos;function teleGetPageWidth()
{var tmpPWidth=(iWidth/telePPI);if(MapUnits=="METERS")
tmpPWidth*=0.0254;else if(MapUnits=="KILOMETERS")
tmpPWidth*=0.0000254;else if(MapUnits=="MILES")
tmpPWidth/=(5280*12);else if(MapUnits=="FEET")
tmpPWidth/=12;else if(MapUnits=="DEGREES")
{var yAve=(eBottom+eTop)/2.0;var inchesindegree=((111321.0/0.0254)*Math.cos((yAve*0.01745329251994328)));tmpPWidth/=inchesindegree;}
return tmpPWidth;}
function teleGetPageHeight()
{var tmpPHeight=(iHeight/telePPI);if(MapUnits=="METERS")
tmpPHeight*=0.0254;else if(MapUnits=="KILOMETERS")
tmpPHeight*=0.0000254;else if(MapUnits=="FEET")
tmpPHeight/=12;else if(MapUnits=="MILES")
tmpPHeight/=(5280*12);else if(MapUnits=="DEGREES")
{var inchesindegree=(110570.0/0.0254);tmpPHeight/=inchesindegree;}
return tmpPHeight;}
function teleUpdateScale()
{teleScale=Math.abs(maxx-minx)/teleGetPageWidth();}
function teleDoZoomLocation()
{var theDoc="";var formName="map";self.focus();var coordVals=teleGetFormValues(theDoc,formName);var tmpXoff=0;var tmpYoff=0;xmin=coordVals[0]-mapWidth/2;xmax=coordVals[0]+mapWidth/2;ymax=coordVals[1]+mapHeight/2;ymin=coordVals[1]-mapHeight/2;teleDoZoomToScale(25000);}
function teleDoClipAndShip()
{var theForm=parent.LOCFrame.document.clipship;var extractStr='<ARCXML version="1.1"><REQUEST><GET_EXTRACT><PROPERTIES>\n';extractStr+='<ENVELOPE minx="'+eLeft+'" miny="'+eBottom+'" maxx="'+eRight+'" maxy="'+eTop+'" /><LAYERLIST>\n';var i,j;for(i=0;i<layerCount;i++)
{if(LayerType[i]=="image")
extractStr+='<LAYERDEF id="'+LayerID[i]+'" visible="false" />\n';else
{for(j=0;j<theForm.elements.length;j++)
{if(LayerID[i]==theForm.elements[j].name)
{if(theForm.elements[j].checked)
extractStr+='<LAYERDEF id="'+LayerID[i]+'" visible="true" />\n';else
extractStr+='<LAYERDEF id="'+LayerID[i]+'" visible="false" />\n';}}}}
extractStr+='</LAYERLIST></PROPERTIES></GET_EXTRACT></REQUEST></ARCXML>';sendToServer(imsURL+"&CustomService=Extract",extractStr,1001);}
function zoomToScale(){slidepos=document.getElementById("sliderInput").value
teleDoZoomToScale(scales[slidepos])}
function teleDoZoomToScale(scale)
{var theScale=scale;if(theScale==-1)
{alert("No scale specified");}
else
{var newWidth=teleGetPageWidth()*theScale;var newHeight=teleGetPageHeight()*theScale;var diffX=Math.abs(newWidth-Math.abs(maxx-minx))/2;var diffY=Math.abs(newHeight-Math.abs(maxy-miny))/2;if(newWidth>Math.abs(maxx-minx))
{minx-=diffX;maxx+=diffX;}
else
{minx+=diffX;maxx-=diffX;}
if(newHeight>Math.abs(maxy-miny))
{maxy+=diffY;miny-=diffY;}
else
{maxy-=diffY;miny+=diffY;}
get2mapsWithCurrentExtent();}}
var t=parent.TopFrame;var roundscale;var scales=new Array(100000,50000,25000,18750,12500,6250,3125);function zoomdown(){hidePlusButton=false;var theScale=Math.round(teleScale);if(theScale>=scales[1]){getInitialMap();return;}
if(theScale<=scales[scales.length-1]){roundscale=teleScale*2;}
if(theScale>scales[scales.length-1]&&theScale<scales[1]){for(i=0;i<scales.length;i++){var neg=scales[i]-theScale;if(neg<=0){var k=i;break;}}
var ref=scales[k]+(scales[k-1]-scales[k])/2;if(theScale>ref){roundscale=scales[k-1];}else{roundscale=scales[k-1];}}
teleDoZoomToScale(roundscale);}
function zoomup(){var theScale=Math.round(teleScale);if(theScale>scales[1]){roundscale=scales[1];}
if(theScale<=scales[scales.length-1]){roundscale=scales[scales.length-1];hidePlusButton=true;}
if(theScale>scales[scales.length-1]&&theScale<=scales[1]){for(i=0;i<scales.length;i++){var neg=scales[i]-theScale;if(neg<=0){var k=i;break;}}
var ref=scales[k]+(scales[k-1]-scales[k])/2;if(theScale>ref){roundscale=scales[k+1];}else{roundscale=scales[k+1];}}
teleDoZoomToScale(roundscale)}
function calcscale(){var theScale=Math.round(teleScale);if(theScale>scales[1]){roundscale=scales[0];setslidebar(0)}
if(theScale==scales[1]){roundscale=scales[1];setslidebar(1)}
if(theScale<=scales[scales.length-1]){roundscale=scales[scales.length-1];setslidebar(scales.length-1)}
if(theScale>scales[scales.length-1]&&theScale<scales[1]){for(i=0;i<scales.length;i++){var neg=scales[i]-theScale;if(neg<=0){var k=i;break;}}
var ref=scales[k]+(scales[k-1]-scales[k])/2;if(theScale>ref){roundscale=scales[k-1];setslidebar(k-1);}else{roundscale=scales[k];setslidebar(k);}}}
function setimg(){for(m=0;m<(scales.length);m++){if(roundscale>scales[m]){document.getElementById("scim"+m).src="images/zoomup.gif";}
if(roundscale<scales[m]){document.getElementById("scim"+m).src="images/zoomdown.gif";}
if(roundscale==scales[m]){document.getElementById("scim"+m).src="images/zoomhigh.gif";}}
return;}
function setslidebar(pos){if(hidePlusButton){$("plusbutton").src=($("plusbutton").src!="images/zoomplus_p.gif"?"images/zoomplus_p.gif":"images/zoomplus_p.gif");$("plusbutton").onmousedown=null;}else{$("plusbutton").src=($("plusbutton").src!="images/zoomplus.gif"?"images/zoomplus.gif":"images/zoomplus_p.gif");$("plusbutton").onmousedown=function(e){zoomup();}
$("plusbutton").cursor="hand";}
if(hideMinButton){$("minbutton").src=($("minbutton").src!="images/zoommin_p.gif"?"images/zoommin_p.gif":"images/zoommin_p.gif");$("minbutton").onmousedown=null;}else{$("minbutton").src=($("minbutton").src!="images/zoommin.gif"?"images/zoommin.gif":"images/zoommin_p.gif");$("minbutton").onmousedown=function(e){zoomdown();}
$("minbutton").cursor="hand";}
if(hideGoWest){$("goWest").src=($("goWest").src!="images/gowest_p.gif"?"images/gowest_p.gif":"images/gowest_p.gif");$("goWest").onmousedown=null;}else{$("goWest").src=($("goWest").src!="images/gowest.gif"?"images/gowest.gif":"images/gowest_p.gif");$("goWest").onmousedown=function(e){panDirection('west');}
$("goWest").cursor="hand";}
if(hideGoEast){$("goEast").src=($("goEast").src!="images/goeast_p.gif"?"images/goeast_p.gif":"images/goeast_p.gif");$("goEast").onmousedown=null;}else{$("goEast").src=($("goEast").src!="images/goeast_p.gif"?"images/goeast.gif":"images/goeast_p.gif");$("goEast").onmousedown=function(e){panDirection('east');}
$("goEast").cursor="hand";}
if(hideGoNorth){$("goNorth").src=($("goNorth").src!="images/gonorth_p.gif"?"images/gonorth_p.gif":"images/gonorth_p.gif");$("goNorth").onmousedown=null;}else{$("goNorth").src=($("goNorth").src!="images/gonorth.gif"?"images/gonorth.gif":"images/gonorth_p.gif");$("goNorth").onmousedown=function(e){panDirection('north');}
$("goNorth").cursor="hand";}
if(hideGoSouth){$("goSouth").src=($("goSouth").src!="images/gosouth_p.gif"?"images/gosouth_p.gif":"images/gosouth_p.gif");$("goSouth").onmousedown=null;}else{$("goSouth").src=($("goSouth").src!="images/gosouth.gif"?"images/gosouth.gif":"images/gosouth_p.gif");$("goSouth").onmousedown=function(e){panDirection('south');}
$("goSouth").cursor="hand";}
return;}
