/**
 * @name ExtLargeMapControl
 * @version 1.0
 * @author Masashi, Bjorn Brala
 * @fileoverview Creates a control with buttons to pan in four directions,
 * and zoom in and zoom out, and a zoom slider. The UI is based on the 
 * LargeMapControl from Google Maps (circa December 2008), but it does not
 * have any integration with Street View.
 */

 

/*global GKeyboardHandler, GDraggableObject*/

/**
 * @desc Creates an ExtLargeMapControl. No configuration options are available.
 *
 * @constructor
 */    
function ExtLargeMapControl(mapWidth) {
  if (mapWidth > 841)
	mapWidthmapWidth = 841;
  this.mapWidth = mapWidth;
  this.imgSrc = "./images/maixonmapcontrols.png";
  this.imgWidth = "841px";
  this.imgHeight = "108px";
}


/**
 * @private
 */
ExtLargeMapControl.prototype = new GControl();


/**
 * @private
 * @type GMap2
 */
ExtLargeMapControl.prototype._map = null;


/**
 * @private
 * @type Element
 */
ExtLargeMapControl.prototype._container = null;


/**
 * @private
 * @type Element
 */
ExtLargeMapControl.prototype._slider = null;


/**
 * @private
 * @type GKeyboardHandler 
 */
ExtLargeMapControl.prototype._keyboardhandler = null;


/**
 * @desc Initialize the map control
 * @private
 */
ExtLargeMapControl.prototype.initialize = function (map) {
  ExtLargeMapControl.prototype._map = map;

  var _handleList = {};
  
  this._keyboardhandler = new GKeyboardHandler(map);
  var agt = navigator.userAgent.toLowerCase();
  
  this._is_ie    = ((agt.indexOf("msie") !== -1) && (agt.indexOf("opera") === -1));
  this._is_gecko = (agt.indexOf('gecko') !== -1);
  this._is_opera = (agt.indexOf("opera") !== -1);

  //common image
  var commonImg = new Image();
  commonImg.src = this.imgSrc;

  // calculation of controller size
  var currentMapType = map.getCurrentMapType();
  var minZoom = parseInt(currentMapType.getMinimumResolution(), 10);
  var maxZoom = 0;
  var maptypes = map.getMapTypes();  
  for (var i = 0; i < maptypes.length; i++) {
    if (maptypes[i].getMaximumResolution() > maxZoom) {
      maxZoom = maptypes[i].getMaximumResolution();
    }
  }
  ExtLargeMapControl.prototype._maxZoom = parseInt(maxZoom, 10);
  var ctrlHeight = 36; 

  // create container  
  var container = document.createElement("div");
  container.style.width = (this.mapWidth+1) + "px";
  container.style.height = ctrlHeight + "px"; 
  container.style.overflow = "hidden";
  container.style.padding = "0";
  container.style.MozUserSelect = "none";
  container.style.textAlign = "left";
  _handleList.container = container;
  ExtLargeMapControl.prototype._container = container;

  //image load
  var imgContainer = document.createElement("div");
  imgContainer.style.left = "0px";
  imgContainer.style.top = "0px";
  imgContainer.style.width = this.imgWidth;
  imgContainer.style.height = this.imgHeight;
  imgContainer.style.overflow = "hidden";
  if (this._is_ie) {
    imgContainer.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
  }
  container.appendChild(imgContainer); 

  if (!this._is_ie) {
    var baseImg = commonImg.cloneNode(false);
    baseImg.style.position = "absolute";
    baseImg.style.left = "0px";
    baseImg.style.top = "0px";
    baseImg.style.width = this.imgWidth;
    baseImg.style.height = this.imgHeight;
    imgContainer.appendChild(baseImg);
  }

	var zoomLevel7 = document.createElement("div");
	//zoomLevel7.style.border = "thin solid #0000FF";
	zoomLevel7.style.position  = "absolute";
	zoomLevel7.style.left = "54px";
	zoomLevel7.style.top = "10px";
	zoomLevel7.style.width = "4px";
	zoomLevel7.style.height = "16px";
	zoomLevel7.style.overflow = "hidden";
	zoomLevel7.style.cursor = "pointer";
	container.appendChild(zoomLevel7); 
	_handleList.zoomLevel7 = zoomLevel7;
	GEvent.addDomListener(_handleList.zoomLevel7, "click", 
	GEvent.callbackArgs(this, this._eventZoomLevel,7));
	
	if (this._is_ie) {
		var imgZoomLevel7 = document.createElement("div");
		imgZoomLevel7.style.position = "relative";
		imgZoomLevel7.style.left = "-54px";
		imgZoomLevel7.style.top = "-10px";
		imgZoomLevel7.style.width = this.imgWidth;
		imgZoomLevel7.style.height = this.imgHeight;
		imgZoomLevel7.style.overflow = "hidden";
		imgZoomLevel7.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		zoomLevel7.appendChild(imgZoomLevel7);
		this._imgZoomLevel7 = imgZoomLevel7;
	} else {
		var imgZoomLevel7 = commonImg.cloneNode(false);
		//imgZoomLevel7.style.border = "thin solid #0000FF";
		imgZoomLevel7.style.position = "absolute";
		imgZoomLevel7.style.left = "-54px";
		imgZoomLevel7.style.top = "-10px";
		imgZoomLevel7.style.width = this.imgWidth;
		imgZoomLevel7.style.height = this.imgHeight;
		zoomLevel7.appendChild(imgZoomLevel7);
		this._imgZoomLevel7 = imgZoomLevel7;
	}

	var zoomLevel6 = document.createElement("div");
	//zoomLevel6.style.border = "thin solid #0000FF";
	zoomLevel6.style.position  = "absolute";
	zoomLevel6.style.left = "59px";
	zoomLevel6.style.top = "10px";
	zoomLevel6.style.width = "4px";
	zoomLevel6.style.height = "16px";
	zoomLevel6.style.overflow = "hidden";
	zoomLevel6.style.cursor = "pointer";
	container.appendChild(zoomLevel6); 
	_handleList.zoomLevel6 = zoomLevel6;
	GEvent.addDomListener(_handleList.zoomLevel6, "click", 
	GEvent.callbackArgs(this, this._eventZoomLevel,6));

	if (this._is_ie) {
		var imgZoomLevel6 = document.createElement("div");
		imgZoomLevel6.style.position = "relative";
		imgZoomLevel6.style.left = "-59px";
		imgZoomLevel6.style.top = "-10px";
		imgZoomLevel6.style.width = this.imgWidth;
		imgZoomLevel6.style.height = this.imgHeight;
		imgZoomLevel6.style.overflow = "hidden";
		imgZoomLevel6.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		zoomLevel6.appendChild(imgZoomLevel6);
		this._imgZoomLevel6 = imgZoomLevel6;
	} else {
		var imgZoomLevel6 = commonImg.cloneNode(false);
		//imgZoomLevel7.style.border = "thin solid #0000FF";
		imgZoomLevel6.style.position = "absolute";
		imgZoomLevel6.style.left = "-59px";
		imgZoomLevel6.style.top = "-10px";
		imgZoomLevel6.style.width = this.imgWidth;
		imgZoomLevel6.style.height = this.imgHeight;
		zoomLevel6.appendChild(imgZoomLevel6);
		this._imgZoomLevel6 = imgZoomLevel6;
	}

	var zoomLevel5 = document.createElement("div");
	//zoomLevel5.style.border = "thin solid #0000FF";
	zoomLevel5.style.position  = "absolute";
	zoomLevel5.style.left = "64px";
	zoomLevel5.style.top = "10px";
	zoomLevel5.style.width = "4px";
	zoomLevel5.style.height = "16px";
	zoomLevel5.style.overflow = "hidden";
	zoomLevel5.style.cursor = "pointer";
	container.appendChild(zoomLevel5); 
	_handleList.zoomLevel5 = zoomLevel5;
	GEvent.addDomListener(_handleList.zoomLevel5, "click", 
	GEvent.callbackArgs(this, this._eventZoomLevel,5));

	if (this._is_ie) {
		var imgZoomLevel5 = document.createElement("div");
		imgZoomLevel5.style.position = "relative";
		imgZoomLevel5.style.left = "-64px";
		imgZoomLevel5.style.top = "-10px";
		imgZoomLevel5.style.width = this.imgWidth;
		imgZoomLevel5.style.height = this.imgHeight;
		imgZoomLevel5.style.overflow = "hidden";
		imgZoomLevel5.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		zoomLevel5.appendChild(imgZoomLevel5);
		this._imgZoomLevel5 = imgZoomLevel5;
	} else {
		var imgZoomLevel5 = commonImg.cloneNode(false);
		//imgZoomLevel7.style.border = "thin solid #0000FF";
		imgZoomLevel5.style.position = "absolute";
		imgZoomLevel5.style.left = "-64px";
		imgZoomLevel5.style.top = "-10px";
		imgZoomLevel5.style.width = this.imgWidth;
		imgZoomLevel5.style.height = this.imgHeight;
		zoomLevel5.appendChild(imgZoomLevel5);
		this._imgZoomLevel5 = imgZoomLevel5;
	}
	
	var zoomLevel4 = document.createElement("div");
	//zoomLevel4.style.border = "thin solid #0000FF";
	zoomLevel4.style.position  = "absolute";
	zoomLevel4.style.left = "69px";
	zoomLevel4.style.top = "10px";
	zoomLevel4.style.width = "4px";
	zoomLevel4.style.height = "16px";
	zoomLevel4.style.overflow = "hidden";
	zoomLevel4.style.cursor = "pointer";
	container.appendChild(zoomLevel4); 
	_handleList.zoomLevel4 = zoomLevel4;
	GEvent.addDomListener(_handleList.zoomLevel4, "click", 
	GEvent.callbackArgs(this, this._eventZoomLevel,4));

	if (this._is_ie) {
		var imgZoomLevel4 = document.createElement("div");
		imgZoomLevel4.style.position = "relative";
		imgZoomLevel4.style.left = "-69px";
		imgZoomLevel4.style.top = "-9px";
		imgZoomLevel4.style.width = this.imgWidth;
		imgZoomLevel4.style.height = this.imgHeight;
		imgZoomLevel4.style.overflow = "hidden";
		imgZoomLevel4.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		zoomLevel4.appendChild(imgZoomLevel4);
		this._imgZoomLevel4 = imgZoomLevel4;
	} else {
		var imgZoomLevel4 = commonImg.cloneNode(false);
		//imgZoomLevel7.style.border = "thin solid #0000FF";
		imgZoomLevel4.style.position = "absolute";
		imgZoomLevel4.style.left = "-69px";
		imgZoomLevel4.style.top = "-9px";
		imgZoomLevel4.style.width = this.imgWidth;
		imgZoomLevel4.style.height = this.imgHeight;
		zoomLevel4.appendChild(imgZoomLevel4);
		this._imgZoomLevel4 = imgZoomLevel4;
	}
	
	var zoomLevel3 = document.createElement("div");
	//zoomLevel3.style.border = "thin solid #0000FF";
	zoomLevel3.style.position  = "absolute";
	zoomLevel3.style.left = "74px";
	zoomLevel3.style.top = "10px";
	zoomLevel3.style.width = "4px";
	zoomLevel3.style.height = "16px";
	zoomLevel3.style.overflow = "hidden";
	zoomLevel3.style.cursor = "pointer";
	container.appendChild(zoomLevel3); 
	_handleList.zoomLevel3 = zoomLevel3;
	GEvent.addDomListener(_handleList.zoomLevel3, "click", 
	GEvent.callbackArgs(this, this._eventZoomLevel,3));

	if (this._is_ie) {
		var imgZoomLevel3 = document.createElement("div");
		imgZoomLevel3.style.position = "relative";
		imgZoomLevel3.style.left = "-74px";
		imgZoomLevel3.style.top = "-10px";
		imgZoomLevel3.style.width = this.imgWidth;
		imgZoomLevel3.style.height = this.imgHeight;
		imgZoomLevel3.style.overflow = "hidden";
		imgZoomLevel3.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		zoomLevel3.appendChild(imgZoomLevel3);
		this._imgZoomLevel3 = imgZoomLevel3;
	} else {
		var imgZoomLevel3 = commonImg.cloneNode(false);
		//imgZoomLevel7.style.border = "thin solid #0000FF";
		imgZoomLevel3.style.position = "absolute";
		imgZoomLevel3.style.left = "-74px";
		imgZoomLevel3.style.top = "-10px";
		imgZoomLevel3.style.width = this.imgWidth;
		imgZoomLevel3.style.height = this.imgHeight;
		zoomLevel3.appendChild(imgZoomLevel3);
		this._imgZoomLevel3 = imgZoomLevel3;
	}
	
	var zoomLevel2 = document.createElement("div");
	//zoomLevel2.style.border = "thin solid #0000FF";
	zoomLevel2.style.position  = "absolute";
	zoomLevel2.style.left = "79px";
	zoomLevel2.style.top = "10px";
	zoomLevel2.style.width = "4px";
	zoomLevel2.style.height = "16px";
	zoomLevel2.style.overflow = "hidden";
	zoomLevel2.style.cursor = "pointer";
	container.appendChild(zoomLevel2); 
	_handleList.zoomLevel2 = zoomLevel2;
	GEvent.addDomListener(_handleList.zoomLevel2, "click", 
	GEvent.callbackArgs(this, this._eventZoomLevel,2));
  
	if (this._is_ie) {
		var imgZoomLevel2 = document.createElement("div");
		imgZoomLevel2.style.position = "relative";
		imgZoomLevel2.style.left = "-79px";
		imgZoomLevel2.style.top = "-10px";
		imgZoomLevel2.style.width = this.imgWidth;
		imgZoomLevel2.style.height = this.imgHeight;
		imgZoomLevel2.style.overflow = "hidden";
		imgZoomLevel2.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		zoomLevel2.appendChild(imgZoomLevel2);
		this._imgZoomLevel2 = imgZoomLevel2;
	} else {
		var imgZoomLevel2 = commonImg.cloneNode(false);
		//imgZoomLevel7.style.border = "thin solid #0000FF";
		imgZoomLevel2.style.position = "absolute";
		imgZoomLevel2.style.left = "-79px";
		imgZoomLevel2.style.top = "-10px";
		imgZoomLevel2.style.width = this.imgWidth;
		imgZoomLevel2.style.height = this.imgHeight;
		zoomLevel2.appendChild(imgZoomLevel2);
		this._imgZoomLevel2 = imgZoomLevel2;
	}
	
	var zoomLevel1 = document.createElement("div");
	//zoomLevel1.style.border = "thin solid #0000FF";
	zoomLevel1.style.position  = "absolute";
	zoomLevel1.style.left = "84px";
	zoomLevel1.style.top = "10px";
	zoomLevel1.style.width = "4px";
	zoomLevel1.style.height = "16px";
	zoomLevel1.style.overflow = "hidden";
	zoomLevel1.style.cursor = "pointer";
	container.appendChild(zoomLevel1); 
	_handleList.zoomLevel1 = zoomLevel1;
	GEvent.addDomListener(_handleList.zoomLevel1, "click", 
	GEvent.callbackArgs(this, this._eventZoomLevel,1));
 
	if (this._is_ie) {
		var imgZoomLevel1 = document.createElement("div");
		imgZoomLevel1.style.position = "relative";
		imgZoomLevel1.style.left = "-84px";
		imgZoomLevel1.style.top = "-10px";
		imgZoomLevel1.style.width = this.imgWidth;
		imgZoomLevel1.style.height = this.imgHeight;
		imgZoomLevel1.style.overflow = "hidden";
		imgZoomLevel1.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		zoomLevel1.appendChild(imgZoomLevel1);
		this._imgZoomLevel1 = imgZoomLevel1;
	} else {
		var imgZoomLevel1 = commonImg.cloneNode(false);
		//imgZoomLevel7.style.border = "thin solid #0000FF";
		imgZoomLevel1.style.position = "absolute";
		imgZoomLevel1.style.left = "-84px";
		imgZoomLevel1.style.top = "-10px";
		imgZoomLevel1.style.width = this.imgWidth;
		imgZoomLevel1.style.height = this.imgHeight;
		zoomLevel1.appendChild(imgZoomLevel1);
		this._imgZoomLevel1 = imgZoomLevel1;
	}
	
	//zoomOut button
	var zoomOutBtn = document.createElement("div");
	//zoomOutBtn.style.border = "thin solid #0000FF";
	zoomOutBtn.style.position = "absolute";
	zoomOutBtn.style.left = 90 + "px";
	zoomOutBtn.style.top = 15 + "px";
	zoomOutBtn.style.width = "7px";
	zoomOutBtn.style.height = "7px";
	zoomOutBtn.style.cursor = "pointer";
	zoomOutBtn.style.overflow = "hidden";
	zoomOutBtn.title = "zoom out";
	container.appendChild(zoomOutBtn); 
	_handleList.zoomOutBtn = zoomOutBtn;
	GEvent.addDomListener(_handleList.zoomOutBtn, "click", 
	GEvent.callback(this, this._eventZoomOut));

	//zoomIn button
	var zoomInBtn = document.createElement("div");
	//zoomInBtn.style.border = "thin solid #0000FF";
	zoomInBtn.style.position = "absolute";
	zoomInBtn.style.left = 42 + "px";
	zoomInBtn.style.top = 15 + "px";
	zoomInBtn.style.width = "7px";
	zoomInBtn.style.height = "7px";
	zoomInBtn.style.cursor = "pointer";
	zoomInBtn.style.overflow = "hidden";
	zoomInBtn.title = "zoom in";
	container.appendChild(zoomInBtn); 
	_handleList.zoomInBtn = zoomInBtn;
	GEvent.addDomListener(_handleList.zoomInBtn, "click", 
	GEvent.callback(this, this._eventZoomIn));

  // events
  /*
  GEvent.addDomListener(_handleList.topBtn, "click", 
      GEvent.callback(this, this._eventTop));
  GEvent.addDomListener(_handleList.leftBtn, "click", 
      GEvent.callback(this, this._eventLeft));
  GEvent.addDomListener(_handleList.rightBtn, "click", 
      GEvent.callback(this, this._eventRight));
  GEvent.addDomListener(_handleList.bottomBtn, "click", 
      GEvent.callback(this, this._eventBottom));
  GEvent.addDomListener(_handleList.homeBtn, "click", 
      GEvent.callback(this, this._eventHome));
  */
  /*
  GEvent.addDomListener(_handleList.slideBar, "click", 
      GEvent.callback(this, this._eventSlideBar));
  GEvent.addListener(map, "zoomend", 
      GEvent.callback(this, this._eventZoomEnd));
  */

	var mapaTipoMapaContainer = document.createElement("div");
	//mapaTipoMapaContainer.style.border = "thin solid #0000FF";
	mapaTipoMapaContainer.style.position = "absolute";
	mapaTipoMapaContainer.style.left = ((this.mapWidth) - 166) + "px";
	mapaTipoMapaContainer.style.top = "6px";
	mapaTipoMapaContainer.style.width = "50px";
	mapaTipoMapaContainer.style.height = "25px";
	mapaTipoMapaContainer.style.overflow = "hidden";
	container.appendChild(mapaTipoMapaContainer); 
	_handleList.mapaTipoMapa = mapaTipoMapaContainer;
	GEvent.addDomListener(_handleList.mapaTipoMapa, "click", 
	GEvent.callback(this, this._eventMapTypeMap));

	if (this._is_ie) {
		var imgMAPA = document.createElement("div");
		imgMAPA.style.position = "relative";
		imgMAPA.style.left = -((841 - 10) - 166) + "px";
		imgMAPA.style.top = -36 -36 - 6 + "px";
		imgMAPA.style.width = this.imgWidth;
		imgMAPA.style.height = this.imgHeight;
		imgMAPA.style.overflow = "hidden";
		imgMAPA.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		mapaTipoMapaContainer.appendChild(imgMAPA);
		this._imgMapType = imgMAPA;
	} else {
		var btnImgMAPA = commonImg.cloneNode(false);
		//btnImgMAPA.style.border = "thin solid #0000FF";
		btnImgMAPA.style.position = "absolute";
		btnImgMAPA.style.left = -((841 - 10) - 166) + "px";
		btnImgMAPA.style.top = -36 -36 - 6 + "px";
		btnImgMAPA.style.width = this.imgWidth;
		btnImgMAPA.style.height = this.imgHeight;
		mapaTipoMapaContainer.appendChild(btnImgMAPA);
		this._imgMapType = btnImgMAPA;
	}


	var mapaTipoSateliteContainer = document.createElement("div");
	//mapaTipoSateliteContainer.style.border = "thin solid #0000FF";
	mapaTipoSateliteContainer.style.position = "absolute";
	mapaTipoSateliteContainer.style.left = ((this.mapWidth) - 115) + "px";
	mapaTipoSateliteContainer.style.top = "6px";
	mapaTipoSateliteContainer.style.width = "60px";
	mapaTipoSateliteContainer.style.height = "25px";
	mapaTipoSateliteContainer.style.overflow = "hidden";
	container.appendChild(mapaTipoSateliteContainer); 

	_handleList.mapaTipoSatelite = mapaTipoSateliteContainer;
	GEvent.addDomListener(_handleList.mapaTipoSatelite, "click", 
	GEvent.callback(this, this._eventMapTypeSatellite));

	if (this._is_ie) {
		var imgSATELITE = document.createElement("div");
		imgSATELITE.style.position = "relative";
		imgSATELITE.style.left = -((841 - 10) - 115) + "px";
		imgSATELITE.style.top = -36 - 6 + "px";
		imgSATELITE.style.width = this.imgWidth;
		imgSATELITE.style.height = this.imgHeight;
		imgSATELITE.style.overflow = "hidden";
		imgSATELITE.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		mapaTipoSateliteContainer.appendChild(imgSATELITE);
		this._imgSatelliteType = imgSATELITE;
	} else {
		var btnImgSATELITE = commonImg.cloneNode(false);
		//btnImgSATELITE.style.border = "thin solid #0000FF";
		btnImgSATELITE.style.position = "absolute";
		btnImgSATELITE.style.left = -((841 - 10) - 115) + "px";
		btnImgSATELITE.style.top = -36 - 6 + "px";
		btnImgSATELITE.style.width = this.imgWidth;
		btnImgSATELITE.style.height = this.imgHeight;
		mapaTipoSateliteContainer.appendChild(btnImgSATELITE);
		this._imgSatelliteType = btnImgSATELITE;
	}  

	var mapaTipoHibridoContainer = document.createElement("div");
	//mapaTipoHibridoContainer.style.border = "thin solid #0000FF";
	mapaTipoHibridoContainer.style.position = "absolute";
	mapaTipoHibridoContainer.style.left = ((this.mapWidth) - 54) + "px";
	mapaTipoHibridoContainer.style.top = "6px";
	mapaTipoHibridoContainer.style.width = "52px";
	mapaTipoHibridoContainer.style.height = "25px";
	mapaTipoHibridoContainer.style.overflow = "hidden";
	container.appendChild(mapaTipoHibridoContainer); 

  	_handleList.mapaTipoHibrido = mapaTipoHibridoContainer;
	GEvent.addDomListener(_handleList.mapaTipoHibrido, "click", 
	GEvent.callback(this, this._eventMapTypeHybrid));

	if (this._is_ie) {
		var imgHIBRIDO = document.createElement("div");
		imgHIBRIDO.style.position = "relative";
		imgHIBRIDO.style.left = -((841 - 10) - 54) + "px";
		imgHIBRIDO.style.top = -36 - 6 + "px";
		imgHIBRIDO.style.width = this.imgWidth;
		imgHIBRIDO.style.height = this.imgHeight;
		imgHIBRIDO.style.overflow = "hidden";
		imgHIBRIDO.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.imgSrc + "')";
		mapaTipoHibridoContainer.appendChild(imgHIBRIDO);
		this._imgHybridType = imgHIBRIDO;
	} else {
		var btnImgHIBRIDO = commonImg.cloneNode(false);
		//btnImgHIBRIDO.style.border = "thin solid #0000FF";
		btnImgHIBRIDO.style.position = "absolute";
		btnImgHIBRIDO.style.left = -((841 - 10) - 54) + "px";
		btnImgHIBRIDO.style.top = -36 - 6 + "px";
		btnImgHIBRIDO.style.width = this.imgWidth;
		btnImgHIBRIDO.style.height = this.imgHeight;
		mapaTipoHibridoContainer.appendChild(btnImgHIBRIDO);
		this._imgHybridType = btnImgHIBRIDO;
	}  

	this._paintZoomLevel();
	map.getContainer().appendChild(container);

	return container;
};


/**
 * @private
 */
ExtLargeMapControl.prototype._eventMapTypeMap = function () {
  ExtLargeMapControl.prototype._map.setMapType(G_NORMAL_MAP);
  this._imgMapType.style.top = -36 -36 - 6 + "px";
  this._imgSatelliteType.style.top = -36 - 6 + "px";
  this._imgHybridType.style.top = -36 - 6 + "px";
};


/**
 * @private
 */
ExtLargeMapControl.prototype._eventMapTypeSatellite = function () {
  ExtLargeMapControl.prototype._map.setMapType(G_SATELLITE_MAP);
  this._imgMapType.style.top = -36 - 6 + "px";
  this._imgSatelliteType.style.top = -36 -36 - 6 + "px";
  this._imgHybridType.style.top = -36 - 6 + "px";
};
	
/**
 * @private
 */
ExtLargeMapControl.prototype._eventMapTypeHybrid = function () {
  ExtLargeMapControl.prototype._map.setMapType(G_HYBRID_MAP);
  this._imgMapType.style.top = -36 - 6 + "px";
  this._imgSatelliteType.style.top = -36 - 6 + "px";
  this._imgHybridType.style.top = -36 -36 - 6 + "px";
};
	
/**
 * @private
 */

ExtLargeMapControl.prototype._eventZoomLevel = function (level) {

	var map = this._map;
	var newzoom = map.getZoom();
  
	switch (level) {
		case 7:
			// 17 - 16
			newzoom = 17;
			break;
		case 6:
			// 15 - 14
			newzoom = 15;
			break;
		case 5:
			// 13 - 12
			newzoom = 13;
			break;
		case 4:
			// 11 - 10
			newzoom = 11;
			break;
		case 3:
			// 09 - 08
			newzoom = 9;
			break;
		case 2:
			// 07 - 06
			newzoom = 7;
			break;
		case 1:
			// 05 - 04
			newzoom = 5;
			break;
	}
  
  map.setZoom(newzoom);
  this._paintZoomLevel();
  
};

	
/**
 * @private
 */
ExtLargeMapControl.prototype._eventZoomOut = function () {
	var map = ExtLargeMapControl.prototype._map;
	map.zoomOut();
	this._paintZoomLevel();  
};

/**
 * @private
 */
ExtLargeMapControl.prototype._eventZoomIn = function () {
  ExtLargeMapControl.prototype._map.zoomIn();
  this._paintZoomLevel();
};


/**
  * @public
 */
ExtLargeMapControl.prototype._paintZoomLevel = function () {

	var zoomLevel = this._map.getZoom();
	var topOff = "-9px";
	var topOn = "-45px";

	this._imgZoomLevel7.style.top = topOff;
	this._imgZoomLevel6.style.top = topOff;
	this._imgZoomLevel5.style.top = topOff;
	this._imgZoomLevel4.style.top = topOff;
	this._imgZoomLevel3.style.top = topOff;
	this._imgZoomLevel2.style.top = topOff;
	this._imgZoomLevel1.style.top = topOff;
  
  switch (zoomLevel) {
	case 17:
	case 16:
		this._imgZoomLevel7.style.top = topOn;
		break;
	case 15:
	case 14:
		this._imgZoomLevel6.style.top = topOn;
		break;
	case 13:
	case 12:
		this._imgZoomLevel5.style.top = topOn;
		break;
	case 11:
	case 10:
		this._imgZoomLevel4.style.top = topOn;
		break;
	case 9:
	case 8:
		this._imgZoomLevel3.style.top = topOn;
		break;
	case 7:
	case 6:
		this._imgZoomLevel2.style.top = topOn;
		break;
	case 5:
	case 4:
		this._imgZoomLevel1.style.top = topOn;
		break;
	}
};


/**
 * @private
 */
ExtLargeMapControl.getElementStyle = function(targetElm, IEStyleProp, CSSStyleProp) {
  var elem = targetElm;
  if (elem.currentStyle) {
    return elem.currentStyle[IEStyleProp];
  } else if (window.getComputedStyle) {
    var compStyle = window.getComputedStyle(elem, "");
    return compStyle.getPropertyValue(CSSStyleProp);
  }
};

/**
 * @private
 */
ExtLargeMapControl.prototype._eventZoomEnd = function (oldZoom, newZoom) {
  var maxZoom = this._maxZoom;
  var step = this._step;
  this._slider.moveTo(new GPoint(0, (maxZoom - newZoom) * step));
};

/**
 * @private
 * @ignore
 */
ExtLargeMapControl.prototype.getDefaultPosition = function () {
  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(10, 10));
};

/**
 * @private
 * @ignore
 */
ExtLargeMapControl.prototype.selectable = function () {
  return false;
};

/**
 * @private
 * @ignore
 */
ExtLargeMapControl.prototype.printable = function () {
  return true;
};


