Hi,

I've written a couple map scripts for the cms we use, and they usually
work, apart from this one.

http://www.somersetrcc.org.uk/test/community_hall_advice/halls_directory

It's in a working state at the moment as I've commented out the pop up
line. It works a treat in Firefox.

Here is the basic code

if (GBrowserIsCompatible()) {

  //var side_bar_html = "";
  var gmarkers = [];
  var i = 0;
  var arrayOfVillages = new Array(1);

  var map = new GMap2(document.getElementById("mapDiv"));
  map.addControl(new GLargeMapControl());
  map.addControl(new GMapTypeControl());
  map.setCenter(new GLatLng(51.0966,-2.9828), 10, G_NORMAL_MAP);

function createTabbedMarker(point,itemname,htmls,labels, grouptype) {

  var useIcon = new GIcon(G_DEFAULT_ICON);
  if          (grouptype==="Mendip")    {useIcon.image = "http://
www.somersetrcc.org.uk/test/images/marker-red.png";}
          else if (grouptype==="Sedgemoor") {useIcon.image = "http://
www.somersetrcc.org.uk/test/images/marker-yellow.png";}
          else if (grouptype==="South")     {useIcon.image = "http://
www.somersetrcc.org.uk/test/images/marker-pink.png";}
          else if (grouptype==="Taunton")   {useIcon.image = "http://
www.somersetrcc.org.uk/test/images/marker-green.png";}
          else if (grouptype==="West")      {useIcon.image = "http://
www.somersetrcc.org.uk/test/images/marker-blue.png";}
          else                              {useIcon.image = "http://
www.somersetrcc.org.uk/test/images/marker-blue.png";
  }

  markerOptions = { icon:useIcon, title:itemname};

  var marker = new GMarker(point,markerOptions);
  GEvent.addListener(marker, "click", function() {
    if (htmls.length > 2) {htmls[0] = '<div
style="width:'+htmls.length*88+'px">' + htmls[0] + '</div>';
    }
    var tabs = [];
    for (var i=0; i<htmls.length; i++) {
      tabs.push(new GInfoWindowTab(labels[i],htmls[i]));
    }
    //marker.openInfoWindowTabsHtml(tabs);
  });


        gmarkers[i] = marker;


        /*Build list of village halls*/

        //side_bar_html += '<a href="javascript:myclick(' + i + ')">' +
itemname + '</a><br />';
        arrayOfVillages[i] = new Array(3);

        arrayOfVillages[i][0] = i;
        arrayOfVillages[i][1] = itemname;
        arrayOfVillages[i][2] = grouptype;

        i++;

        return marker;
}

                function myclick(i) {

        GEvent.trigger(gmarkers[i], "click");

                var url = location.href;
                var length = url.length;

        if (url.substring(length - 6, length) != "mapTop") {
                        location.href = location.href + "#mapTop";
                } else {
                        location.href = location.href;
                }
      }



 <!-- Start of Sedgemoor Village Halls -->

map.addOverlay(createTabbedMarker(
  new GLatLng(51.257397996109525,-2.8578615188598633),
  "Allerton Old School Room",
  ["<p><strong>Allerton Old School Room</strong>(BS26 2NN)</p><div
class=\"mapcode\"><p>No Parking, No Stage, Main Hall, Kitchen, Indoor
Toilets, Seating capacity main hall 51-100, Dancing capacity Up to 50,
No Smoking.</p></div>",
  "<p>Tel: 01934 712256</p>"],
  ["Hall Name","Contact"],
  "Sedgemoor"));



   var htmlCol1 = "";
   var htmlCol2 = "";
   var htmlCol3 = "";
   var htmlCol4 = "";
   var htmlCol5  = "";

   htmlCol1 = "<table width=\"99%\" border=\"0\"> <tr><td valign=\"top
\"><br /><p><span style=\"font-size: 14px; font-weight: bold;
\">Mendip</span></p><br />";
   htmlCol2 = "<td valign=\"top\"><br /><p><span style=\"font-size:
14px; font-weight: bold;\">Sedgemoor</span></p><br />";
   htmlCol3 = "<td valign=\"top\"><br /><p><span style=\"font-size:
14px; font-weight: bold;\">South Somerset</span></p><br />";
   htmlCol4 = "<td valign=\"top\"><br /><p><span style=\"font-size:
14px; font-weight: bold;\">Taunton</span></p><br />";
   htmlCol5 = "<td valign=\"top\"><br /><p><span style=\"font-size:
14px; font-weight: bold;\">West Somerset</span></p><br />";

  function mysortfn(a,b) {
        if (a[1]<b[1]) return -1;
        if (a[1]>b[1]) return 1;
        return 0;
        }

   arrayOfVillages.sort(mysortfn);

   for (var j=0; j < i; j++) {

          if (arrayOfVillages[j][2]==="Mendip")                 {htmlCol1 += '<a
href="javascript:myclick(' + arrayOfVillages[j][0] + ')">' +
arrayOfVillages[j][1] + '</a><br />';}
          else if (arrayOfVillages[j][2]==="Sedgemoor") {htmlCol2 += '<a
href="javascript:myclick(' + arrayOfVillages[j][0] + ')">' +
arrayOfVillages[j][1] + '</a><br />';}
          else if (arrayOfVillages[j][2]==="South")     {htmlCol3 += '<a
href="javascript:myclick(' + arrayOfVillages[j][0] + ')">' +
arrayOfVillages[j][1] + '</a><br />';}
          else if (arrayOfVillages[j][2]==="Taunton")   {htmlCol4 += '<a
href="javascript:myclick(' + arrayOfVillages[j][0] + ')">' +
arrayOfVillages[j][1] + '</a><br />';}
          else if (arrayOfVillages[j][2]==="West")      {htmlCol5 += '<a
href="javascript:myclick(' + arrayOfVillages[j][0] + ')">' +
arrayOfVillages[j][1] + '</a><br />';}
   }

   htmlCol1 += "</td>";
   htmlCol2 += "</td>";
   htmlCol3 += "</td>";
   htmlCol4 += "</td>";
   htmlCol5 += "</td></tr></table>";

        document.getElementById("side_bar").innerHTML =
htmlCol1+htmlCol2+htmlCol3+htmlCol4+htmlCol5;


 }





Most of that isn't related, and the error occurs only in IE when you
uncomment the line

//marker.openInfoWindowTabsHtml(tabs);

It throws an error line 287 I believe, function Qh. I've tried running
different marker.openXXX methods, and they all throw the same error,
but not in FF.

Thank you for your help :)


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