<!--
var backcol   = "#dddddd";
var border1   = "solid 1px #dddddd";
var border2   = "solid 1px #272571";

function PopOut(sURL,sTitle,iHeight,iWidth) {
	var objWin;
	objWin = window.open(sURL, sTitle, "name='popwin',height="+iHeight+",width="+iWidth+",scrollbars,statusbar,resizable");
}

function setToolImage(tool) {
	document.getElementById("ZoomInCell").style.backgroundColor = backcol;
	document.getElementById("ZoomInCell").style.border = border1;
	document.getElementById("ZoomOutCell").style.backgroundColor = backcol;
	document.getElementById("ZoomOutCell").style.border = border1;
	document.getElementById("FullExtentCell").style.backgroundColor = backcol;
	document.getElementById("FullExtentCell").style.border = border1;
	document.getElementById("PanCell").style.backgroundColor = backcol;
	document.getElementById("PanCell").style.border = border1;
	document.getElementById("SelectCell").style.backgroundColor = backcol;
	document.getElementById("SelectCell").style.border = border1;
	document.getElementById("ClearCell").style.backgroundColor = backcol;
	document.getElementById("ClearCell").style.border = border1;
	document.getElementById(tool+"Cell").style.backgroundColor = "#FFFFFF";
	document.getElementById(tool+"Cell").style.border = border2;
	document.getElementById("toolcell").innerHTML = "Active Tool: " + tool + "";
}

function SaveToolState(navtool) {
	if (navtool == "ZoomIn") {
		document.getElementById('theTop').style.cursor = "crosshair";
		document.getElementById('theMap').style.cursor = "crosshair";
	} else {
		document.getElementById('theTop').style.cursor = "hand";
		document.getElementById('theTop').style.cursor = "hand";
	}
	document.mapcontrol.theTool.value = navtool;
}

function ActivateTool(maptool) {
	setToolImage(maptool)
	document.mapcontrol.theaction.value = maptool;
	document.mapcontrol.target = '';
	document.mapcontrol.action = 'default.asp';
	setState(maptool)
}

function ControlForm(val,num,type) {
	document.mapcontrol.theaction.value = '';
	document.mapcontrol.target = '';
	document.mapcontrol.action = 'default.asp';

	if (num == 1) {
		document.mapcontrol.layeraction.value = val;  //set layers visible
		document.mapcontrol.thequeryaction.value = 'Refresh';
		showLoad();
	}
	if (num == 2) {
		document.mapcontrol.thetab.value = val;  //tab settings
		var tabName = val;
	}
	if (num == 3) {
		document.mapcontrol.theLayer.value = val;  //set active layer
		document.mapcontrol.IdentLayer.value = val;
	}
	if (num == 4) {
		document.mapcontrol.thepanaction.value = val;  //pan with arrows
		showLoad();
	}
	if (num == 5) {
		document.mapcontrol.thequeryaction.value = val;  //query actions
		showLoad();
	}
	if (num == 6) {
		document.mapcontrol.mReport.value = '';
		document.mapcontrol.thequeryaction.value = val;  //Clears The Map
		document.mapcontrol.thetab.value = 'Find';
		showLoad();
	}
	if (num == 7) {
		document.mapcontrol.thetab.value = val;  //Legend Forward/Back
		var tabName = val;
		document.mapcontrol.legtype.value = type;
	}
	if (num == 8) {
		var theme = document.mapcontrol.censusval.value; //Add Census Themes
		document.mapcontrol.action = 'default.asp?addTheme=' + theme + '';
		document.mapcontrol.thequeryaction.value = val;
	}
	if (num == 9) {
		document.mapcontrol.crimeGroup.value = val;  //set crime group visible
		document.mapcontrol.layerGroup.value = 'crime';
	}

	document.mapcontrol.submit();
}

function nextRecords(pagenum,searchtype) {
	document.mapcontrol.theaction.value = "";
	document.mapcontrol.mReport.value = searchtype;
	document.mapcontrol.action = 'default.asp?doSelect=1&page=' + pagenum + '';
	document.mapcontrol.submit();
}

//Disables Carriage Return Submitting Forms
	function noenter() {
		return !(window.event && window.event.keyCode == 13);
	}

	function revertZoomLevel() {
			document.getElementById("zoom1").src="images/zoom_normal_1.gif";
			document.getElementById("zoom2").src="images/zoom_normal_2.gif";
			document.getElementById("zoom3").src="images/zoom_normal_3.gif";
			document.getElementById("zoom4").src="images/zoom_normal_4.gif";
			document.getElementById("zoom5").src="images/zoom_normal_5.gif";
			document.getElementById("zoom6").src="images/zoom_normal_6.gif";
			document.getElementById("zoom7").src="images/zoom_normal_7.gif";
			document.getElementById("zoom8").src="images/zoom_normal_8.gif";
			document.getElementById("zoom9").src="images/zoom_normal_9.gif";
			document.getElementById("zoom10").src="images/zoom_normal_10.gif";
		}
				
		function setZoomLevel(level) {
			revertZoomLevel();
			var zoomLevel = 'zoom' + level + '';
			document.getElementById(zoomLevel).src='images/zoom_selection_' + level + '.gif';
		}

		function zoomToScale(level) {
			document.mapcontrol.theaction.value = '';
			document.mapcontrol.thequeryaction.value = "ZoomToScale";
			document.mapcontrol.action = 'default.asp?zoomlevel=' + level + '';
			document.mapcontrol.submit();		
		}

function setCrime(val) {
	document.mapcontrol.crimeGroup.value = val;
	ControlForm('crimelayers',1);

	if (val == 'None') {
		document.mapcontrol.mReport.value = '';
		document.mapcontrol.thequeryaction.value = 'clearit';
	} else {
		if (document.mapcontrol.mReport.value == 'CrimeRadius') {
			crimeSearch('CrimeRadius');
		}
		if (document.mapcontrol.mReport.value == 'CrimeSelect') {
			if (document.mapcontrol.crimeGroup.value != 'None') {
				document.mapcontrol.action = 'default.asp?doSelect=1';
			}
		}
	}
	document.mapcontrol.submit();
}

function crimeSearch(sType) {
	
	if (document.mapcontrol.crimeGroup.value == 'None') {
		ControlForm('clearit',6);
	} else {

	if (document.mapcontrol.thetab.value == 'Find') {
		for (var i=0; i < document.mapcontrol.crimeradius.length; i++) {
			if (document.mapcontrol.crimeradius[i].checked) {
			var bufferdist = document.mapcontrol.crimeradius[i].value;
			}
		}
	} else {
		if (document.mapcontrol.mBuffer.value > 0) {
			var bufferdist = document.mapcontrol.mBuffer.value;
		} else {
			var bufferdist = 0.25;
		}
	}

		document.mapcontrol.target = "_self";
		document.mapcontrol.theaction.value = "";
		document.mapcontrol.mReport.value = sType;

		if (bufferdist > 0) {
			document.mapcontrol.action = 'default.asp?bufferdist=' + bufferdist +'';
			document.mapcontrol.mBuffer.value = bufferdist;
		} else {
			document.mapcontrol.action = 'default.asp?bufferdist=' + document.mapcontrol.mBuffer.value +'';
		}

	document.mapcontrol.submit();
	}
}

function zoomToCoords(x,y,searchtype) {
	document.mapcontrol.mReport.value = searchtype;
	document.mapcontrol.thequeryaction.value = "zoomtocoords";
	document.mapcontrol.action = 'default.asp?zoomX=' + x + '&zoomY=' + y + '';
	document.mapcontrol.submit();
}

function changeMapSize(size) {
	document.mapcontrol.target = "_self";
	document.mapcontrol.theaction.value = "";
	document.mapcontrol.mSize.value = size;
	document.mapcontrol.action = 'default.asp?change=1';
	document.mapcontrol.submit();
}

function showMetaData(thelay) {
	document.mapcontrol.thetab.value = "Info";
	document.mapcontrol.target = "_self";
	document.mapcontrol.theaction.value = "";
	document.mapcontrol.action = 'default.asp?query=metadata&layername=' + thelay + '';
	document.mapcontrol.submit();
}

function mapQuery(type) {
	document.mapcontrol.thequeryaction.value = "clearit";
	document.mapcontrol.thetab.value = "Info";
	document.mapcontrol.target = "_self";
	document.mapcontrol.theaction.value = "";
	if (type == 'address') {
		var addString = escape(document.mapcontrol.addressval.value);
		document.mapcontrol.action = 'default.asp?query=findaddress&addressval=' + addString + '';
	}
	if (type == 'xaddress') {
		var addString1 = escape(document.mapcontrol.xaddress1.value);
		var addString2 = escape(document.mapcontrol.xaddress2.value);
		document.mapcontrol.action = 'default.asp?query=findaddress&xaddress1=' + addString1 + '&xaddress2=' + addString2 + '';
	}
	document.mapcontrol.submit();
}

function LndMrkQuery() {
	var lmValue = document.lndmrkform.lmval.value;
	document.mapcontrol.target = "_self";
	document.mapcontrol.theaction.value = "";
	document.mapcontrol.thequeryaction.value = "zoomtolandmark";
	document.mapcontrol.action = 'default.asp?lmval=' + lmValue +  '';
	document.mapcontrol.submit();
}

function mapAddress(xGeo,yGeo,addText,flag) {
		document.mapcontrol.thequeryaction.value = 'zoomtogeocode'
		document.mapcontrol.theaction.value = '';
		document.mapcontrol.target = '';

		if (document.mapcontrol.crimeGroup.value != 'None') {
			document.mapcontrol.mReport.value = 'CrimeRadius';
			document.mapcontrol.action = 'default.asp?bufferdist=0.25' + '&pntx=' + xGeo + '&pnty=' + yGeo + '&addText=' + escape(addText) + '&render=' + flag + '';
		} else {
			document.mapcontrol.action = 'default.asp?pntx=' + xGeo + '&pnty=' + yGeo + '&addText=' + escape(addText) + '&render=' + flag + '';
		}

		document.mapcontrol.submit();
	}

function getReport(bufferX,bufferY,thepid) {
	document.mapcontrol.thetab.value = "Report";
	document.mapcontrol.target = "_self";
	document.mapcontrol.theaction.value = "";
	document.mapcontrol.action = 'default.asp?query=genReport&pntx=' + bufferX + '&pnty=' + bufferY + '&miles=1&pid=' + thepid +'';
	document.mapcontrol.submit();
}

function bufferPoint(bufferX,bufferY,thepid) {
	var miles = document.mapcontrol.searchdist.value;
	document.mapcontrol.thetab.value = "Report";
	document.mapcontrol.target = "_self";
	document.mapcontrol.theaction.value = "";
	document.mapcontrol.action = 'default.asp?query=genReport&pntx=' + bufferX + '&pnty=' + bufferY + '&miles=' + miles + '&pid=' + thepid +'';
	document.mapcontrol.submit();
}

function changeLayers(group) {
	document.mapcontrol.theaction.value = '';
	document.mapcontrol.target = '_self';
	document.mapcontrol.action = 'default.asp';
	document.mapcontrol.thetab.value = 'Layers';
	document.mapcontrol.layerGroup.value = group;
	document.mapcontrol.submit();
}

function CheckTool() {
	if (document.mapcontrol.theaction.value == 'Select') {
		//document.mapcontrol.thetab.value = "Info";
		document.mapcontrol.target = "_self";
		//document.mapcontrol.action = 'default.asp?query=Select';
	}
}

function DL_GetElementLeft(eElement)
{
   if (!eElement && this)
   {
      eElement = this;
   }
   var DL_bIE = document.all ? true : false;
   var nLeftPos = eElement.offsetLeft;
   var eParElement = eElement.offsetParent; 

   while (eParElement != null)
   {
      if(DL_bIE)
      {
         if(eParElement.tagName == "TD")
         {
            nLeftPos += eParElement.clientLeft;
         }
      }
      else
      {
         if(eParElement.tagName == "TABLE")
         {
            var nParBorder = parseInt(eParElement.border);
            if(nParBorder > 0)
            {
               nLeftPos += nParBorder;
            }
         }
      }
      nLeftPos += eParElement.offsetLeft;
      eParElement = eParElement.offsetParent;
   }
   return nLeftPos;
}

function DL_GetElementTop(eElement)
{
   if (!eElement && this)
   {
      eElement = this;
   }

   var DL_bIE = document.all ? true : false;
   var nTopPos = eElement.offsetTop;
   var eParElement = eElement.offsetParent;

   while (eParElement != null)
   {
      if(DL_bIE)
      {
         if(eParElement.tagName == "TD")
         {
            nTopPos += eParElement.clientTop;
         }
      }
      else
      {
         if(eParElement.tagName == "TABLE")
         {
            var nParBorder = parseInt(eParElement.border);
            if(nParBorder > 0)
            {
               nTopPos += nParBorder;
            }
         }
      }
      nTopPos += eParElement.offsetTop;
      eParElement = eParElement.offsetParent;
   }
   return nTopPos;
}

function showLoad() {
	var loadDiv = document.getElementById('loadMapDiv');
	loadDiv.style.visibility = "visible";
}

function resetMap() {
	var reloadTimer=0;
	window.clearTimeout(reloadTimer);
	reloadTimer = window.setTimeout("document.mapcontrol.thequeryaction.value = ''; document.mapcontrol.theaction.value = ''; document.mapcontrol.submit();",500);
}
// -->