well andrew here it is i can't figure it out see if you something
wrong?

<HTML>


<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Pilot Locator via Google Maps</TITLE>
<link href="user.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
// interval for refresh
var iMinutes, iSeconds;
iMinutes=0;
iSeconds=10;

var timerID = 0;
var tStart  = null;
var up,down;

var min1,sec1,cmin2,csec2;

function displayTime(min,sec) {
        // return time in format mm:ss
        var disp;
        if(min<=9) disp=" 0";
        else disp=" ";
        disp+=min+":";
        if(sec<=9) disp+="0"+sec;
        else disp+=sec;
        return(disp);
}

function downRepeat() {
        // timer said: one second over
        csec2--;
        if(csec2==-1) { csec2=59; cmin2--; }
        document.getElementById("timeLeft").innerHTML = displayTime
(cmin2,csec2);
        if((cmin2==0)&&(csec2==0))
                timerFire();
        else
                down=setTimeout("downRepeat()",1000)
        ;
}

function startTimer() {
        // start / init timer, page
        cmin2=iMinutes;
        csec2=iSeconds;
        downRepeat();
        //timerAction(); // first action in maps section...
}

function restartTimer() {
        // start timer over with new count
        cmin2=iMinutes;
        csec2=iSeconds;
        downRepeat();
}

function timerFire() {
        // timer said: do something now
        timerAction();
        restartTimer();
}

function forceRefresh() {
        // force refresh, reset timer
        timerAction();
        cmin2=iMinutes;
        csec2=iSeconds;
}

function timerAction() {
        playerPositionsGet();
}

-->
</script>
</HEAD>

<center><table cellpadding="2" cellspacing="0" border="0"
width="100%">
<tr>

</tr>
</table>
</center>

<div id="map" style="width: 775px; height: 550px; border-top: 1px
solid #999; border-left: 1px solid #999; border-bottom: 1px solid
#505050; border-right: 1px solid #505050;"></div>
<!-- text below must be keept in place -->

<!-- above text must be keept in place -->
</BODY>


</HTML>


<!-- use your own Google Maps API Key - available at
http://www.google.com/apis/maps/signup.html -->
<script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=ABQIAAAAncvRQ6bGlarUu-
gJcDCGTRQi4XsiBoyVJ_BdVDKi7fJ_FcR0YRQBqJdwNntaPUK7T6wiNE6AIQu5pQ"
type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[

function move_and_zoom (location) {
        switch (location) {
                case "usa":
                        map.centerAndZoom(new GPoint(-93.867187, 38.959409), 
13);
                        break;
                case "swiss":
                        map.centerAndZoom(new GPoint(7.822266, 46.626806), 9);
                        break;
                case "europe":
                        map.centerAndZoom(new GPoint(16.962891, 49.037868), 13);
                        break;
                case "india":
                        map.centerAndZoom(new GPoint(80.859375, 22.350076), 13);
                        break;
                case "oceania":
                        map.centerAndZoom(new GPoint(144.140625, -23.805450), 
14);
                        break;
                case "world":
                map.centerAndZoom(new GPoint(0, 15.741612), 15);
                        break;
                default:
                        map.centerAndZoom(new GPoint(0, 15.741612), 15);
        
break;
        }
}

function createMarker(point, lon, lat, pilotName, pilotClose,
pilotAircraft, pilotAlt, pilotSpeed, pilotHeading) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
                //marker.openInfoWindowHtml('<a href="./?do=earth&coord=' + lon 
+
',' + lat + '">' + pilotName + ' -
View&nbsp;in&nbsp;Google&nbsp;Earth</a>');
                var sText;
                sText = '<b>' + pilotName + '</b> close to ' + pilotClose;
                sText += '<br>';
                sText += 'Flying ' + pilotAircraft;
                sText += '<br>';
                sText += 'at ' + pilotAlt + ' ft, ' + pilotSpeed + ', Heading ' 
+
pilotHeading + ' ';
                marker.openInfoWindowHtml(sText);
        });
        return marker;
}

    function getPlayerData(pData, sName) {
                if (pData.getElementsByTagName(sName))
                        if (pData.getElementsByTagName(sName).item(0))
                                if 
(pData.getElementsByTagName(sName).item(0).firstChild)
                                        return 
pData.getElementsByTagName(sName).item(0).firstChild.data
                                else return ""
                        else return ""
                else return "";
    }

    function readLatLon(sWert, sPlus) {
                var nDegrees, nHours, nSign;
                var sClean;
                var nTemp;
                // cleanup
                // "N46&#176; 44.61'" -> "N46 44.61'"
                // "E008&#176; 7.21'" -> "E008 7.21'"
                // N=+, S=- // E=+, W=-
                sClean = sWert;
                sClean = sClean.replace("&amp;#176;", "");
                sClean = sClean.replace("&#176;", "");
                sClean = sClean.replace("°", "");
                if (sClean.isEmpty) return 0;

                //' sign...
                if (sClean.substr(0,1) == sPlus) nSign=1; else nSign=-1;
                sClean = sClean.substr(1, sClean.length-1); //rest: "NNN NN.NN"
                nTemp = sClean.indexOf(" ");
                if (nTemp>0) {
                        // has space, looks ok
                        nDegrees = parseFloat(sClean.substr(0,nTemp));
                        nHours = parseFloat(sClean.substr(nTemp, 
sClean.length-nTemp));
                        return (nDegrees + (nHours / 60.0)) * nSign ;
                } else return 0;
        }

        function playerPositionsGet() {
                var request = GXmlHttp.create();
                //request.open('GET', 'xml.xml', true); // for testing
                request.open('GET', '/xml', true); // when online

                request.onreadystatechange = function() {
                  if (request.readyState == 4) {
                map.clearOverlays();
                        var xmldoc = request.responseXML;
                        var num_players = 
xmldoc.getElementsByTagName('CurrentPilots').item
(0).firstChild.data;
                        document.getElementById("nPilots").innerHTML = 
num_players;
                        for (var i = 0; i<num_players; i++) {


                                var myPlayer = 
xmldoc.getElementsByTagName('Player').item(i);

                                var myLonStr = getPlayerData(myPlayer, 
'Longitude');
                                var myLatStr = getPlayerData(myPlayer, 
'Latitude');
                                var myLat = readLatLon(myLatStr, "N");
                                var myLon = readLatLon(myLonStr, "E");
                                if ((myLat != 0) && (myLon != 0)) {
                                        var myName = getPlayerData(myPlayer, 
'Name');
                                        var myAlt = getPlayerData(myPlayer, 
'Altitude');
                                        var myAircraft = 
getPlayerData(myPlayer, 'Aircraft');
                                        var myClose = getPlayerData(myPlayer, 
'NearAirport') + ' ' +
getPlayerData(myPlayer, 'NearDistance');
                                        var mySpeed = getPlayerData(myPlayer, 
'Speed');
                                        var myHeading = getPlayerData(myPlayer, 
'Heading');

                                        var point = new GPoint(myLon, myLat);
                                        var marker = createMarker(point, myLon, 
myLat, myName, myClose,
myAircraft, myAlt, mySpeed, myHeading);
                                        map.addOverlay(marker);
                                }
                        }
                  }
                }
                request.send(null); // send request, process as above
        }

var map = new GMap(document.getElementById("map"));
move_and_zoom('world');
map.setMapType(G_HYBRID_MAP);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
playerPositionsGet(map);

    //]]>
    </script>
    <BODY onload="startTimer();">
<div id="ff" style="float:right;width:200px;"></div>
<p>Refresh in <span id="timeLeft">...</span>
( <a href="javascript:void(0);" onclick="forceRefresh();">Refresh Now</
a> )</p>


        <td><strong><span id="nPilots">?</span> Pilots online</strong></td>
        <td>Locations: <select id="move_and_zoom" onchange="move_and_zoom
(this.value);"><option
        value="world"selected>World<option value="swiss">Switzerland<option
        value="usa">USA<option value="europe">Europe<option
        value="india">India<option value="oceania">Oceania</select>
     <pt><pt>








On Mar 23, 11:45 am, Andrew Leach <[email protected]>
wrote:
> On Mar 23, 3:28 pm, "[email protected]" <[email protected]> wrote:
>
> > i keep getting this message on my map : Maps API Key used on this
> > website was registered for a different website"
>
> Assuming that you have specified the key for 24.11.76.13:81, something
> else is going wrong.
>
> I have a feeling that things are being confused by your invalid HTML.
> Does VS really allow you to do that? Different browsers react in
> different ways to incorrect code.
>
> You need a structure of
> <!DOCTYPE>
> <HTML>
> <HEAD>
> ...
> </HEAD>
> <BODY>
> ...
> </BODY>
> </HTML>
>
> In particular, you can only have one Head and one Body; they cannot be
> nested; and nothing can appear outside the elements I've listed here
> -- you can have other content only where the ... are.
>
> Getting an error message and then a map usually indicates that you are
> loading the API twice, once incorrectly and once correctly (for
> example, one might have a wrong key). I can't find two calls to the
> API script. If you get your HTML right it might go away, but it will
> certainly be easier to see what's going on.
>
> Andrew

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to