var METERS_IN_MILES = 1609.344; var METERS_IN_KM = 1000; var FEET_IN_METERS = 3.2808399; function domousemove(X, Y, MapID, CenterLat, CenterLon) { var Easting, Northing; var LatLon = new Array(2); var Lat, Lon; var Distance; var coordinateOutput; if (document["getElementById"](MapID)) { document["getElementById"](MapID)["style"]["cursor"] = cursorsymbol; }; Easting = X * pixres + mine; Northing = maxn - Y * pixres; UTMXYToLatLon(Easting, Northing, UTMzone, 0, LatLon); Lat = Math["abs"](RadToDeg(LatLon[0])); Lon = Math["abs"](RadToDeg(LatLon[1])); Distance = CalculateDistanceInMeters(CenterLat, CenterLon, Lat, Lon); if (isNaN(Distance)) { Distance = 0; }; document["getElementById"]("distance")["innerHTML"] = "Distance to center marker: " + FormatNumber((Distance / METERS_IN_MILES), 4, true, false, true) + " miles (" + FormatNumber((Distance / METERS_IN_KM), 4, true, false, true) + " km)"; switch (document["getElementById"]("coordinate-format-menu")["value"]) { case "dd": coordinateOutput = FormatNumber(Lat, 4, true, false, false) + "\x26deg;N " + FormatNumber(Math["abs"](Lon), 4, true, false, false) + "\x26deg;W "; break; ; case "ddm": coordinateOutput = DDtoDDM(Lat) + " N " + DDtoDDM(Lon) + " W"; break; ; case "dms": coordinateOutput = DDtoDMS(Lat) + " N " + DDtoDMS(Lon) + " W"; break; ; case "utm": coordinateOutput = "UTM Zone " + UTMzone + " " + Math["round"](Easting) + "E " + Math["round"](Northing) + "N "; break; ; default: coordinateOutput = FormatNumber(centerLat, 4, true, false, false) + "\x26deg;N " + FormatNumber(Math["abs"](centerLon), 4, true, false, false) + "\x26deg;W "; ; }; document["getElementById"]("msg_anchor")["innerHTML"] = coordinateOutput; }; function domapclick(x, y, baseUri) { var latlon = new Array(2); ScreenXYToLatLon(x, y, latlon); if (baseUri["indexOf"]("?") > 0) { baseUri = baseUri + "\x26"; } else { baseUri = baseUri + "?"; }; top["window"]["location"] = baseUri + "lat=" + RadToDeg(latlon[0]) + "\x26lon=" + RadToDeg(latlon[1]) + "\x26s=" + mapscale + "\x26size=" + mapsize + "\x26style=" + mapstyle; }; function ScreenXYToLatLon(X, Y, latlon) { var n, e; n = maxn - (Y * pixres); e = (X * pixres) + mine; UTMXYToLatLon(e, n, UTMzone, false, latlon); }; function CenterMarkerVisibility(targetswitch) { var drawobj = new jsGraphics("target_anchor"); var anchorobj; switch (targetswitch) { case "on": drawobj["setColor"]("red"); drawobj["setStroke"](3); drawobj["drawPolyline"](new Array(mapw / 2 - 1, mapw / 2 - 1), new Array(maph / 2 - 4 - 1, maph / 2 + 4 - 1)); drawobj["drawPolyline"](new Array(mapw / 2 - 4 - 1, mapw / 2 + 4 - 1), new Array(maph / 2 - 1, maph / 2 - 1)); drawobj["paint"](); break; ; case "off": anchorobj = document["createElement"]("DIV"); anchorobj["id"] = "target_anchor"; document["getElementById"]("target_anchor")["innerHTML"] = ""; break; ; default: anchorobj = document["createElement"]("DIV"); anchorobj["id"] = "target_anchor"; document["getElementById"]("target_anchor")["innerHTML"] = ""; ; }; }; function browserID(ie, net) { this["ie"] = ie; this["net"] = net; }; function InitializeTopo() { switch (window["navigator"]["appName"]) { case "Microsoft Internet Explorer": is["ie"] = true; break; ; case "Netscape": is["net"] = true; Event["prototype"].__defineGetter__("offsetX", function() { return (this["layerX"] - this["target"]["offsetLeft"]); }); Event["prototype"].__defineGetter__("offsetY", function() { return (this["layerY"] - this["target"]["offsetTop"]); }); break; ; default: Event["prototype"].__defineGetter__("offsetX", function() { return (this["layerX"] - this["target"]["offsetLeft"]); }); Event["prototype"].__defineGetter__("offsetY", function() { return (this["layerY"] - this["target"]["offsetTop"]); }); break; ; }; }; function GetCoordinateString(centerLat, centerLon, format) { switch (format["toLowerCase"]()) { case "dd": return FormatNumber(centerLat, 4, true, false, false) + "\x26deg;N " + FormatNumber(Math["abs"](centerLon), 4, true, false, false) + "\x26deg;W "; break; ; case "ddm": return DDtoDDM(centerLat) + " N " + DDtoDDM(centerLon) + " W"; break; ; case "dms": return DDtoDMS(centerLat) + " N " + DDtoDMS(centerLon) + " W"; break; ; case "utm": var utmZone; var xy = []; utmZone = parseInt((parseFloat(centerLon) + 180.0) / 6) + 1; LatLonToUTMXY(DegToRad(centerLat), DegToRad(centerLon), utmZone, xy); return "UTM Zone " + utmZone + " " + Math["round"](xy[0]) + "E " + Math["round"](xy[1]) + "N"; break; ; default: return "Unknown coordinate format."; ; }; };