function gRegionZoomControl(){}
gRegionZoomControl.prototype = new GControl(false,true);
gRegionZoomControl.prototype.initialize = function(map)
{
	this.map = map;
	
	this.control = new Element('div');
	this.control.id = 'ZoomControls';
	
	//Ya se asignaron
	//this.zoomOutLevels = markerManager.zoomOutLevels;
	this.zoomCoordinates = [];
	
	this.controls = [];
	this.regions = ['World','Country','Zone','City'];
	
	this.regions.each(this._createControl.bind(this));
	//for(var i=0;i<this.regions.length;i++)
	//{this._createControl.call(this,this.regions[i],i);}
	
	map.getContainer().appendChild(this.control);
	GEvent.addListener(this.map,'zoomend',this.onZoomChanged.bind(this));
	//this.checkControlVisibility(this.map.getZoom());
	setTimeout(this.checkControlVisibility.bind(this,map.getZoom()),1000);
	
	return this.control;
}
gRegionZoomControl.prototype.setZoomOutLevels = function(zoomOutLevels)
{	this.zoomOutLevels = zoomOutLevels;	}
gRegionZoomControl.prototype.onZoomChanged = function(oldZoom,newZoom)
{	this.checkControlVisibility(newZoom);	}
gRegionZoomControl.prototype.checkControlVisibility = function(Zoom)
{
	for(var x=this.regions.length-1; x>=0; x--)
	{
		if(Zoom >= this.zoomOutLevels[this.regions[x]])
		{
			//Estamos en this.regions[x], mostramos la anterior y la siguiente, si existen
			var regionsToShow = $A();
			if(x>0){	regionsToShow.push(this.regions[x-1]);}
			if(x+1<this.regions.length){	regionsToShow.push(this.regions[x+1]);}
			var regionsToHide = this.regions.without.apply(this.regions,regionsToShow);
			regionsToHide.each(this.hide.bind(this));
			regionsToShow.each(this.show.bind(this));
			break;
		}
	}
}
gRegionZoomControl.prototype.updateRegion = function(Region,Name,LatLng)
{
	this.zoomCoordinates[Region] = LatLng;
	this.controls[Region].innerHTML = Name;
}
gRegionZoomControl.prototype._createControl = function(Region,Index)
{
	this.controls[Region] = new Element('a',{'style':'margin:5px; padding:2px 5px;background-color:#333;color:#f90;text-decoration:none;display:none;'}).update().writeAttribute('href','#'+this.map.getContainer().id).writeAttribute('id','zoomcontrol_'+Region);
	this.control.appendChild(this.controls[Region]);
	Event.observe(this.controls[Region],'click',this.zoomOut.bind(this,Region));
}
gRegionZoomControl.prototype.getDefaultPosition = function()
{	return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(10,10));	}
gRegionZoomControl.prototype.show = function(Region)
{
	if(this.controls[Region].innerHTML != "")	Effect.Appear(this.controls[Region]);
	else														this.hide(Region);
}
gRegionZoomControl.prototype.hide = function(Region)
{	Effect.Fade(this.controls[Region]);	}
gRegionZoomControl.prototype.zoomOut = function(Region)
{
	if(typeof this.zoomCoordinates[Region] != "undefined")
	{	this.map.setCenter(this.zoomCoordinates[Region],this.zoomOutLevels[Region]);	}
	else
	{	this.map.setZoom(this.zoomOutLevels[Region]);	}
}