 // == shows all markers of a particular category, and ensures the checkbox is checked ==
      function show(category) {
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].mycategory == category) {
            gmarkers[i].show();
          }
        }
        // == check the checkbox ==
        document.getElementById(category+"box").checked = true;
      }

      // == hides all markers of a particular category, and ensures the checkbox is cleared ==
      function hide(category) {
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].mycategory == category) {
            gmarkers[i].hide();
          }
        }
        // == clear the checkbox ==
        //alert("cat="+category+"box");
        document.getElementById(category+"box").checked = false;
        // == close the info window, in case its open on a marker that we just hid
        //map.closeInfoWindow();
      }

      // == a checkbox has been clicked ==
      function boxclick(box,category) {
        if (box.checked) {
          show(category);
        } else {
          hide(category);
        }
        // == rebuild the side bar
        makeSidebar();
      }

      function myclick(i) {
        GEvent.trigger(gmarkers[i],"click");
      }
      
      function centerme(lat,lon){
          map.closeInfoWindow();
          map.setZoom(4);
          map.panTo(new GLatLng(lat,lon));
          
      }
      
     // == rebuilds the sidebar to match the markers currently displayed ==
      function makeSidebar() {
      
        return;
        var html = "xxxx";
        for (var i=0; i<gmarkers.length; i++) {
          
                        html += 'v<a href="javascript:myclick(' + i + ')">' + gmarkers[i].mycategory + '</a><br>';          
        }
        document.getElementById("side_bar").innerHTML = html;
      }
      
      function resetmap()
      {
            show("surf");
            show("kitesurf");
            show("skisnow");
            show("diving");
            //map.centerAndZoom(new GPoint("40.45","-3.55"), "15");
        document.getElementById("surfbox").checked = true;
        document.getElementById("kitesurfbox").checked = true;
        document.getElementById("skisnowbox").checked = true;
        document.getElementById("divingbox").checked = true;
        
          map.closeInfoWindow();
          map.setZoom(2);
          map.panTo(new GLatLng("40.45","-3.55"));
      }
      
      
     
