GMap.prototype.onMouseDown = function( a ) {
  var b = null;
  if ( a ) {
    var c = va( a, this.container );
    b = this.containerCoordToLatLng(c)
  }
  GEvent.trigger(map,"mousedown",b);
  if ( ( a.button != null && a.button == 2 ) ||
       ( a.which != null && a.which == 3 ) )
    GEvent.trigger(map,"rightclick",b);
  if ( ( a.button != null && a.button == 1 ) ||
       ( a.which != null && a.which == 4 ) )
    GEvent.trigger(map,"middleclick",b);
}

GMap.prototype.onDoubleClick = function(a) {
  if(!this.draggingEnabled()){return}
  var b = va(a,this.container);
  if ( this[GEvent.getPropertyName("dblclick")] ) {
    var p = this.containerCoordToLatLng( b );
    GEvent.trigger( this, "dblclick", p );
  } else {
    var c=Math.floor(this.viewSize.width/2)-b.x;
    var d=Math.floor(this.viewSize.height/2)-b.y;
    this.pan(c,d)
  }
}

// Copied from the API
function A(a){if(u.type==1){window.event.cancelBubble=true;window.event.returnValue=false}else{a.cancelBubble=true;a.preventDefault();a.stopPropagation()}}
function Ma(a){var b={"x":0,"y":0};while(a){b.x+=a.offsetLeft;b.y+=a.offsetTop;a=a.offsetParent}return b}
function va(a,b) {if(typeof a.offsetX!="undefined"){var c=a.target||a.srcElement;var d=Yc(c,b);return new GPoint(a.offsetX+d.x,a.offsetY+d.y)}else if(typeof a.pageX!="undefined"){var e=Ma(b);return new GPoint(a.pageX-e.x,a.pageY-e.y)}else{y.incompatible("dblclick");return new GPoint()}}
function Yc(a,b){var c={"x":0,"y":0};while(a&&a!=b){c.x+=a.offsetLeft;c.y+=a.offsetTop;a=a.offsetParent}return c}

