$(document).ready(function () {


	$('#fecha').datepicker({
		inline: true,
		dateFormat: 'd-m-yy',
		dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
		monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
		firstDay: 1,
		nextText: 'Siguiente',
		prevText: 'Anterior',
		currentText: 'Hoy',
		minDate:'+1d'
	});
				
  $('a.ver_mas,a.legal').facebox();
  
  $('.imagen_franquicia,.imagen_franquicia2').click(function(){
  	var imagen=$(this).attr('src').replace('/rsc/archivos/imagenes/m','');
  	$.facebox(function() { 
  		$.get('/rsc/archivos/imagenes/'+imagen ,function(){
		  	$.get('/ajax/imagen/'+imagen, function(data) {
		    	$.facebox(data);
		  	})
  		})
  	});

  });

  $('.promociones').click(function(){
  	var imagen=$(this).attr('href');
  	$.facebox(function() { 
  		$.get('/rsc/archivos/imagenes/'+imagen ,function(){
		  	$.get('/ajax/imagen/'+imagen, function(data) {
		    	$.facebox(data);
		  	})
  		})
  	});
		return false;
  });
	
});


var map = null;
var geocoder = null;

function initialize(address,address2) {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("google_map"));
		map.setUIToDefault();
		
		geocoder = new GClientGeocoder();
		
		if(showAddress(address))
		{
			showAddress(address2);
		}
	}
}

function showAddress(address) {
	if (geocoder) {
		geocoder.getLatLng(
			address,
			function(point) {
				if (!point) {
					return false;
				//map.setCenter(new GLatLng(38.346041, -0.484756), 13);
				//alert(address + " no encontrada");
				}else {
					map.setCenter(point, 13);
					var marker = new GMarker(point);
					map.addOverlay(marker);
					marker.openInfoWindowHtml(address);
					return true;
				}
			}
		);
	}
}
