/*
	map.disableZooming()
	map.enableZooming()
	var bool = map.zoomingEnabled()


Here are the ways we can set the zoom:
  using the map control
  
  zoomIn()
  zoomOut()
  setZoom()
  setCenter(center,zoom)

Doing these when zooming is disabled will result in the zoom being set twice - once for the original zoom,
  and once when we re-set the zoom back to where we want it to stay. Zoomend and moveend handlers will
  therefore be called twice each.

So, in zoomand and moveend handlers, do this first:
  if(!map.zoomingEnabled()) return;

That way, your handlers will work only if you want them to. Just be careful, because setCenter() will
  change the center, but not the zoom, if it's called when zooming is disabled.

*/

GMap2.prototype.disableZooming = function() {
  this.__disableZoomingZoomLevel = this.getZoom();
  this.__disableZoomingListener = GEvent.addListener(this,'zoomend',function(){
    if(typeof(this.__disableZoomingZoomLevel) != 'undefined')
      this.setZoom(this.__disableZoomingZoomLevel);
  });
};

GMap2.prototype.enableZooming = function() {
  delete this.__disableZoomingZoomLevel;
  if(typeof(this.__disableZoomingListener) == 'object')
    GEvent.removeListener(this.__disableZoomingListener);
  delete this.__disableZoomingListener;
};

GMap2.prototype.zoomingEnabled = function() {
  return typeof(this.__disableZoomingListener) == 'undefined';
};

