// JavaScript Document

function showmenuhaut(id){
	if(!$("#Idulmenu").hasClass(id)){
		$("#"+id+"haut").stop(true,true);
		$("#"+id+"haut").animate( { color:"#9B0E59" }, 200);
	}
}

function hidemenuhaut(id){
	if(!$("#Idulmenu").hasClass(id)){
		$("#"+id+"haut").stop(true,true);	
		$("#"+id+"haut").animate({ color:"#707173" }, 200);
	}
}

$(function(){
	
	$('.nivoslider').nivoSlider({
		effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
		slices:45,
		animSpeed:500,
		pauseTime:8000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false //Force manual transitions
	});
	
	var dates = $( "#c_arrivaldate, #c_departuredate" ).datepicker({
		minDate: 0,
		numberOfMonths: 1,
		onSelect: function( selectedDate ) {
			var option = this.id == "c_arrivaldate" ? "minDate" : "maxDate",
				instance = $( this ).data( "datepicker" ),
				date = $.datepicker.parseDate(
					instance.settings.dateFormat ||
					$.datepicker._defaults.dateFormat,
					selectedDate, instance.settings );
			dates.not( this ).datepicker( "option", option, date );
		}
	});
	
	$(".formminibooking").submit(function() {
		datedarrivee = $("#c_arrivaldate").datepicker( "getDate" );
		datededepart = $("#c_departuredate").datepicker( "getDate" );
		datedifference = datededepart - datedarrivee;
		if(datedarrivee.getMonth()+1<10){
			moisaafficher = "0"+(datedarrivee.getMonth()+1);	
		}else{
			moisaafficher = (datedarrivee.getMonth()+1);
		}
		dateavailpro = datedarrivee.getFullYear()+"-"+moisaafficher+"-"+datedarrivee.getDate();
		$('#AVP_arrivalDate').val(dateavailpro);
		if((datedifference/86400000)<1){
			$('#AVP_nights').val(1);
		}else{
			$('#AVP_nights').val(datedifference/86400000);
		}
		return true;
	});
	
	$("a[rel=diapo_classique]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#646263',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	$("a[rel=diapo_superieure]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#646263',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	$("a[rel=diapo_deluxe]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#646263',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	$("a[rel=diapo_triple]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#646263',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$("a[rel=DiapoHotel]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#646263',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	$("a[rel=DiapoChambres]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#646263',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	$("a[rel=DiapoServices]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#646263',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	$("a[rel=carte]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#646263',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$('.selecter').mobilyselect({
		collection: 'hotel',
		animation: 'fade',
		duration: 300,
		listClass: 'selecterContent',
		btnsClass: 'selecterBtns',
		btnActiveClass: 'active',
		elements: 'li',
		onChange: function(){},
		onComplete: function(){}
	});
	
	$("a[rel=googlemaps]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#646263',
		'width'				: '75%',
		'height'			: '75%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});

	
});	
