Hey,
I have an error in IE that is saying that GControl is undefined. In FF
everything is working fine. I'll post my code here and let me know
what do you thing is wrong.

My code:

"
var scriptTag = '<' + 'script src="http://maps.google.com/maps?
file=api&v=2&key=ABQIAAAAlHmPPQ6AYUL4vfOh_9S80hQIlFDai40dTIVIMoF9B1LnN3-9IhRBW0f8h0T85XGnngaIzZEFJdBwMA">'+'<'+'/
script>';
document.write(scriptTag);
var scriptTag1 = '<' + 'script src="http://www.google.com/uds/
solutions/localsearch/gmlocalsearch.js">'+'<'+'/script>';
document.write(scriptTag1);
var scriptTag2 = '<' + 'script src="http://www.google.com/uds/api?
file=uds.js&amp;v=1.0">'+'<'+'/script>';
document.write(scriptTag2);

function validationMap(){
        var countrySelectedIndex =
document.getElementById("country").selectedIndex;
        var countryName = document.getElementById("country")
[countrySelectedIndex].text;
        var citySelectedIndex =
document.getElementById("City").selectedIndex;
        var cityName = document.getElementById("City")
[citySelectedIndex].text;
        if(document.getElementById("country").value!=-1 ||
document.getElementById("City").value!=0) {
                return true;
        } else {
                alert("You have to choose a country or city or both before 
viewing
the map!");
                return false;
        }
}

function populateDiv(type) {
        if(type == 1) {
        document.getElementById('blockUIPopupContent').innerHTML = '<div
id="map" style="width: 650px; height: 300px"></div><table
class="normalbold"><tr><td width="200px"><span>Latitude: </span><input
type="text" readonly id="viewLat" value="" /></td><td
width="200px"><span>Longitude: </span><input type="text" readonly
id="viewLong" value="" /></td><td width="100px" align="left"><button
onclick="closeDivPopUp();" style="border: medium none ; background-
color: transparent; cursor: pointer; text-decoration: none;"
type="button"><img vspace="0" hspace="0" border="0" align="absmiddle"
src="../new_button.php?
height=20&verspace=7&text=FINSH&CLOSE&fromcolor=7FB7C6&tocolor=008597&btmcolor=0498AB&height=23&fontsize=8&horspace=20"/
></button></td></tr></table>';
        } else {
                document.getElementById('blockUIPopupContent').innerHTML = '<div
id="map" style="width: 650px; height: 300px"></div><table
class="normalbold"><tr><td width="200px"><span>Latitude: </span><input
type="text" readonly id="viewLat" value="" /></td><td
width="200px"><span>Longitude: </span><input type="text" readonly
id="viewLong" value="" /></td><td width="100px" align="left"><button
onclick="saveEditedCoordinates();closeDivPopUp();" style="border:
medium none ; background-color: transparent; cursor: pointer; text-
decoration: none;" type="button"><img vspace="0" hspace="0" border="0"
align="absmiddle" src="../new_button.php?
height=20&verspace=7&text=SAVE AND
CLOSE&fromcolor=7FB7C6&tocolor=008597&btmcolor=0498AB&height=23&fontsize=8&horspace=20"/
></button></td><td><button onclick="closeDivPopUp();" style="border:
medium none ; background-color: transparent; cursor: pointer; text-
decoration: none;" type="button"><img vspace="0" hspace="0" border="0"
align="absmiddle" src="../new_button.php?
height=20&verspace=7&text=CLOSE&fromcolor=7FB7C6&tocolor=008597&btmcolor=0498AB&height=23&fontsize=8&horspace=20"/
></button></td></tr></table>';
        }
}

var mArray = Array();
var map;


function loadMap() {
        var countrySelectedIndex =
document.getElementById("country").selectedIndex;
        var countryName = document.getElementById("country")
[countrySelectedIndex].text;
        var citySelectedIndex =
document.getElementById("City").selectedIndex;
        var cityName = document.getElementById("City")
[citySelectedIndex].text;
        showAddress(cityName+','+countryName);

        //addMarkers();
}

function showAddress(address) {
        var geocoder = new GClientGeocoder();
  geocoder.getLatLng(
    address,
    function(point) {
      if (!point) {
        alert(address + " not found");
      } else {
        doLoad(point);
      }
    }
  );
}


function doLoad(centerPoint) {

        if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map"));
//              /geocoder = new GClientGeocoder();
                //alert(showAddress('Dubai, United Arab Emirates'));
                //var centerPoint = new GLatLng(37.4419, -122.1419);
                var center = new GLatLng(centerPoint.x,centerPoint.y);
        map.setCenter(centerPoint, 13);
                map.addControl(new google.maps.LocalSearch(), new
GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));
                map.addControl(new GScaleControl());
                map.addControl(new GLargeMapControl());
                map.addControl(new GMapTypeControl());

                var marker = new GMarker(center, {draggable: true});
                marker.setPoint(new GLatLng(map.getCenter().lat(),
map.getCenter().lng()))
        GEvent.addListener(marker, "dragstart", function() {
          map.closeInfoWindow();
        });

        GEvent.addListener(marker, "dragend", function() {
        /*      alert(marker.getPoint().lat());
                alert(marker.getPoint().lng());*/
                        document.getElementById('lat').value =  
marker.getPoint().lat();
                        document.getElementById('lon').value =  
marker.getPoint().lng();
                        document.getElementById('viewLat').value =
marker.getPoint().lat();
                        document.getElementById('viewLong').value =
marker.getPoint().lng();
        });
        map.addOverlay(marker);

        }
}

function viewMap(x,y) {
        if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map"));
//              /geocoder = new GClientGeocoder();
                //alert(showAddress('Dubai, United Arab Emirates'));
                //var centerPoint = new GLatLng(37.4419, -122.1419);
                var center = new GLatLng(x,y);
        map.setCenter(center, 13);
                map.addControl(new google.maps.LocalSearch(), new
GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));
                map.addControl(new GScaleControl());
                map.addControl(new GLargeMapControl());
                map.addControl(new GMapTypeControl());

                var marker = new GMarker(center, {draggable: true});
                marker.setPoint(new GLatLng(map.getCenter().lat(),
map.getCenter().lng()))
        GEvent.addListener(marker, "dragstart", function() {
          map.closeInfoWindow();
        });

        GEvent.addListener(marker, "dragend", function() {
        /*      alert(marker.getPoint().lat());
                alert(marker.getPoint().lng());*/
                        document.getElementById('tempLat').value =
marker.getPoint().lat();
                        document.getElementById('tempLon').value =
marker.getPoint().lng();
                        document.getElementById('viewLat').value =
marker.getPoint().lat();
                        document.getElementById('viewLong').value =
marker.getPoint().lng();
        });
        map.addOverlay(marker);

        }
}

function showMap(x,y,type) {
        openDivPopUp('650','370');
        populateDiv(type);
        viewMap(x,y);
}

function saveEditedCoordinates(){
        if(document.getElementById('tempLat').value!
=''&&document.getElementById('tempLon').value!='') {
        document.getElementById('lat').value =
document.getElementById('tempLat').value;
        document.getElementById('lon').value =
document.getElementById('tempLon').value;
        } else {
                alert("There is nothing to save.Please moove the marker to other
location for saving the new coordinates!");
                return false;
        }
}

"
Thank you for your help/time.

--~--~---------~--~----~------------~-------~--~----~
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