$(document).ready(function(){

	// page horaires : li au survol
	$(".hor_saison").hover(
		function(){
			$(this).addClass("highlight");
		},
		function(){
			$(this).removeClass("highlight");
		}
	);
	
	// page horaires : toggle bloc horaire	
	$(".hor_saison").click(function(){
		$(this).next().slideToggle("normal");
		
		if ($(this).hasClass("hor_open")) {
			$(this).removeClass("hor_open");
		}
		else {
			$(this).addClass("hor_open");
		}
	

		if ($(this).children("div").hasClass("arrow_open")) {
			$(this).children("div").toggleClass("arrow_close");
		}
		else {
			$(this).children("div").removeClass("arrow_close");
			$(this).children("div").addClass("arrow_open");
		}
		
		return false;
	});

	// LIGHTBOX	
	$(function() {
		$('.col_carte a').lightBox({
			overlayBgColor: '#000',
			overlayOpacity: 0.6,
			imageLoading: 'images/lightbox/loading.gif',
			imageBtnClose: 'images/lightbox/close.gif',
			imageBtnPrev: 'images/lightbox/prev.gif',
			imageBtnNext: 'images/lightbox/next.gif',
			containerResizeSpeed: 350,
			txtImage: 'Imagem',
			txtOf: 'de'
		}); // Select all links in object with gallery ID


		
		// Use this example, or...
		//$('a[@rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel
		// This, or...
		//$('#carte a').lightBox(); // Select all links in object with gallery ID
		// This, or...
		//$('a.lightbox').lightBox(); // Select all links with lightbox class
		// This, or...
		//$('a').lightBox(); // Select all links in the page
		// ... The possibility are many. Use your creative or choose one in the examples above
});



	//DATEPICKER
	jQuery.datepicker.setDefaults(jQuery.datepicker.regional['fr']);
    jQuery("#maDate").mousedown(function(){
       	jQuery("#maDate").datepicker('change', {dateFormat: 'dd/mm/yy', firstDay:1 });
    });
	
	$(function() {
		$( "#maDate" ).datepicker({
			numberOfMonths: 2,
			showButtonPanel: true
		});
	});


	//HORAIRES : Montre / cache bouton validation port départ
	$(".portDepartListe").click(function(){
		$('.portDepartListe button').animate({ opacity: "hide" }, "fast");
		$(this).children(":button").animate({ opacity: "show" }, "slow");
		
		$('.portDepartListe input').removeAttr("checked", "checked"); // make checkbox or radio checked
		$(this).children(":input").attr("checked", "checked");

		
/*		$("#x").attr("disabled","disabled");
 // Enable #x
	 $("#x").removeAttr("disabled");*/


	});
	
	//HORAIRES : print
	$(".h_dialog").click(function(){
		//on ferme tous les horaires ouverts
		$('.dialog').hide("normal");
		$('.h_dialog').removeClass("h_heures_li_a_open");
		
		//on test le prochain hairaire : ouvre / ferme
		if( $(this).next(".dialog").is(":visible") ) {
		  // element is visible
		  $(this).next(".dialog").hide("fast");
		}
		else {
		  // element is not visible
		  $(this).next(".dialog").show("normal");
		  $(this).addClass("h_heures_li_a_open");
		}
	
		return false;
	});
	
	$(".h3_v3_h2").click(function(){
		//on ferme tous les horaires ouverts
		//$('.dialog').hide("normal");
		
		//on test le prochain horaire : ouvre / ferme
		if( $(this).next(".h_heures").is(":visible") ) {
		  // element is visible
		  $(this).next(".h_heures").addClass("hidden");
		}
		else {
		  // element is not visible
		  $(this).next(".h_heures").removeClass("hidden");
		}
		
		//on test le prochain horaire : ouvre / ferme
		if($(this).hasClass("h2_open")) {
		  $(this).removeClass("h2_open");
		}
		else {
		  $(this).addClass("h2_open");
		}
	
		return false;
	});
	
	$(".hor_control_horaires_close").click(function(){
		//	si tout est fermé on ouvre
		if ($('.h_heures').hasClass("hidden")) {
			$('.h_heures').removeClass("hidden");
			$(this).html("<a href='#'>Masquer tous les horaires</a>");
			$(".h3_v3_h2").addClass("h2_open");
			$(this).toggleClass("hor_control_horaires_open");
				
		} else {
			$('.h_heures').addClass("hidden");
			$(this).html("<a href='#'>Afficher tous les horaires</a>");
			$(".h3_v3_h2").removeClass("h2_open");
			$(this).toggleClass("hor_control_horaires_open");	
	
		}

		return false;
	});


	// Horaires : highlight les horaires de retour	
	$(".pair").hover(
		function(){
			$(this).addClass("h_outline");
		},
		function(){
			$(this).removeClass("h_outline");
		}
	);
	
	$(".impair").hover(
		function(){
			$(this).addClass("h_outline");
		},
		function(){
			$(this).removeClass("h_outline");
		}
	);
	
	// HORAIRES : 
	
	
	// page horaires : accordéon
	/*$(function() {
		$( "#mon_accordion" ).accordion();
	});

	$('.accordion .head').click(function() {
		$(this).next().toggle('slow');
		return false;
	}).next().hide();
	
	var accordion = $( "#mon_accordion" ).accordion({
        change: function(event, ui) {
            $("#haut").show()[0].scrollIntoView(true);
        }
    });*/
	

//end	
});

