function setControlDCSS(_1,_2,_3){
_1.style.padding="5px";
var _4=document.createElement("DIV");
_4.style.backgroundColor="white";
_4.style.borderStyle="solid";
_4.style.borderWidth="2px";
_4.style.cursor="pointer";
_4.style.textAlign="center";
_4.title=_2;
_1.appendChild(_4);
var _5=document.createElement("DIV");
_5.style.fontFamily="Arial,sans-serif";
_5.style.fontSize="12px";
_5.style.paddingLeft="4px";
_5.style.paddingRight="4px";
_5.appendChild(document.createTextNode(_3));
_4.appendChild(_5);
};
function createWayPointsInProgressControl(_6){
var _7=document.createElement("div");
var _8=document.createElement("div");
setControlDCSS(_8,"End the current course by drawing a line back to the first point","End at first point");
_7.appendChild(_8);
google.maps.event.addDomListener(_8,"click",function(){
endCourseAtFirst(_6);
});
_translationManager.addElementToList(_8);
var _9=document.createElement("div");
setControlDCSS(_9,"End the current course at the last point","End at last point");
_7.appendChild(_9);
google.maps.event.addDomListener(_9,"click",function(){
endCourseAtLast(_6);
});
_translationManager.addElementToList(_9);
var _a=document.createElement("div");
setControlDCSS(_a,"Remove the last point","Remove last point");
_7.appendChild(_a);
google.maps.event.addDomListener(_a,"click",function(){
removeLastCoursePoint(_6);
});
_translationManager.addElementToList(_a);
_7.index=1;
return _7;
};
function createStartControl(_b){
var _c=document.createElement("div");
var _d=document.createElement("div");
setControlDCSS(_d,"Clear all courses, circles, and markers","Clear All");
_c.appendChild(_d);
google.maps.event.addDomListener(_d,"click",function(){
clearAll(_b);
});
_translationManager.addElementToList(_d);
var _e=document.createElement("div");
setControlDCSS(_e,"Start a new course","Start a Course");
_c.appendChild(_e);
google.maps.event.addDomListener(_e,"click",function(){
startCourse(_b);
});
_translationManager.addElementToList(_e);
var _f=document.createElement("div");
setControlDCSS(_f,"Start a new circle","Start a Circle");
_c.appendChild(_f);
google.maps.event.addDomListener(_f,"click",function(){
enterCircleMode(_b);
});
_translationManager.addElementToList(_f);
_c.index=1;
return _c;
};
function createCircleInProgressControl(map){
var _10=document.createElement("div");
var _11=document.createElement("div");
setControlDCSS(_11,"Erase last","Erase last circle");
_10.appendChild(_11);
google.maps.event.addDomListener(_11,"click",function(){
eraseLastCircle(map);
});
_translationManager.addElementToList(_11);
var _12=document.createElement("div");
setControlDCSS(_12,"Leave circle mode","Leave circle mode");
_10.appendChild(_12);
google.maps.event.addDomListener(_12,"click",function(){
leaveCircleMode(map);
});
_translationManager.addElementToList(_12);
_10.index=1;
return _10;
};

var piOver4=Math.PI/4;
var twoPi=Math.PI*2;
var piOver2=Math.PI/2;
var degreesPerRadian=180/Math.PI;
var kilometersPerNM=1.852;
var milesPerNM=1.150779448;
var vectorColor="#ff0000";
var vectorWeight=3;
var vectorOpacity=0.8;
var NAUTICAL_MILES_UNITS=0;
var MILES_UNITS=1;
var KILOMETERS_UNITS=2;
function getDistanceMultiplier(_1){
var _2=1;
if(_1==MILES_UNITS){
_2=milesPerNM;
}else{
if(_1==KILOMETERS_UNITS){
_2=kilometersPerNM;
}
}
return _2;
};
function radiansToDegrees(_3){
return _3*degreesPerRadian;
};
function degreesToRadians(_4){
return _4/degreesPerRadian;
};
function reduceLat(_5){
var _6=_5-Math.PI*Math.floor((_5+piOver2)/Math.PI);
return _6;
};
function reduceLng(_7){
var _8=_7-twoPi*Math.floor((_7+Math.PI)/twoPi);
return _8;
};
function reduceAzimuth(_9){
var _a=_9-twoPi*Math.floor(_9/twoPi);
return _a;
};
function EarthVector(_b,_c){
this.distanceNM=_b;
this.azimuth=reduceAzimuth(_c);
this.azimuthDegrees=radiansToDegrees(_c);
};
function getVector(){
return this.vector;
};
function computeRhumbLineVector(){
this.deltaLng=degreesToRadians(this.endPoint.lng()-this.startPoint.lng());
var gb=Math.tan(piOver4+degreesToRadians(this.endPoint.lat()/2));
var ga=Math.tan(piOver4+degreesToRadians(this.startPoint.lat()/2));
var X=Math.log(gb)-Math.log(ga);
var _d=Math.atan2(this.deltaLng,X);
var _e=0;
var _f=Math.cos(_d);
if(Math.abs(_f)>0.0001){
var _10=(this.endPoint.lat()-this.startPoint.lat());
_e=60*_10/_f;
}else{
var _11=Math.abs(this.endPoint.lng()-this.startPoint.lng());
_e=60*_11*Math.cos(this.startPoint.lat());
}
this.vector=new EarthVector(_e,_d);
};
function rhumbLineLine(){
var _12=new google.maps.Polyline({path:[this.startPoint,this.endPoint],strokeColor:vectorColor,strokeWeight:vectorWeight,strokeOpacity:vectorOpacity,clickable:false});
return _12;
};
function RhumbLineCourse(_13,_14){
this.startPoint=_13;
this.endPoint=_14;
this.computeRhumbLineVector=computeRhumbLineVector;
this.getLine=rhumbLineLine;
this.getVector=getVector;
this.computeRhumbLineVector();
};
function computeGreatCircleVector(){
this.deltaLng=reduceLng(degreesToRadians(this.endPoint.lng()-this.startPoint.lng()));
var _15=Math.sin(this.deltaLng);
var _16=Math.cos(this.deltaLng);
this.sinStartLat=Math.sin(degreesToRadians(this.startPoint.lat()));
this.cosStartLat=Math.cos(degreesToRadians(this.startPoint.lat()));
this.sinEndLat=Math.sin(degreesToRadians(this.endPoint.lat()));
this.cosEndLat=Math.cos(degreesToRadians(this.endPoint.lat()));
this.distanceRadians=Math.acos(this.sinStartLat*this.sinEndLat+this.cosStartLat*this.cosEndLat*_16);
this.distanceDegrees=radiansToDegrees(this.distanceRadians);
var _17=60*this.distanceDegrees;
var Y=_15*this.cosEndLat;
var X=this.cosStartLat*this.sinEndLat-this.sinStartLat*this.cosEndLat*_16;
azimuth=Math.atan2(Y,X);
this.vector=new EarthVector(_17,azimuth);
};
function getLatFromLng(_18){
var _19=_18-degreesToRadians(this.startPoint.lng());
var _1a=Math.sin(_19);
var _1b=Math.cos(_19);
var Y=this.sinStartLat*_1b*this.sinAzimuth+_1a*this.cosAzimuth;
var X=this.cosStartLat*this.sinAzimuth;
var _1c=reduceLat(Math.atan2(Y,X));
return (_1c);
};
function computeVertex(){
if(this.sinAzimuth==0){
return (new google.maps.LatLng(twoPi,this.startPoint.lng()));
}
var _1d=reduceLng(Math.atan(1/this.sinStartLat/Math.tan(this.vector.azimuth))+degreesToRadians(this.startPoint.lng()));
var _1e=this.getLatFromLng(_1d);
this.vertex=new google.maps.LatLng(radiansToDegrees(_1e),radiansToDegrees(_1d));
};
function createWayPoints(){
this.sinAzimuth=Math.sin(this.vector.azimuth);
this.cosAzimuth=Math.cos(this.vector.azimuth);
this.longitudeIncrementRadians=degreesToRadians(this.longitudeIncrement);
var _1f=Math.abs(this.deltaLng)/this.longitudeIncrementRadians;
var _20=Math.floor(_1f);
var _21=new Array();
_21.push(this.startPoint);
if(_20>1){
if(this.deltaLng<0){
this.longitudeIncrementRadians*=-1;
}
var _22;
var _23=degreesToRadians(this.startPoint.lng());
for(_22=0;_22<_20;_22++){
var _24=reduceLng(_23+this.longitudeIncrementRadians);
var _25=this.getLatFromLng(_24);
var _26=new google.maps.LatLng(radiansToDegrees(_25),radiansToDegrees(_24));
_21.push(_26);
_23=_24;
}
}
_21.push(this.endPoint);
var _27=new google.maps.Polyline({path:_21,strokeColor:vectorColor,strokeWeight:vectorWeight,strokeOpacity:vectorOpacity,clickable:false});
return (_27);
};
function GreatCircleCourse(_28,_29){
this.longitudeIncrement=3;
this.startPoint=_28;
this.endPoint=_29;
this.computeGreatCircleVector=computeGreatCircleVector;
this.getLatFromLng=getLatFromLng;
this.computeVertex=computeVertex;
this.getLine=createWayPoints;
this.getVector=getVector;
this.computeGreatCircleVector();
};
function bestCourseGetLine(){
if(this.courseLine==null){
this.courseLine=this.course.getLine();
}
return (this.courseLine);
};
function bestCourseGetVector(){
return (this.course.vector);
};
function BestCourse(_2a,_2b){
this.getLine=bestCourseGetLine;
this.getVector=bestCourseGetVector;
this.course=new GreatCircleCourse(_2a,_2b);
};
function directSolution(_2c,_2d,_2e){
var _2f=degreesToRadians(_2e/60);
var _30=Math.sin(degreesToRadians(_2c.lat()));
var _31=Math.cos(degreesToRadians(_2c.lat()));
var _32=Math.sin(_2d);
var _33=Math.cos(_2d);
var _34=Math.sin(_2f);
var _35=Math.cos(_2f);
var X=(_31*_35)-(_30*_33*_34);
var Y=_34*_32;
var _36=Math.asin((_30*_35)+(_31*_34*_33));
var _37=degreesToRadians(_2c.lng())-Math.atan2(Y,X);
return (new google.maps.LatLng(radiansToDegrees(_36),radiansToDegrees(_37)));
};

function formatFloat(_1){
var _2;
if(_1<1){
var _3=Math.round(_1*100)/100;
_2=_3.toString();
}else{
if(_1<10){
var _3=Math.round(_1*10)/10;
_2=_3.toString();
}else{
_2=Math.round(_1);
}
}
return _2;
};
function format10(_4){
var _5;
if(_4>=10){
_5=""+_4;
}else{
_5="0"+_4;
}
return _5;
};
function format100(_6){
var _7;
if(_6>=100){
_7=""+_6;
}else{
if(_6>=10){
_7="0"+_6;
}else{
_7="00"+_6;
}
}
return _7;
};
function myLatToString(_8){
var _9=_8.lat();
var _a;
if(_9<0){
_a="S";
_9=_9*-1;
}else{
_a="N";
}
var _b=Math.floor(_9);
var _c=Math.floor((_9*60)-(_b*60));
var _d=Math.floor((_9*3600)-(_b*3600)-(_c*60));
return format10(_b)+" "+format10(_c)+" "+format10(_d)+" "+_a;
};
function myLngToString(_e){
var _f=_e.lng();
var _10;
if(_f<0){
_10="W";
_f=_f*-1;
}else{
_10="E";
}
var _11=Math.floor(_f);
var _12=Math.floor((_f*60)-(_11*60));
var _13=Math.floor((_f*3600)-(_11*3600)-(_12*60));
return format100(_11)+" "+format10(_12)+" "+format10(_13)+" "+_10;
};

function wayPointToElement(_1){
var _2=document.createElement("tr");
var _3=(Math.round(this.pointNumber/2)*2)==this.pointNumber;
if(_3){
_2.className="ptsroweven";
}else{
_2.className="ptsrowodd";
}
var _4;
_4=document.createElement("td");
_4.appendChild(document.createTextNode(this.courseNumber.toString()));
_4.className="numcol";
_2.appendChild(_4);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(this.pointNumber.toString()));
_4.className="numcol";
_2.appendChild(_4);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(myLatToString(this.point)));
_4.className="llcol";
_2.appendChild(_4);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(myLngToString(this.point)));
_4.className="llcol";
_2.appendChild(_4);
var _5;
var _6;
if(this.vectorFromLastPoint==null){
_5=" ";
_6=" ";
totalDistanceString=" ";
}else{
var _7=getDistanceMultiplier(_1);
_5=formatFloat(this.vectorFromLastPoint.distanceNM*_7);
_6=(Math.round(this.vectorFromLastPoint.azimuthDegrees)).toString();
totalDistanceString=formatFloat(this.totalDistanceNM*_7);
}
_4=document.createElement("td");
_4.appendChild(document.createTextNode(_5));
_4.className="distcol";
_2.appendChild(_4);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(_6));
_4.className="distcol";
_2.appendChild(_4);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(totalDistanceString));
_4.className="distcol";
_2.appendChild(_4);
return _2;
};
function wayPointUpdateElement(_8){
var _9=this.tableRowElement.childNodes[2];
_9.replaceChild(document.createTextNode(myLatToString(this.point)),_9.childNodes[0]);
_9=this.tableRowElement.childNodes[3];
_9.replaceChild(document.createTextNode(myLngToString(this.point)),_9.childNodes[0]);
if(this.vectorFromLastPoint!=null){
var _a=getDistanceMultiplier(_8);
_9=this.tableRowElement.childNodes[4];
_9.replaceChild(document.createTextNode(formatFloat(this.vectorFromLastPoint.distanceNM*_a)),_9.childNodes[0]);
_9=this.tableRowElement.childNodes[5];
_9.replaceChild(document.createTextNode(Math.round(this.vectorFromLastPoint.azimuthDegrees)),_9.childNodes[0]);
_9=this.tableRowElement.childNodes[6];
_9.replaceChild(document.createTextNode(formatFloat(this.totalDistanceNM*_a)),_9.childNodes[0]);
}
return this.tableRowElement;
};
function wayPointRemoveOverlays(){
this.removeCourseLine();
if(this.marker!=null){
this.marker.setMap(null);
this.marker=null;
}
};
function wayPointRemoveCourseLine(){
if(this.courseLine!=null){
this.courseLine.setMap(null);
this.courseLine=null;
}
};
function wayPointUpdate(_b,_c,_d){
this.removeCourseLine();
this.point=_c;
if(this.lastWayPoint!=null){
var _e=new BestCourse(this.lastWayPoint.point,_c);
this.vectorFromLastPoint=_e.getVector();
this.totalDistanceNM=this.lastWayPoint.totalDistanceNM+this.vectorFromLastPoint.distanceNM;
this.courseLine=_e.getLine();
this.courseLine.setMap(_b);
}else{
this.totalDistanceNM=0;
this.vectorFromLastPoint=null;
}
if(this.tableRowElement!=null){
this.updateElement(_d);
}else{
this.tableRowElement=this.toElement(_d);
}
};
function WayPoint(_f,_10,_11,_12,_13,_14){
this.toElement=wayPointToElement;
this.updateElement=wayPointUpdateElement;
this.update=wayPointUpdate;
this.removeOverlays=wayPointRemoveOverlays;
this.removeCourseLine=wayPointRemoveCourseLine;
this.courseNumber=_10;
this.pointNumber=_11;
this.lastWayPoint=_13;
this.name=_11.toString();
this.update(_f,_12,_14);
};

function WindowSizeEquals(_1){
var _2=(this.width==_1.width)&&(this.length==_1.length);
return _2;
};
function WindowSize(_3,_4){
this.equals=WindowSizeEquals;
this.width=_3;
this.height=_4;
};
function getWindowSize(){
var _5,_6;
if(self.innerHeight){
_5=self.innerWidth;
_6=self.innerHeight;
}else{
if(document.documentElement&&document.documentElement.clientHeight){
_5=document.documentElement.clientWidth;
_6=document.documentElement.clientHeight;
}else{
if(document.body){
_5=document.body.clientWidth;
_6=document.body.clientHeight;
}
}
}
return new WindowSize(_5,_6);
};
var mapWidthOffset=680;
var mapHeightOffset=205;
var mapWidthInnerOffset=15;
var _lastWSize=null;
function resizeBody(){
if(_map==null||!_fullyLoaded){
return;
}
var _7=_map.getCenter();
if(_7==null){
return;
}
var _8=getWindowSize();
if(_8!=null&&_lastWSize!=null&&_8.equals(_lastWSize)){
return;
}
_lastWSize=_8;
var _9=_8.width;
var _a=_8.height;
var _b=_innerElement.offsetWidth-_tableElement.offsetWidth-mapWidthInnerOffset;
if(_b<0){
_b=_9-mapWidthOffset;
}
_mapElement.style.width=_b+"px";
var _c=_a-mapHeightOffset;
_mapElement.style.height=_c+"px";
google.maps.event.trigger(_map,"resize");
_map.setCenter(_7);
};

var _geocoder;
var _addressElement;
var _addressToGeoCode;
function foundLocation(_1,_2){
if((_1==null)||(_2!=google.maps.GeocoderStatus.OK)){
alert("\""+_addressToGeoCode+"\" not found, status: "+_2);
}else{
var _3=_1[0];
var _4=_3.geometry.location;
_map.setCenter(_4);
var _5=dropDefaultMarker(_map,_4,_3.formatted_address);
chooseMarker(_map,_5);
}
};
function findLocation(){
_addressToGeoCode=_addressElement.value;
_geocoder.geocode({"address":_addressToGeoCode},function(_6,_7){
foundLocation(_6,_7);
});
};
function initGeoCoder(){
_geocoder=new google.maps.Geocoder();
_addressElement=document.getElementById("address_input");
};

function wayPointsManagerNumberOfPoints(){
var _1=this.wayPointsList.length;
return _1;
};
function wayPointsManagerPushWayPoint(_2){
if(this.wayPointsList!=null){
return this.wayPointsList.push(_2);
}
return null;
};
function wayPointsManagerGetFirstWayPoint(){
var _3=null;
if(this.numberOfPoints()>0){
_3=this.wayPointsList[0];
}
return _3;
};
function wayPointsManagerRemoveLastWayPoint(){
var _4=null;
if(this.numberOfPoints()>0){
_4=this.wayPointsList.pop();
}
return _4;
};
function wayPointsManagerRemoveOverlays(){
for(var d=0;d<this.wayPointsList.length;d++){
var _5=this.wayPointsList[d];
_5.removeOverlays();
}
};
function wayPointsManagerGetLastWayPoint(){
var _6=null;
var _7=this.numberOfPoints();
if(_7>0){
_6=this.wayPointsList[_7-1];
}
return _6;
};
function wayPointsManagerAddWayPointTableElement(_8){
this.tBodyElement.appendChild(_8.tableRowElement);
};
function wayPointsManagerRemoveWayPointTableElement(_9){
if(_9.tableRowElement!=null){
this.tBodyElement.removeChild(_9.tableRowElement);
}
};
function wayPointsManagerUpdateElements(_a){
for(var d=0;d<this.wayPointsList.length;d++){
var _b=this.wayPointsList[d];
_b.tableRowElement=_b.updateElement(_a,_b.tableRowElement);
}
};
function WayPointsManager(_c,_d){
this.numberOfPoints=wayPointsManagerNumberOfPoints;
this.pushWayPoint=wayPointsManagerPushWayPoint;
this.getFirstWayPoint=wayPointsManagerGetFirstWayPoint;
this.getLastWayPoint=wayPointsManagerGetLastWayPoint;
this.removeLastWayPoint=wayPointsManagerRemoveLastWayPoint;
this.addWayPointTableElement=wayPointsManagerAddWayPointTableElement;
this.removeWayPointTableElement=wayPointsManagerRemoveWayPointTableElement;
this.updateElement=wayPointsManagerUpdateElements;
this.removeOverlays=wayPointsManagerRemoveOverlays;
this.courseNumber=_c;
this.wayPointsList=new Array();
this.tBodyElement=_d;
};

function geoCircleToElement(_1){
var _2=document.createElement("tr");
var _3=(Math.round(this.circleNumber/2)*2)==this.circleNumber;
if(_3){
_2.className="ptsroweven";
}else{
_2.className="ptsrowodd";
}
var _4;
var _5=getDistanceMultiplier(_1);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(this.circleNumber.toString()));
_4.className="numcol";
_2.appendChild(_4);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(" "));
_4.className="numcol";
_2.appendChild(_4);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(myLatToString(this.centerPoint)));
_4.className="llcol";
_2.appendChild(_4);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(myLngToString(this.centerPoint)));
_4.className="llcol";
_2.appendChild(_4);
var _6=formatFloat(this.radiusNM*_5);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(_6));
_4.className="distcol";
_2.appendChild(_4);
_4=document.createElement("td");
_4.appendChild(document.createTextNode(" "));
_4.className="distcol";
_2.appendChild(_4);
var _7;
if(this.circumferenceNM==null){
_7=" ";
}else{
_7=formatFloat(this.circumferenceNM*_5);
}
_4=document.createElement("td");
_4.appendChild(document.createTextNode(_7));
_4.className="distcol";
_2.appendChild(_4);
return _2;
};
function geoCircleUpdateElement(_8){
var _9=getDistanceMultiplier(_8);
var _a=formatFloat(this.radiusNM*_9);
var _b=this.tableRowElement.childNodes[4];
_b.replaceChild(document.createTextNode(formatFloat(_a)),_b.childNodes[0]);
var _c=formatFloat(this.circumferenceNM*_9);
_b=this.tableRowElement.childNodes[6];
_b.replaceChild(document.createTextNode(formatFloat(_c)),_b.childNodes[0]);
return this.tableRowElement;
};
function geoCircleRemoveLines(_d){
if(this.circleLine!=null){
this.circleLine.setMap(null);
this.circleLine=null;
}
if(this.innerCircleLine!=null){
this.innerCircleLine.setMap(null);
this.innerCircleLine=null;
}
};
function geoCircleRemoveOverlays(_e){
this.removeLines(_e);
if(this.marker!=null){
this.marker.setMap(null);
this.marker=null;
}
};
function geoCircleUpdate(_f,_10,_11,_12){
this.removeLines(_f);
this.updateEdge(_10,_11);
if(this.circleLine!=null){
this.circleLine.setMap(_f);
}
if(this.innerCircleLine!=null){
this.innerCircleLine.setMap(_f);
}
this.updateElement(_12);
};
function geoCircleComputeFromTwoPoints(_13,_14){
var _15=new BestCourse(this.centerPoint,_13);
var _16=_15.getVector();
if(!_14&&(this.radiusNM==_16.distanceNM)){
return;
}
this.radiusNM=_16.distanceNM;
var _17=null;
if(_14){
_17=3;
}else{
_17=12;
}
var _18=new Array();
for(var _19=0;_19<=360;_19+=_17){
var _1a=degreesToRadians(_19);
var _1b=directSolution(this.centerPoint,_1a,this.radiusNM);
_18.push(_1b);
}
this.circleLine=new google.maps.Polyline({path:_18,strokeColor:vectorColor,strokeWeight:vectorWeight,strokeOpacity:vectorOpacity,clickable:false});
if(_14){
var _1c=new Array();
var _1d=this.radiusNM*0.95;
this.circumferenceNM=0;
var _1e=_18[0];
_1c.push(_1e);
for(var p=1;p<_18.length;p++){
var _1f=_18[p];
var _20=new BestCourse(_1e,_1f);
var _21=_20.getVector();
this.circumferenceNM+=_21.distanceNM;
var _22=(Math.round(p/2)*2)==p;
if(_22){
_1c.push(_1f);
}else{
var _1a=degreesToRadians(p*_17);
var _23=directSolution(this.centerPoint,_1a,_1d);
_1c.push(_23);
}
_1e=_1f;
}
this.innerCircleLine=new google.maps.Polyline({path:_1c,strokeColor:vectorColor,strokeWeight:1,strokeOpacity:0.5,clickable:false});
}else{
this.innerCircleLine=null;
}
};
function GeoCircle(map,_24,_25){
this.toElement=geoCircleToElement;
this.updateElement=geoCircleUpdateElement;
this.update=geoCircleUpdate;
this.removeOverlays=geoCircleRemoveOverlays;
this.removeLines=geoCircleRemoveLines;
this.updateEdge=geoCircleComputeFromTwoPoints;
this.circleNumber=_24;
this.centerPoint=_25;
this.radiusNM=0;
this.circumferenceNM=null;
var _26="Circle # "+_24.toString();
this.marker=dropMyMarker(map,_25,_26);
this.tableRowElement=this.toElement(0);
};

function tableManagerAddWayPointList(){
var _1=this.wayPointsManagerList.length+this.circlesList.length+1;
var _2=new WayPointsManager(_1,this.tableBodyElement);
this.wayPointsManagerList.push(_2);
return _2;
};
function tableManagerAddCircle(_3,_4,_5){
var _6=this.wayPointsManagerList.length+this.circlesList.length+1;
var _7=new GeoCircle(_3,_6,_4);
this.circlesList.push(_7);
this.tableBodyElement.appendChild(_7.tableRowElement);
return _7;
};
function tableManagerRemoveLastCircle(){
var _8=this.circlesList.pop();
if((_8!=null)&&(_8.tableRowElement!=null)){
this.tableBodyElement.removeChild(_8.tableRowElement);
}
return _8;
};
function tableManagerRedrawPointsTable(_9){
for(var c=0;c<this.circlesList.length;c++){
var _a=this.circlesList[c];
_a.updateElement(_9);
}
for(var w=0;w<this.wayPointsManagerList.length;w++){
var _b=this.wayPointsManagerList[w];
_b.updateElement(_9);
}
};
function tableManagerInitTable(){
this.circlesList=new Array();
this.wayPointsManagerList=new Array();
};
function tableManagerClearTable(){
for(var w=0;w<this.wayPointsManagerList.length;w++){
this.wayPointsManagerList[w].removeOverlays();
}
for(var c=0;c<this.circlesList.length;c++){
this.circlesList[c].removeOverlays();
}
this.wayPointsManagerList.length=0;
this.circlesList.length=0;
this.initTable();
for(var i=this.tableBodyElement.childNodes.length-1;i>=0;i--){
this.tableBodyElement.removeChild(this.tableBodyElement.childNodes[i]);
}
};
function tableManagerBuildHeader(){
var _c=document.createElement("thead");
var _d=document.createElement("tr");
_c.appendChild(_d);
_d.className="ptshdr";
var _e;
_e=document.createElement("th");
_e.appendChild(document.createTextNode("Course/ Circle #"));
_e.className="numcol";
_d.appendChild(_e);
_e=document.createElement("th");
_e.appendChild(document.createTextNode("Point #"));
_e.className="numcol";
_d.appendChild(_e);
_e=document.createElement("th");
_e.appendChild(document.createTextNode("Point/Center Latitude"));
_e.className="llcol";
_d.appendChild(_e);
_e=document.createElement("th");
_e.appendChild(document.createTextNode("Point/Center Longitude"));
_e.className="llcol";
_d.appendChild(_e);
_e=document.createElement("th");
_e.appendChild(document.createTextNode("Distance/ Radius"));
_e.className="distcol";
_d.appendChild(_e);
_e=document.createElement("th");
_e.appendChild(document.createTextNode("Azimuth"));
_e.className="distcol";
_d.appendChild(_e);
_e=document.createElement("th");
_e.appendChild(document.createTextNode("Total Distance /Circumference"));
_e.className="distcol";
_d.appendChild(_e);
_translationManager.addElementToList(_d);
return _c;
};
function TableManager(){
this.initTable=tableManagerInitTable;
this.addWayPointList=tableManagerAddWayPointList;
this.redrawPointsTable=tableManagerRedrawPointsTable;
this.clearTable=tableManagerClearTable;
this.addCircle=tableManagerAddCircle;
this.removeLastCircle=tableManagerRemoveLastCircle;
this.initTable();
this.tableElement=document.getElementById("pointsTable");
this.tableElement.appendChild(tableManagerBuildHeader());
this.tableBodyElement=document.createElement("tbody");
this.tableElement.appendChild(this.tableBodyElement);
};

var ORIGINAL_LANGUAGE_CODE="en";
function translatedElementTranslate(_1){
if(this.languageCode==_1||this.element==null){
return;
}
this.finishLoading();
if(this.originalText==null){
return;
}
if(this.languageCode!=ORIGINAL_LANGUAGE_CODE){
this.setText(this.originalText);
this.languageCode=ORIGINAL_LANGUAGE_CODE;
}
if(_1!=ORIGINAL_LANGUAGE_CODE){
var _2=this;
google.language.translate(this.originalText,ORIGINAL_LANGUAGE_CODE,_1,function(_3){
if(!_3.error){
_2.setText(_3.translation);
_2.languageCode=_1;
}
});
}
};
function translatedElementedSetText(_4){
if(this.isValueTag){
this.element.value=_4;
}else{
if(this.isInnerHTMLTag){
this.element.innerHTML=_4;
}
}
};
function translatedElementGetText(){
var _5=null;
if(this.isValueTag){
_5=this.element.value;
}else{
if(this.isInnerHTMLTag){
_5=this.element.innerHTML;
}
}
return _5;
};
function translatedElementIsInnerHTMLTag(){
if(this.element.tagName=="TH"||this.element.tagName=="TD"||this.element.tagName=="DIV"||this.element.tagName=="OPTION"){
return true;
}else{
return false;
}
};
function translatedElementIsValueTag(){
if(this.element.tagName=="INPUT"){
return true;
}else{
return false;
}
};
function translatedElementFinishLoading(){
if(this.finishedLoading){
return;
}
this.languageCode=ORIGINAL_LANGUAGE_CODE;
if(this.element!=null){
this.isInnerHTMLTag=this.isInnerHTMLTag();
this.isValueTag=this.isValueTag();
this.originalText=this.getText();
}
this.finishedLoading=true;
};
function TranslatedElement(_6){
this.element=_6;
this.finishedLoading=false;
this.translate=translatedElementTranslate;
this.setText=translatedElementedSetText;
this.getText=translatedElementGetText;
this.isInnerHTMLTag=translatedElementIsInnerHTMLTag;
this.isValueTag=translatedElementIsValueTag;
this.finishLoading=translatedElementFinishLoading;
};

function translationManagerAddElementToList(_1){
if(_1==null){
return;
}
if(_1.tagName=="TR"){
var _2=_1.children;
for(var c=0;c<_2.length;c++){
this.addElementToList(_2[c]);
}
}else{
this.translationList.push(new TranslatedElement(_1));
}
};
function translationManagerTranslatePage(_3){
this.setCookie(_3);
for(var e=0;e<this.translationList.length;e++){
(this.translationList[e]).translate(_3);
}
};
function translationManagerSetCookie(_4){
if(this.currentCookieLanguageCode==_4){
return;
}
var _5=new Date();
_5.setDate(_5.getDate()+999);
document.cookie=this.languageCookieName+escape(_4)+";expires="+_5.toUTCString();
this.currentCookieLanguageCode=_4;
};
function translationManagerGetCookie(){
if(this.currentCookieLanguageCode!=null){
return this.currentCookieLanguageCode;
}
var _6=null;
var _7=document.cookie;
if(_7.length>0){
var _8=_7.indexOf(this.languageCookieName);
if(_8>0){
_8=_8+this.languageCookieName.length;
var _9=_7.indexOf(";",_8);
if(_9==-1){
_9=_7.length;
}
_6=unescape(_7.substring(_8,_9));
}
}
this.currentCookieLanguageCode=_6;
return this.currentCookieLanguageCode;
};
function translationManagerBrandTranslation(_a){
google.language.getBranding(_a);
};
function TranslationManger(){
this.translationList=new Array();
this.languageCookieName="lang=";
this.addElementToList=translationManagerAddElementToList;
this.translatePage=translationManagerTranslatePage;
this.setCookie=translationManagerSetCookie;
this.getCookie=translationManagerGetCookie;
this.brandTranslation=translationManagerBrandTranslation;
this.getCookie();
};

var _fullyLoaded=false;
var _circleMode=false;
var _wayPointsListManager=null;
var _currentCircle=null;
var _tempWayPoint=null;
var _defaultMarkersList=new Array();
var _changeUnitsBoxElement;
var _currentDistanceUnits=NAUTICAL_MILES_UNITS;
var _mapElement;
var _tableElement;
var _innerElement;
var _map;
var _wayPointIcon;
var _adsManager;
var startControl=null;
var wayPointsInProgressControl=null;
var circleInProgressControl=null;
var _translationManager;
function changeVisibleControl(_1,_2,_3){
_1.controls[google.maps.ControlPosition.RIGHT].pop(_2);
_1.controls[google.maps.ControlPosition.RIGHT].push(_3);
};
function dropMarker(_4,_5){
var _6=new google.maps.Marker(_5);
google.maps.event.addListener(_6,"click",function(){
chooseMarker(_4,_6);
});
return _6;
};
function dropDefaultMarker(_7,_8,_9){
var _a=dropMarker(_7,{position:_8,map:_7,title:_9});
_defaultMarkersList.push(_a);
return _a;
};
function dropMyMarker(_b,_c,_d){
return dropMarker(_b,{position:_c,map:_b,icon:_wayPointIcon,title:_d});
};
function createWayPointIcon(){
_wayPointIcon=new google.maps.MarkerImage("blueX40.png",new google.maps.Size(40,40),new google.maps.Point(0,0),new google.maps.Point(20,20));
};
function startCourse(_e){
removeTempWayPoint(_e);
changeVisibleControl(_e,startControl,wayPointsInProgressControl);
_wayPointsListManager=_tableManager.addWayPointList();
};
function endCourse(_f){
removeTempWayPoint(_f);
changeVisibleControl(_f,wayPointsInProgressControl,startControl);
_wayPointsListManager=null;
};
function endCourseAtLast(map){
endCourse(map);
};
function endCourseAtFirst(map){
if(_wayPointsListManager==null){
return;
}
var _10=null;
if((_10=_wayPointsListManager.getFirstWayPoint())!=null){
var _11=createWayPoint(map,_10.point);
_wayPointsListManager.pushWayPoint(_11);
}
endCourse(map);
};
function removeLastCoursePoint(map){
removeTempWayPoint(map);
if(_wayPointsListManager==null){
return;
}
var _12;
if((_12=_wayPointsListManager.removeLastWayPoint())!=null){
_tempWayPoint=_12;
_12.marker.setMap(null);
_12.marker=null;
if(_wayPointsListManager.numberOfPoints()==0){
removeTempWayPoint(map);
}else{
}
}
};
function chooseWayPoint(map,_13){
drawTempWayPoint(map,_13);
var _14=_tempWayPoint;
_tempWayPoint=null;
_14.marker=dropMyMarker(map,_13,_14.name);
_wayPointsListManager.pushWayPoint(_14);
};
function createWayPoint(map,_15){
if(_wayPointsListManager==null){
return null;
}
var _16=_wayPointsListManager.getLastWayPoint();
var _17=_wayPointsListManager.numberOfPoints();
var _18=new WayPoint(map,_wayPointsListManager.courseNumber,_17,_15,_16,_currentDistanceUnits);
_wayPointsListManager.addWayPointTableElement(_18);
return (_18);
};
function removeTempWayPoint(map){
if(_tempWayPoint!=null){
if(_tempWayPoint.courseLine!=null){
_tempWayPoint.courseLine.setMap(null);
}
_wayPointsListManager.removeWayPointTableElement(_tempWayPoint);
_tempWayPoint=null;
}
};
function drawTempWayPoint(map,_19){
if(_tempWayPoint!=null){
_tempWayPoint.update(map,_19,_currentDistanceUnits);
}else{
_tempWayPoint=createWayPoint(map,_19);
}
};
function startCircle(map,_1a){
_currentCircle=_tableManager.addCircle(map,_1a,_currentDistanceUnits);
};
function finishCircle(map,_1b){
drawTempCircle(map,_1b,true);
_currentCircle=null;
leaveCircleMode(map);
};
function eraseLastCircle(map){
_currentCircle=null;
var _1c=_tableManager.removeLastCircle();
if(_1c!=null){
_1c.removeOverlays(map);
}
};
function chooseCirclePoint(map,_1d){
if(_currentCircle==null){
startCircle(map,_1d);
}else{
finishCircle(map,_1d);
}
};
function drawTempCircle(map,_1e,_1f){
if(_currentCircle!=null){
_currentCircle.update(map,_1e,_1f,_currentDistanceUnits);
}
};
function changeUnits(){
_currentDistanceUnits=_changeUnitsBoxElement[_changeUnitsBoxElement.selectedIndex].value;
_tableManager.redrawPointsTable(_currentDistanceUnits);
if(_tempWayPoint!=null){
_tempWayPoint.updateElement(_currentDistanceUnits);
}
};
function clearAll(map){
if(_wayPointsListManager!=null){
_wayPointsListManager.removeOverlays();
}
if(_currentCircle!=null){
_currentCircle.removeOverlays();
}
if(_defaultMarkersList!=null){
for(var d=0;d<_defaultMarkersList.length;d++){
_defaultMarkersList[d].setMap(null);
}
}
_defaultMarkersList.length=0;
_defaultMarkersList=new Array();
_tableManager.clearTable();
_currentCircle=null;
_wayPointsListManager=null;
};
function enterCircleMode(map){
changeVisibleControl(map,startControl,circleInProgressControl);
removeTempWayPoint(map);
_wayPointsListManager=null;
_circleMode=true;
};
function leaveCircleMode(map){
changeVisibleControl(map,circleInProgressControl,startControl);
if(_currentCircle!=null){
_currentCircle.removeOverlays();
}
_currentCircle=null;
_circleMode=false;
};
function chooseMarker(map,_20){
choosePoint(map,_20.getPosition());
};
function choosePoint(map,_21){
if(_21==null){
return;
}
if(_circleMode){
chooseCirclePoint(map,_21);
}else{
if(_wayPointsListManager!=null){
chooseWayPoint(map,_21);
}
}
};
function drawTempPoint(map,_22){
if(_circleMode){
drawTempCircle(map,_22,false);
}else{
drawTempWayPoint(map,_22);
}
};
function setupTranslation(){
_translationManager.addElementToList(document.getElementById("titleText"));
_translationManager.addElementToList(document.getElementById("quickReference"));
_translationManager.addElementToList(document.getElementById("unitsText"));
_translationManager.addElementToList(document.getElementById("nmOpt"));
_translationManager.addElementToList(document.getElementById("kOpt"));
_translationManager.addElementToList(document.getElementById("mOpt"));
_translationManager.addElementToList(document.getElementById("geoText"));
_translationManager.addElementToList(document.getElementById("fButton"));
_translationManager.brandTranslation(document.getElementById("languageList"));
var _23=_translationManager.getCookie();
if(_23!=null){
translatePage(_23);
}
};
function translatePage(_24){
_translationManager.translatePage(_24);
};
function load(){
_translationManager=new TranslationManger();
_tableManager=new TableManager();
_mapElement=document.getElementById("map");
_tableElement=document.getElementById("pointsTableDiv");
_innerElement=document.getElementById("inner");
_changeUnitsBoxElement=document.getElementById("changeUnitsBox");
changeUnits();
var _25=new google.maps.LatLng(41.3,-95.89);
var _26={zoom:3,center:_25,mapTypeId:google.maps.MapTypeId.ROADMAP};
_map=new google.maps.Map(_mapElement,_26);
startControl=createStartControl(_map);
wayPointsInProgressControl=createWayPointsInProgressControl(_map);
circleInProgressControl=createCircleInProgressControl(_map);
google.maps.event.addListener(_map,"click",function(_27){
choosePoint(_map,_27.latLng);
});
google.maps.event.addListener(_map,"mousemove",function(_28){
drawTempPoint(_map,_28.latLng);
});
_map.controls[google.maps.ControlPosition.RIGHT].push(startControl);
createWayPointIcon();
initGeoCoder();
_fullyLoaded=true;
setupTranslation();
resizeBody();
};


