//*****************************************************************************
//
// USGS Elevation Web Service Query Tool 
// Created By:  Chris Rusanowski
// Installation:
//   -Copy USGS_Elevation_Service.js into the javascript directory of the HTML Viewer
//   -Include the javascript/USGS_Elevation_Service.js in MapFrame.htm 
//      <script type="text/javascript" language="JavaScript" src="javascript/USGS_Elevation_Service.js"></script>
//   -Add a button to the toolbar.htm that calls parent.MapFrame.setElevationTool().
//     (Actually add a button to USGS_Toolbar.js... The code below is and example from that JS file.)
//      if (parent.MapFrame.useElevationService)  { miscCount++; }
//        if (parent.MapFrame.useElevationService) {
//          if (parent.MapFrame.modeName == "Elevation") {
//            LocalString += WriteButton( MakeButton2( "usgs_images/elevation1.gif", 'Elevation Query Tool', "elevation", "parent.MapFrame.modeName=\'Elevation\'; parent.MapFrame.setElevationTool();", 'status=\'Elevation Query Tool\'', "", true ) );
//          } else {
//            LocalString += WriteButton( MakeButton2( "usgs_images/elevation2.gif", 'Elevation Query Tool', "elevation", "parent.MapFrame.modeName=\'Elevation\'; parent.MapFrame.setElevationTool();", 'status=\'Elevation Query Tool\'', "", true ) );
//          }
//          buttonCol++;
//          LocalString += Table_Structure(buttonCol,miscCount);
//        }
//   -Add code below to aimsCustom.js so the map tool functions...
//      if (toolMode == 1081) { 
//        getElevation(e);
//        return false; 
//      }
//   -Copy the getElevation.htm file into the main HTML viewer directory 
//     (IE: same directory mapframe.htm is in...)
//   -Copy the elevation1.gif and elevation2.gif into the usgs_images folder.
//*****************************************************************************
// useElevationService determines if the toolbar should show this button or not.
var useTrends = true;

//*****************************************************************************
// Function showElev
// This function sets the current tool to the Elevation Query Tool
// Sets the toolMode to 1081
//*****************************************************************************
function setTDDSTool() {
  var isOk;
  var j;    
	if (hasLayer("measureBox")) {
		hideLayer("measureBox");
  }
 
  hideLayer("xBoxTop");
  hideLayer("xBoxLeft");
  hideLayer("xBoxRight");
  hideLayer("xBoxBottom");
  panning=false;
  zooming=false;
  selectBox=false;
  shapeSelectBuffer = false;
  toolMode = 1666;

  if (canQuery) {
  	if (isIE)	{
  		document.all.theTop.style.cursor = "crosshair";
  		theCursor = document.all.theTop.style.cursor;
  	}
  	modeBlurb = "Tiled Selection Tool";
  } else {
  	alert(msgList[46]);
  }
  showGeocode=false;
  drawSelectBoundary=false;
  if (useTextFrame) parent.TextFrame.document.location= appDir + "selection.htm";
  hideLayer("measureBox");
  
}

//*****************************************************************************
// Function getElevation
// This function pops a new window (or the text frame) with the Elevation Service
// query using the GET methodology and passing a return url that points to 
// getElevation.htm.  This is what gets called from the aimsCustom.js
//*****************************************************************************
function getFTP(e) {
  //var theX = mouseX;
  //var theY = mouseY;
  //getMapXY(theX,theY);
	//alert(toolMode);
	
	//alert(mapY);
	//alert(mapX);
	
	if (toolMode=1666){
	//alert('toolmode');
	
	chkMouseUp(e);
	}
}	

