Shadowbox.init({
	animSequence: "wh",
	handleOversize: "resize",
	overlayColor: "#294F63",
	language: "es",
	players: ["img", "iframe"],
	counterType: "skip",
	counterLimit: "10",
	continuous: true,
	autoplayMovies: true,
	onClose: function(){ refrescar_cuaderno(); }
});

//<![CDATA[
	var map="";
	var datos_marcas = new Array(); // datos básicos de las distintas marcas de la ruta
	var marcas=[];//Marcas
	var contenido_bocadillo = []; //Contenido del bocadillo
	var punto=[]; //Puntos de polilinea 
	var count =0;
	var puntos_marcas=[]; //Matriz que contiene todos los puntos de las marcas
	//var temp_pto_marca=[]; //Matriz que contiene todos los puntos de las marcas
	var paddings = {top:100, right:250, left:60, bottom:80};
	var paddings_buzon = {top:250, right:280, left:30, bottom:80};
	
	var box = null;
	
	function show(){
	  markerBounds = new GLatLngBounds();
	  for(var i=0; i<marcas.length; i++){
		markerBounds.extend(marcas[i].getLatLng());
	  }
	 if(box) map.removeOverlay(box);
	 
	  box = map.showBounds(markerBounds, paddings).drawBox();
	  //Presenta en pantalla el rectangulo con los nuevos limites del dibujo
	  //map.addOverlay(box);
	}
	
	function show_buzon(){
	  markerBounds = new GLatLngBounds();
	  for(var i=0; i<marcas.length; i++){
		markerBounds.extend(marcas[i].getLatLng());
	  }
	 if(box) map.removeOverlay(box);
	 
	  box = map.showBounds(markerBounds, paddings_buzon).drawBox();
	  //Presenta en pantalla el rectangulo con los nuevos limites del dibujo
	  //map.addOverlay(box);
	}

	GMap2.prototype.showBounds = function(bounds_, opt_options){
	  var opts = opt_options||{};
	  opts.top = opt_options.top*1||0;
	  opts.left = opt_options.left*1||0;
	  opts.bottom = opt_options.bottom*1||0;
	  opts.right = opt_options.right*1||0;
	  opts.save = opt_options.save||true;
	  opts.disableSetCenter = opt_options.disableSetCenter||false;
	  var ty = this.getCurrentMapType();
	  var port = this.getSize();
	  if(!opts.disableSetCenter){
		var virtualPort = new GSize(port.width - opts.left - opts.right, 
								port.height - opts.top - opts.bottom);
		this.setZoom(ty.getBoundsZoomLevel(bounds_, virtualPort));
		var xOffs = (opts.left - opts.right)/2;
		var yOffs = (opts.top - opts.bottom)/2;
		var bPxCenter = this.fromLatLngToDivPixel(bounds_.getCenter());
		var newCenter = this.fromDivPixelToLatLng(new GPoint(bPxCenter.x-xOffs, bPxCenter.y-yOffs));
		this.setCenter(newCenter);
		if(opts.save)this.savePosition();
	  }
	  var portBounds = new GLatLngBounds();
	  portBounds.extend(this.fromContainerPixelToLatLng(new GPoint(opts.left, port.height-opts.bottom)));
	  portBounds.extend(this.fromContainerPixelToLatLng(new GPoint(port.width-opts.right, opts.top)));
	  return portBounds;
	}


	GLatLngBounds.prototype.drawBox = function(opt_options){
	  var opts = opt_options||{};
	  var northEast = this.getNorthEast();
	  var southWest = this.getSouthWest();
	  var topLat = northEast.lat();
	  var rightLng = northEast.lng();
	  var botLat = southWest.lat();
	  var leftLng = southWest.lng();
	  var pnts = [];
	  pnts.push(southWest);
	  pnts.push(new GLatLng(topLat,leftLng));
	  pnts.push(northEast);
	  pnts.push(new GLatLng(botLat,rightLng));
	  pnts.push(southWest);
	  var fillColor = opts.fillColor||opts.liColor||"#0055ff";
	  var liColor = opts.liColor||"#bb003b";
	  var liWidth = opts.liWidth||2;
	  if(opts.polygon){
		var boxPoly = new GPolygon(pnts,opts.liColor,liWidth,opts.liOpa,fillColor,opts.fillOpa);
	  }else{
		var boxPoly = new GPolyline(pnts,liColor,liWidth,opts.liOpa);
	  }
	  return boxPoly;
	}

	function abrirShadow(id, idguias){
		Shadowbox.open({
			player:     "iframe",
			content:    "descripcion_site.php?m=" + id + "&g=" + idguias,
			title: 		"",
			width:		820,
			height:		516
		});
	}
	function abrirShadow_guia(id,param){
		Shadowbox.open({
			player:     "iframe",
			content:    param +"_guia.php?g=" + id,
			title: 		"",
			width:		820,
			height:		516
		});
	}

	function abrirShadow_anadir(id,param){
		Shadowbox.open({
			player:     "iframe",
			content:    "anadir_" + param +".php?g=" + id,
			title: 		"",
			width:		820,
			height:		516
		});
	}
	
	$(document).ready(function() {
		$('#pasos_ruta').jScrollPane({scrollbarWidth:5});
		
		$('.enlace_punto').bind('click', function(e){
			e.preventDefault();
			abrirShadow(this.id.split('_')[1],this.id.split('_')[2]);
		});
		
		$('.enlace_ruta').bind('click', function(e){
			e.preventDefault();
			abrirShadow_guia(this.id.split('_')[1],this.id.split('_')[0]);
		});
		
		$('#capa_stop').css('display','none');
		$('#controljs').css('display','none');
	});
//]]>
