$(document).ready(function() {
	$('#register_ok').hide();
	$("#txt_reserva1").hide();
	$("#txt_reserva2").hide();
    jQuery('#destacados').jcarousel({
        auto:5,
		animation:1000,
		visible:1,
		wrap:"both",
		scroll:1,
		itemLoadCallback: destacaPaginacion,
		initCallback: carruselPaginacion,
		buttonNextHTML:null,
		buttonPrevHTML:null,
    });
$("#form_menu_reserva").click(function(event) {
		$("#txt_reserva1").show();
		$("#txt_reserva2").show();
	});

	
	
	$().ajaxStart(function() {
	        $('#loading').show();
			$('#register').hide();
        
	}).ajaxStop(function() {
	    $('#loading').hide();
	    $('#register_ok').show();
	});
	
	$('#boletin').submit(function() {
	    $.ajax({
	        type: 'POST',
	        url: $(this).attr('action'),
	        data: $(this).serialize(),
	        success: function(data) {
				$('#register').hide();
			$('#register_ok').show();
			}
        })
        return false;
	  }); 
});

function carruselPaginacion(carousel) {
	
	//Paginación
    jQuery('#paginacion a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
		return false;
    });
	
	//Detiene el carrusel on Hover
	carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function destacaPaginacion(carousel, state)
{
	var estado = carousel.first;
	$("#paginacion a").css("background", "url(img/pg_off.png)");
	$("a[rel="+estado+"]").css("background", "url(img/pg_on.png)");
}
