/////////////////////////////////////////////////////////////////////////////////////////////////////////
  $(document).ready(function(){ 
        $(document).pngFix(); 
    }); 
  

$(document).ready(function() {

	$("a.group").fancybox({
		'zoomSpeedIn':	600, 
		'zoomSpeedOut':	600, 
		'overlayShow':	true,
		'overlayOpacity': 0.8,
		'zoomOpacity': true,
		'callbackOnStart': function() {
			$('embed, object, select').css('visibility', 'hidden');
		},
		'callbackOnClose': function() {
			$('embed, object, select').css('visibility', 'visible');
		}
	});
			 
	//////////////////////////////////////////////////////		 
		 
	$(function(){	
		$('.menu').hover(
			function() {
				$(this) .animate( { 	marginLeft: "3px",	fontSize: "13px"}, 300 );
			},
			function() {
				$(this) .animate( { marginLeft: "0px",fontSize: "12px"}, 300 );
			});  
	});
	  
	  $("a.single_image").fancybox({
		   'zoomSpeedIn':	600, 
		   'zoomSpeedOut':	600, 
		   'overlayShow':	true,
		   'overlayOpacity': 0.6,
		   'zoomOpacity': true,
		   'callbackOnStart': function() {
				$('embed, object, select').css('visibility', 'hidden');
		   },
		   'callbackOnClose': function() {
				$('embed, object, select').css('visibility', 'visible');
		   }
	  });		  
		
	 try {
		$(".lupita").hover(function(){
			$(".lupita img")
			.animate({top:"-10px"}, 200).animate({top:"-4px"}, 200) // first jump
			.animate({top:"-7px"}, 100).animate({top:"-4px"}, 100) // second jump
			.animate({top:"-6px"}, 100).animate({top:"-4px"}, 100);// the last jump
			
		});
	} catch(err) {}
		
	 
 });

/////////////////////////////////////////////////////////////////////////////////////////////////////////

function isIE6()
{
	
	if (typeof document.body.style.maxHeight != "undefined") 
	{
		return false;
	} 
	else 
	{
		return true;
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////

function oculta_boton_buscar()
{
	if (isIE6() == false)
	{		
		$("#imagen_lupa").hide("slow");
		$("#loading").show("slow");
	}
	
	
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////
$(function(){	
		$('.menu').hover(function()
		{	
	
	$(this) .animate( { 
	marginLeft: "3px",
	fontSize: "13px"}, 300 );
	}, function(){
		$(this) .animate( { marginLeft: "0px",fontSize: "12px"
		  }, 300 );
        });  
    });
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
function enviar_formulario_reserva_salon()
{
	// Comprovamos campos obligatorios
	if (($("#reserv_salon_nombre").val() != '') && ($("#reserv_salon_apellidos").val() != '') &&
		($("#reserv_salon_telefono").val() != '') && ($("#reserv_salon_email").val() != ''))
	{
		if ($('#reserv_salon_perfil').val() != "0")
		{
			$("#formulario_reserv_salon").submit();

		}
		else
		{
			alert($("#error_escoja_perfil").val());
		}
	}
	else
	{
		alert($("#error_campos_oblig").val());
	}

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////
function enviar_formulario_reserva_restaurante()
{
	// Comprovamos campos obligatorios
	if (($("#reserva_restaurante_nombre").val() != '') && ($("#reserva_restaurante_apellidos").val() != '') &&
		($("#reserva_restaurante_telefono").val() != '') && ($("#reserva_restaurante_email").val() != ''))
	{
		if (validarFecha())
		{
			$("#formulario_reserva_restaurante").submit();
		}
	}
	else
	{
		alert($("#error_campos_oblig").val());
	}
}

function validarFecha()
{
	var dia = $("#reserva_restaurante_dia").val()
	var mes = $("#reserva_restaurante_mes").val()
	var anyo = $("#reserva_restaurante_ano").val()

    var hoy = new Date();
    var fecha = new Date(anyo, mes-1, dia);
    if ((mes == "2" && dia > 28)
     || (mes == "4" && dia > 30)
     || (mes == "6" && dia > 30)
     || (mes == "9" && dia > 30)
     || (mes == "11" && dia > 30)
     || (fecha.getTime() < hoy.getTime()))
    {
      alert($("#error_fecha_no_valida").val());
    }
    else
    {
      return true;
    }
    return false;
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 function comprueba_email_newsletter()
 {
	 if (($("#newsletter_email").val() != '') && validarEmail($("#newsletter_email").val()))
	 {
		 $("#newsletterV2").submit();
	 }
	 else
	 {
		 alert($("#newsletterV2_no_mail").val());
	 }
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
function validarEmail(valor) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
	return (true)
} else {
return (false);
}
}