//
//Map Navigation Functions:
//

function ActivateFullExtent() {
    window.location = "viewer2.asp?tools=FULLEXTENT";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
	// Dull all toolbar images.
		document.getElementById('zoomIn').firstChild.style.color = "";
		document.getElementById('zoomOut').firstChild.style.color = "";
		document.getElementById('recenter').firstChild.style.color = "";
		document.getElementById('identify').firstChild.style.color = "";
	  }  

function ActivateZoomIn() {
    setToolImage("ZOOMIN"); 
    document.frmNavigation.tools.value = 'ZOOMIN';
    document.frmNavigation.target="";
    document.frmNavigation.action = "viewer2.asp";
    mode="ZOOMIN"
  }
  
  function ActivateZoomOut() {
  //Used by SingleClick Client except Basic Viewer
  //imgPrefix is optional... used by Chameleon Interface
	//if (imgPrefix == null) {
		//imgPrefix = "";
		//}	
    setToolImage("ZOOMOUT"); 
    document.frmNavigation.tools.value = 'ZOOMOUT';
    document.frmNavigation.target="";
    document.frmNavigation.action = "viewer2.asp";
    //document.onmousedown = null;
    mode="ZOOMOUT"
  }
  
  function ActivateScaleChange() {
  	scale = document.frmNavigation.theScaleValue.value;
    window.location = "viewer2.asp?tools=ScaleChange&theScaleValue=" + scale + "";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }

  function ActivatePan() {
  //Used by SingleClick Client except Basic Viewer
  //imgPrefix is optional... used by Chameleon Interface
	//if (imgPrefix == null) {
		//imgPrefix = "";
		//}	
    setToolImage("PAN"); 
    document.frmNavigation.tools.value = 'PAN';
    document.frmNavigation.target="";
    document.frmNavigation.action = "viewer2.asp";
    //document.onmousedown = null;
    mode="PAN"
  }
  function ToggleLabels() {
      //LabelsOn = document.frmNavigation.LabelsOn.value;
      document.frmNavigation.target="_self";
      //window.location = "viewer2.asp?mode=Labels&LabelsOn=" + LabelsOn + "";
      window.location = "viewer2.asp?tools=Labels";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
    }
  function TurnOnPAMAP() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=PAMAP";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnNAIP() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=NAIP";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnDOQQs() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=DOQQs";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnDRG() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=DRG";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnLidarDEM() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=LidarDEM";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnUSGS() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=USGS";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnIvan() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=Ivan";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
    }
  function TurnOnDVRPC() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=DVRPC";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnImageryOff() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=OFF";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }

  function TurnOnIndex1() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=Index1";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnIndex2() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=Index2";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnIndexDVRPC() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=IndexDVRPC";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnIndex3() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=Index3";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOnIndex4() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=Index4";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }
  function TurnOffIndexes() {
      document.frmNavigation.target="_self";
      window.location = "viewer2.asp?tools=IndexOff";
      document.getElementById("refreshImageDiv").style.visibility = "visible";
  }

function setToolImage(tool) {
	// Dull all images first.
		document.getElementById('zoomIn').style.listStyleImage = "url(images/bulletGray.gif)";
		//the following line is for FireFox...
		document.getElementById('downloadOptionZoomIn').style.listStyleImage = "url(images/bulletGray.gif)";
		document.getElementById('zoomOut').style.listStyleImage = "url(images/bulletGray.gif)";
		//the following line is for FireFox...
		document.getElementById('downloadOptionZoomOut').style.listStyleImage = "url(images/bulletGray.gif)";
		document.getElementById('recenter').style.listStyleImage = "url(images/bulletGray.gif)";
		//the following line is for FireFox...
		document.getElementById('downloadOptionRecenter').style.listStyleImage = "url(images/bulletGray.gif)";
		document.getElementById('identify').style.listStyleImage = "url(images/bulletGray.gif)";
		//the following line is for FireFox...
		document.getElementById('downloadOptionId').style.listStyleImage = "url(images/bulletGray.gif)";

	//Then brighten the passed tool.
	if (tool == "ZOOMIN") {
		document.getElementById('zoomIn').style.listStyleImage = "url(images/CheckMark.gif)";
		//the following line is for FireFox...
		document.getElementById('downloadOptionZoomIn').style.listStyleImage = "url(images/CheckMark.gif)";
		}
	if (tool == "ZOOMOUT") {
		document.getElementById('zoomOut').style.listStyleImage = "url(images/CheckMark.gif)";
		//the following line is for FireFox...
		document.getElementById('downloadOptionZoomOut').style.listStyleImage = "url(images/CheckMark.gif)";
		}
	if (tool == "PAN") {
		document.getElementById('recenter').style.listStyleImage = "url(images/CheckMark.gif)";
		//the following line is for FireFox...
		document.getElementById('downloadOptionRecenter').style.listStyleImage = "url(images/CheckMark.gif)";
		}
	if (tool == "Identify") {
		document.getElementById('identify').style.listStyleImage = "url(images/CheckMark.gif)";
		//the following line is for FireFox...
		document.getElementById('downloadOptionId').style.listStyleImage = "url(images/CheckMark.gif)";
		}

	//document.getElementById('zoomIn').firstChild.setAttribute("class", "navListReturn");

}

function ZoomOhio() {
	place = document.frmNavigation.OhioSelect.value;
	window.location = "viewer2.asp?tools=ZoomPlace&place=" + place + "";
}

function ZoomMon() {
	place = document.frmNavigation.MonSelect.value;
	window.location = "viewer2.asp?tools=ZoomPlace&place=" + place + "";
}

function ZoomAlleg() {
	place = document.frmNavigation.AllegSelect.value;
	window.location = "viewer2.asp?tools=ZoomPlace&place=" + place + "";
}

function ZoomWB() {
	place = document.frmNavigation.WBSelect.value;
	window.location = "viewer2.asp?tools=ZoomPlace&place=" + place + "";
}

function ZoomJun() {
	place1 = document.frmNavigation.JunSelect.value;
	window.location = "viewer2.asp?tools=ZoomPlace1&place1=" + place1 + "";
}

function ZoomUpper() {
	place1 = document.frmNavigation.UpperSelect.value;
	window.location = "viewer2.asp?tools=ZoomPlace1&place1=" + place1 + "";
}
function ZoomLower() {
	place1 = document.frmNavigation.LowerSelect.value;
	window.location = "viewer2.asp?tools=ZoomPlace1&place1=" + place1 + "";
}
function ZoomCounty() {
	county = document.frmNavigation.CountySelect.value;
	window.location = "viewer2.asp?tools=ZoomCounty&county=" + county + "";
        document.getElementById("refreshImageDiv").style.visibility = "visible";
}
function ZoomPlace1() {
	place1 = document.frmNavigation.Place1Select.value;
	window.location = "viewer2.asp?tools=ZoomPlace1&place1=" + place1 + "";
}
function ZoomDelaware() {
	place1 = document.frmNavigation.DelawareSelect.value;
	window.location = "viewer2.asp?tools=ZoomPlace1&place1=" + place1 + "";
}

function ActivateIdentify() {
    setToolImage("Identify"); 
    document.frmNavigation.tools.value = 'Identify';
    document.frmNavigation.action="Download.asp";
    document.frmNavigation.target="downloadWindow";
    mode="Identify"
  }

function ActivatePhotos() {
    setToolImage("Photos"); 
    document.frmNavigation.tools.value = 'Photos';
    document.frmNavigation.action="Photos.asp";
    document.frmNavigation.target="photoWindow";
    mode="Photos"
  }

function ActivateGeocode() {
    street = document.frmNavigation.street.value;
    zipcode = document.frmNavigation.zipcode.value;
    
    if (street != "" && zipcode != "" && street != "Address" && zipcode != "Zip Code") {
    	document.frmNavigation.target="_self";
    	window.location = "viewer2.asp?tools=Geocode&street=" + street + "&zipcode=" + zipcode + "";
        document.getElementById("refreshImageDiv").style.visibility = "visible";
	}
    else {
    	alert ("Please enter both a street address and a zip code.");
    	return;
  	}
  }

function ActivateQuadFind() {
    quadName = document.frmNavigation.quadname.value;
    
    if (quadName != "") {
    	document.frmNavigation.target="_self";
    	window.location = "viewer2.asp?tools=QuadFind&QuadName=" + quadName + "";
        document.getElementById("refreshImageDiv").style.visibility = "visible";
	}
    else {
    	alert ("Please enter a quadrangle name.");
    	return;
  	}
  }







function toggleFindOption(id) {

	if (document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display = "inline";
		//document.getElementById(id + "List").style.listStyleImage = "url(images/expandMinus.gif)";
		document.getElementById(id + "Bullet").src="images/expandMinus.gif";
	}
	else {
		document.getElementById(id).style.display = "none";
		//document.getElementById(id + "List").style.listStyleImage = "url(images/expandPlus.gif)";
		document.getElementById(id + "Bullet").src="images/expandPlus.gif";
	}

	//Turn off other finders...
	if (id == "findCounty") {
		document.getElementById('findQuad').style.display = "none";
		document.getElementById('findAddress').style.display = "none";
		document.getElementById("findQuadBullet").src = "images/expandPlus.gif";
		document.getElementById("findAddressBullet").src = "images/expandPlus.gif";
	}
	if (id == "findAddress") {
		document.getElementById('findQuad').style.display = "none";
		document.getElementById('findCounty').style.display = "none";
		document.getElementById("findQuadBullet").src = "images/expandPlus.gif";
		document.getElementById("findCountyBullet").src = "images/expandPlus.gif";
	}
	if (id == "findQuad") {
		document.getElementById('findCounty').style.display = "none";
		document.getElementById('findAddress').style.display = "none";
		document.getElementById("findCountyBullet").src = "images/expandPlus.gif";
		document.getElementById("findAddressBullet").src = "images/expandPlus.gif";
	}
}