function show(idval) { 
   if (idval==selected) return;
   for (i=0; i<heights.length; i++)
      if (heights[i].indexOf(idval)==0) {
         $parts = heights[i].split("|"); 
         heightval = parseInt($parts[1]) + 15;
         break;     
      }
   $('#'+selected+'_link').removeClass('active');
   $('#'+idval+'_link').addClass('active');                  
   $('#'+selected).animate({
      height: 0
      }, 1000, function() {
    // Animation complete.
    });                                
   $('#'+idval).animate({
      height: heightval
      }, 1000, function() {

    });
    selected = idval;
}

function addEvent(obj, type, fn) {
   if (obj.addEventListener) {
      obj.addEventListener(type, fn, false);
      return true;
   } else if (obj.attachEvent) {
      var r = obj.attachEvent("on"+type, fn);
      return r;
   } else {
      return false;
   }
}  

function addMapPoint(map, latitude, longitude, html) {
   var point = new GMarker(new GLatLng(latitude, longitude));
   if (html) { 
      GEvent.addListener(point, "mouseover", function() { 
         point.openInfoWindowHtml(html); 
      });
   }
   map.addOverlay(point);
}

function addMapAddress(map, address, html) {   
  var geocoder = new GClientGeocoder();
  return geocoder.getLatLng(
    address,
    function(point) {
      if (!point) {
        //alert(address + " not found");
      } else {
         var marker = new GMarker(point); 
         if (html) {       
            GEvent.addListener(marker, "mouseover", function() { 
               marker.openInfoWindowHtml(html); 
            });
         }
         map.addOverlay(marker);
      }
    }
  );   
}

function setMapAddress(map, address, html) {
   var geocoder = new GClientGeocoder();
  geocoder.getLatLng(
    address,
    function(point) {
      if (!point) {
        //alert(address + " not found");
      } else {
        map.setCenter(point, 13);
        var marker = new GMarker(point);
        if (html) {       
           GEvent.addListener(marker, "mouseover", function() { 
              marker.openInfoWindowHtml(html); 
           });
        }
        map.addOverlay(marker);
      }
    }
  );
}
