function mapInit(){mymap=new google.maps.Map(document.getElementById("map_canvas"),{zoom:3,center:new google.maps.LatLng(27,10),draggableCursor:"crosshair",mapTypeControl:!1,panControl:!1,streetViewControl:!1,overviewMapControl:!0,overviewMapControlOptions:{opened:!0},zoomControlOptions:{position:google.maps.ControlPosition.LEFT_CENTER},mapTypeId:google.maps.MapTypeId.ROADMAP}),grid=new LocatorGrid(mymap),setCQ(mymap),setITU(mymap);DropDownMenu(mymap);mymap.controls[google.maps.ControlPosition.TOP_LEFT].push(document.getElementById("divInfo")),mymap.controls[google.maps.ControlPosition.LEFT_TOP].push(document.getElementById("divError")),mymap.controls[google.maps.ControlPosition.TOP_CENTER].push(document.getElementById("divGoToControls")),google.maps.event.addListener(mymap,"mousemove",MouseMove),0!=qso.length&&0!=mode.length&&gotoAPP(mode,"",qso)}function setInfo(e,o,t){document.getElementById("mgrid").innerHTML=e,document.getElementById("mitu").innerHTML=void 0!=o?o:"",document.getElementById("mcq")&&(document.getElementById("mcq").innerHTML=void 0!=t?t:"")}function MouseMove(e){var o=Coords2GRID(parseFloat(e.latLng.lat()).toFixed(6),parseFloat(e.latLng.lng()).toFixed(6),6),t=findZone(itu,e.latLng),a=findZone(cq,e.latLng);return setInfo(o,t,a),o}function MouseClick(e){gotoGRID(MouseMove(e))}function decodeLevels(e){for(var o=[],t=0;tparseFloat(o.lat()).toFixed(6))return"74"}if(e==cq){if(85parseFloat(o.lng()).toFixed(6))return"01";if(-109parseFloat(o.lng()).toFixed(6))return"02";if(-60parseFloat(o.lng()).toFixed(6))return"40";if(70parseFloat(o.lng()).toFixed(6))return"18";if(115parseFloat(o.lng()).toFixed(6))return"19"}if(-85>parseFloat(o.lat()).toFixed(6)){if(-120parseFloat(o.lng()).toFixed(6))return"12";if(-70parseFloat(o.lng()).toFixed(6))return"13";if(-26parseFloat(o.lng()).toFixed(6))return"38";if(40parseFloat(o.lng()).toFixed(6))return"39";if(90parseFloat(o.lng()).toFixed(6))return"29";if(129parseFloat(o.lng()).toFixed(6))return"30";if(165parseFloat(o.lng()).toFixed(6))return"32";if(-180parseFloat(o.lng()).toFixed(6))return"32"}}for(var t=0;t0;)markerlist.pop();for(;gridAPP.length>0;)gridAPP.pop();for(;markerAPP.length>0;)markerAPP.pop()}function calcGRIDSWcoords(e){e=e.toUpperCase();var o=20*(e.substr(0,1).charCodeAt(0)-65)-180,t=10*(e.substr(1,1).charCodeAt(0)-65)-90;return e.length>2&&(o+=2*parseInt(e.substr(2,1)),t+=parseInt(e.substr(3,1))),e.length>4&&(o+=5*(e.substr(4,1).charCodeAt(0)-65)/60,t+=2.5*(e.substr(5,1).charCodeAt(0)-65)/60),e.length>6&&(o+=30*parseInt(e.substr(6,1))/3600,t+=15*parseInt(e.substr(7,1))/3600),e.length>8&&(o+=1.25*(e.substr(8,1).charCodeAt(0)-65)/3600,t+=.625*(e.substr(9,1).charCodeAt(0)-65)/3600),t=parseFloat(t.toFixed(6)),o=parseFloat(o.toFixed(6)),new google.maps.LatLng(t,o)}function drawGRID(e){var o=calcGRIDSWcoords(e),t=parseFloat(o.lat()),a=parseFloat(o.lng()),n=new google.maps.LatLngBounds(new google.maps.LatLng(a,t),new google.maps.LatLng(parseFloat(a+parseFloat(locH)),parseFloat(t+parseFloat(locW))));locRect=new google.maps.Rectangle({bounds:n,strokeColor:"#0000FF",strokeOpacity:.4,strokeWeight:4,fillColor:"#0000FF",fillOpacity:.1}),locRect.setMap(mymap)}function Coords2GRID(e,o,t){t=t||6;var a=parseFloat(o)+180,n=parseFloat(e)+90,l=Math.floor(a/20),r=Math.floor(n/10),i=65,s=String.fromCharCode(l+i),d=String.fromCharCode(r+i);a-=20*l,n-=10*r;var p=Math.floor(a/2),c=Math.floor(n);a=60*(a-2*p),n=60*(n-c);var g=Math.floor(a/5),m=Math.floor(n/2.5),i=97,u=String.fromCharCode(g+i),y=String.fromCharCode(m+i);a-=5*g,n-=2.5*m;var f=s.concat(d,String(p),String(c),u,y);if(f=f.substr(0,t),t>6){a*=60,n*=60;var v=Math.floor(a/30);l=Math.floor(n/15),a-=30*v,n-=15*l,f=f.concat(String(v),String(l))}return t>8&&(t=String.fromCharCode(Math.floor(a/1.25)+i),a=String.fromCharCode(Math.floor(n/.625)+i),f=f.concat(t,a)),f}function gotoGRID(e){document.getElementById("GoToLocator").value="",locStr=e;var o;if(2==locStr.length){o=/^([a-r]{2})$/i;var t=20,a=10}if(4==locStr.length){o=/^([a-r]{2}[0-9]{2})$/i;var t=2,a=1}if(6==locStr.length){o=/^([a-r]{2}[0-9]{2}[a-x]{2})$/i;var t=parseFloat(5/60).toFixed(6),a=parseFloat(2.5/60).toFixed(6)}if(o.exec(locStr)){var n=calcGRIDSWcoords(locStr),l=new google.maps.LatLng(parseFloat(n.lat()+parseFloat(a)),parseFloat(n.lng()+parseFloat(t))),r=new google.maps.LatLng(parseFloat(n.lat()+parseFloat(a/2)),parseFloat(n.lng()+parseFloat(t/2))),i=new google.maps.LatLngBounds(n,l);e=Coords2GRID(parseFloat(n.lat()+parseFloat(a/2)),parseFloat(n.lng()+parseFloat(t/2)),locStr.length);var s=findZone(itu,r),d=findZone(cq,r),p='
';p+='
Locator: '+e+"
",void 0!=s&&(p+='
ITU zone: '+s+"
"),void 0!=d&&(p+='
CQ zone: '+d+"
"),p+="
",clearMarkers(),locRect=new google.maps.Rectangle({bounds:i,strokeColor:"#FF0000",strokeOpacity:.4,strokeWeight:2,fillColor:"#FF0000",fillOpacity:.05,clickable:!1}),locRect.setMap(mymap),setInfo(e,s,d),locMarker=new google.maps.Marker({position:r,map:mymap}),locMarkerToolTip=new google.maps.InfoWindow({content:p,disableAutoPan:!1,alignBottom:!0,pixelOffset:new google.maps.Size(0,-32),zIndex:null,closeBoxMargin:"0px",closeBoxURL:"",infoBoxClearance:new google.maps.Size(1,1),isHidden:!1,pane:"floatPane",enableEventPropagation:!0,position:r}),locMarkerToolTip.open(mymap),google.maps.event.addListener(locMarker,"click",function(){locMarkerToolTip.open(mymap)}),mymap.setZoom(16),mymap.fitBounds(i),mymap.panToBounds(i)}}function gotoADDRESS(e){function o(e,o){if(o==google.maps.GeocoderStatus.OK&&e[0]){var t=e[0].geometry.location,a=Coords2GRID(t.lat(),t.lng(),6),n='
';n+='
'+e[0].formatted_address+"
";for(var l=0,r=e[0].address_components.length;r>l;l++){var i=e[0].address_components[l];i.types.indexOf("country")>=0&&(n+='
'+i.long_name+"
"),i.types.indexOf("administrative_area_level_1")>=0&&(n+='
'+i.long_name+"
"),i.types.indexOf("administrative_area_level_2")>=0&&(n+='
'+i.long_name+"
"),i.types.indexOf("administrative_area_level_3")>=0&&(n+='
'+i.long_name+"
")}n+='
'+a+"
",n+="
";var s=calcGRIDSWcoords(a),d=new google.maps.LatLng(parseFloat(s.lat()+parseFloat(locH)),parseFloat(s.lng()+parseFloat(locW))),p=new google.maps.LatLng(parseFloat(s.lat()+parseFloat(locH/2)),parseFloat(s.lng()+parseFloat(locW/2))),c=new google.maps.LatLngBounds(s,d),g=findZone(itu,p),m=findZone(cq,p);setInfo(a,g,m),clearMarkers(),locRect=new google.maps.Rectangle({bounds:c,strokeColor:"#FF0000",strokeOpacity:.4,strokeWeight:2,fillColor:"#FF0000",fillOpacity:.05,clickable:!1}),locRect.setMap(mymap),locMarker=new google.maps.Marker({map:mymap,position:t}),locMarkerToolTip=new google.maps.InfoWindow({content:n,disableAutoPan:!0,alignBottom:!0,pixelOffset:new google.maps.Size(0,-32),zIndex:null,closeBoxMargin:"0px",closeBoxURL:"",infoBoxClearance:new google.maps.Size(1,1),isHidden:!1,pane:"floatPane",enableEventPropagation:!0,position:t}),locMarkerToolTip.open(mymap),google.maps.event.addListener(locMarker,"click",function(){locMarkerToolTip.open(mymap)}),mymap.setZoom(16),mymap.fitBounds(c),mymap.panToBounds(c)}else alert("Sorry, "+o)}document.getElementById("GoToAddress").value="",e.address&&e.address.trim&&(e.address=e.address.trim()),e.address&&geocoder.geocode(e,o)}function gotoCOORD(e,o){var e=document.getElementById("GoToLat").value,o=document.getElementById("GoToLng").value;if(document.getElementById("GoToLat").value="",document.getElementById("GoToLng").value="",0==e.length)alert("Please enter a Latitude value");else if(0==o.length)alert("Please enter a Longitude value");else if(e=parseFloat(e).toFixed(6),o=parseFloat(o).toFixed(6),-85>e||e>85)alert("Please enter a Latitude value between 85.0 and -85.0");else if(-180>o||o>180)alert("Please enter a Longitude value between -180.0 and 180.0");else{var t=Coords2GRID(e,o,6);gotoGRID(t)}}function gotoAPP(e,o,t){clearMarkers();var a=[6,1,11,11,1],n=[6,1,11,1,11],l="",r=0,i=[0,"Call Sign      |  GRID  | your zone | calc zone 
------------------------------------------------
"];0==o.length?(markerlist=t,markerlist=markerlist.sort(Comparator)):(markerlist=AppDataPrepare(e,o),markerlist=markerlist.sort(Comparator));for(var s=0;s"):(F="#66cc66",h="includes/green.png"),"itu"==e&&89>k&&k>75&&78!=k&&(F="#ff6666",h="includes/red.png"),"mmpa"==e&&(34>k&&k>30||44>k&&k>41)&&(F="#ff6666",h="includes/red.png"),v='
',v+='
'+d[0]+"
",v+='
'+loc+"
",v+='
'+e.toUpperCase()+" zone (calculated): "+k+"
",v+='
'+e.toUpperCase()+" zone (from your log): "+b+"
","itu"==e&&89>k&&k>75&&78!=k&&(v+='
NOT valid for ITUPSK
'),"mmpa"==e&&(34>k&&k>30||44>k&&k>41)&&(v+='
NOT valid for MMPA
'),v+="
",mymap.setZoom(2),gridAPP[s]=new google.maps.Rectangle({bounds:f,strokeColor:"#FF0000",strokeOpacity:.4,strokeWeight:2,fillColor:"#FF0000",fillOpacity:.05,clickable:!1}),gridAPP[s].setMap(mymap),markerAPP[s]=new google.maps.Marker({position:new google.maps.LatLng(parseFloat(m.lat()+parseFloat(a[r]*g/12)),parseFloat(m.lng()+parseFloat(n[r]*c/12))),title:d[0],icon:h,map:mymap,content:v})}l=locStr}i[0]>0?(document.getElementById("merror").innerHTML=i[1],setCookie(e,i[0])):(document.getElementById("merror").innerHTML="",setCookie(e,i[0])),document.getElementById("GoTo"+e.toUpperCase()+"App").value="";for(var s=0;so[1]?1:0}function setCookie(e,o){var t=new Date;t.setTime(t.getTime()+864e5);var a="expires="+t.toUTCString();document.cookie=e+"="+o+"; "+a}function AppDataPrepare(e,o){var t,a,n,l=[];switch(e){case"cq":case"itu":for(var r=o.split("\n"),i=0;i5&&(t=r[i].slice(0,20).trim(),a=r[i].slice(54,62).trim(),n=r[i].slice(62,66).trim(),""!=a&&(l[l.length]=[t,a,n]));break;case"mmpa":for(var r=o.split(""),s=0;s")+1);if("GRID"==d[i].substr(0,4))var a=d[i].substr(d[i].indexOf(">")+1);if("ITUZ"==d[i].substr(0,4))var n=d[i].substr(d[i].indexOf(">")+1)}void 0!=a&&void 0!=t&&void 0!=n&&(l[l.length]=[t,a,n])}}return l}function toggleGoTo(){var e=document.getElementById("GoToMode").value,o=document.getElementById("GoToGRID"),t=document.getElementById("GoToLatLng"),a=document.getElementById("GoToADD"),n=document.getElementById("GoToCQ"),l=document.getElementById("GoToITU"),r=document.getElementById("GoToMMPA");"locator"==e&&(o.style.display="inline",t.style.display="none",a.style.display="none",l.style.display="none",r.style.display="none",n.style.display="none"),"address"==e&&(o.style.display="none",t.style.display="none",a.style.display="inline",l.style.display="none",r.style.display="none",n.style.display="none"),"latlong"==e&&(o.style.display="none",t.style.display="inline",a.style.display="none",l.style.display="none",r.style.display="none",n.style.display="none"),"cqpsk"==e&&(o.style.display="none",t.style.display="none",a.style.display="none",l.style.display="none",r.style.display="none",n.style.display="inline"),"itupsk"==e&&(o.style.display="none",t.style.display="none",a.style.display="none",l.style.display="inline",r.style.display="none",n.style.display="none"),"mmpa"==e&&(o.style.display="none",t.style.display="none",a.style.display="none",l.style.display="none",r.style.display="inline",n.style.display="none")}function checkinp(e,o,t){if(e=document.getElementById(o)){switch(o=e.value,t){case"address":var a=o;break;case"coord":a=o.replace(/[^0-9.\-]+/g,"");break;case"grid":a=o.replace(/[^a-zA-Z0-9]+/g,"")}e.value=a,e.focus()}}function optionDiv(e){var o=document.createElement("DIV");return o.className="dropDownItemDiv",o.title=e.title,o.id=e.id,o.innerHTML=e.name,google.maps.event.addDomListener(o,"click",e.action),o}function checkBox(e){var o=document.createElement("DIV");o.className="checkboxContainer",o.title=e.title;var t=document.createElement("SPAN");t.role="checkbox",t.className="checkboxSpan";var a=document.createElement("DIV");a.className="blankDiv",a.id=e.id,a.style.display="none";var n=document.createElement("IMG");n.className="blankImg",n.src="includes/imgs8.png";var l=document.createElement("LABEL");return l.className="checkboxLabel",l.innerHTML=e.label,a.appendChild(n),t.appendChild(a),o.appendChild(t),o.appendChild(l),google.maps.event.addDomListener(o,"click",function(){document.getElementById(a.id).style.display="block"==document.getElementById(a.id).style.display?"none":"block",e.action()}),o}function separator(){var e=document.createElement("DIV");return e.className="separatorDiv",e}function dropDownOptionsDiv(e){var o=document.createElement("DIV");for(o.className="dropDownOptionsDiv",o.id=e.id,i=0;i