function XMarker(latlng,opts) {
  // init code can go here ...
  if(!opts) opts = {};
  opts.draggable = true;
  BpMarker.call(this,latlng,opts);
  // ... or here
}

XMarker.prototype = new BpMarker(new GLatLng(0,0));

var closeListener = false;
window.iwOpener   = null;
XMarker.prototype.initialize = function(map) {
  // pre-addOverlay code goes here
  this.setImage('/images/marker_blue.png');
  this.setHoverImage('/images/marker_yellow.png');

  if(!closeListener) {
    closeListener = GEvent.addListener(map,'infowindowclose',function(){
      if(!iwOpener)
        return;
      
      iwOpener.setMaintainTooltip(false);
      iwOpener.hideTooltip();
      iwOpener = null;
    });
  }

  // here's where the marker is added to the map
  BpMarker.prototype.initialize.apply(this,arguments);

  // post-addOverlay code goes here
  this.setTooltipHtml('Drag Me');
  this.getTooltipLabel().setClassName('markerTooltip');
  GEvent.addListener(this,'click',this.onClick);
  GEvent.addListener(this,'dragstart',this.onDragStart);
};

XMarker.prototype.onDragStart = function() {
  if(iwOpener === this)
    this.getMap().closeInfoWindow();
  this.setMaintainTooltip(false);
  this.hideTooltip();
};

XMarker.prototype.display = function(show) {
  if(show) {
    // onBeforeShow code goes here

    BpMarker.prototype.display.apply(this,arguments);
    
    // onAfterShow code goes here
    if(BpMarker.getInfoWindowOpener() === this)
      this.showTooltip();
  } else { // hide
    // onBeforeHide code goes here

    BpMarker.prototype.display.apply(this,arguments);

    // onAfterHide code goes here
  }
};

XMarker.prototype.remove = function() {
  // pre-removeOverlay code goes here

  BpMarker.prototype.remove.apply(this,arguments);

  // post-removeOverlay code goes here
};

XMarker.prototype.onClick = function() {
  if(iwOpener === this) {
    this.getMap().closeInfoWindow();
    this.setMaintainTooltip(false);
    this.hideTooltip();
  } else {
    this.openInfoWindowHtml("<div>" +
      "<ul><li>easier to read</li>" + 
      "<li>easier to maintain</li>" +
      "<li>etc</li>" +
      "</ul></div>");
    this.setMaintainTooltip(true);
    this.showTooltip();
  }
};

XMarker.prototype.openInfoWindowHtml = function() {
  iwOpener = this;
  GMarker.prototype.openInfoWindowHtml.apply(this,arguments);
};