$(document).ready(function(){	

	$(".fancybox").fancybox();


	$(function(){
		$("img.menu")
			.mouseover(function(){
				var src = $(this).attr("src").match(/[^\.]+/) + "_over.gif";
				$(this).attr("src",src);
			})
			.mouseout(function(){
				var src = $(this).attr("src").replace("_over","");
				$(this).attr("src",src);
			});
	});

	/*======== SUSCRIPCIÓN NEWSLETTER ========*/
	
	// Esta primera parte crea un loader no es necesaria
	$().ajaxStart(function() {
		$('#loading').show();
		$('#nlmsg').hide();
	}).ajaxStop(function() {
		$('#loading').hide();
		$('#nlmsg').fadeIn('slow');
	});
	
	// Interceptamos el evento submit
	$('#suscription').submit(function() {
		// Enviamos el formulario usando AJAX
		$.ajax({
			type: 'POST',
			url: $(this).attr('action'),
			data: $(this).serialize(),
			// Mostramos un mensaje con la respuesta de PHP
			success: function(data) {
				$('#nlmsg').html('<span style="color:#ebb811">'+data+'</span>');
			}
		})
		return false;
	})
});
