var Geo={parseDMS:function(e){if("object"==typeof t)throw new TypeError("Geo.parseDMS - dmsStr is [DOM?] object");if("number"==typeof e&&isFinite(e))return Number(e);var r=String(e).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==r[r.length-1]&&r.splice(r.length-1),""==r)return NaN;switch(r.length){case 3:var t=r[0]/1+r[1]/60+r[2]/3600;break;case 2:t=r[0]/1+r[1]/60;break;case 1:t=r[0];break;default:return NaN}return/^-|[WS]$/i.test(e.trim())&&(t=-t),Number(t)},toDMS:function(e,r,t){if("object"==typeof e)throw new TypeError("Geo.toDMS - deg is [DOM?] object");if(isNaN(e))return null;if(void 0===r&&(r="dms"),void 0===t)switch(r){case"d":t=4;break;case"dm":t=2;break;case"dms":t=0;break;default:r="dms",t=0}switch(e=Math.abs(e),r){case"d":(n=e.toFixed(t))<100&&(n="0"+n),n<10&&(n="0"+n),dms=n+"°";break;case"dm":var o=(60*e).toFixed(t);(n=Math.floor(o/60))<100&&(n="0"+n),n<10&&(n="0"+n),(i=(o%60).toFixed(t))<10&&(i="0"+i),dms=n+"°"+i+"′";break;case"dms":var a=(3600*e).toFixed(t),n=Math.floor(a/3600),i=Math.floor(a/60)%60,s=(a%60).toFixed(t);n<100&&(n="0"+n),n<10&&(n="0"+n),i<10&&(i="0"+i),s<10&&(s="0"+s),dms=n+"°"+i+"′"+s+"″"}return dms},toLat:function(e,r,t){var o=Geo.toDMS(e,r,t);return null==o?"–":o.slice(1)+(e<0?"S":"N")},toLon:function(e,r,t){var o=Geo.toDMS(e,r,t);return null==o?"–":o+(e<0?"W":"E")},toBrng:function(e,r,t){e=(Number(e)+360)%360;var o=Geo.toDMS(e,r,t);return null==o?"–":o.replace("360","0")}};window.console||(window.console={log:function(){}});