// JavaScript Document

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

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

$(document).ready(function() {
	
	$.fancybox({
		'href'	: "FileMMedia/File/Francais/Promotions.txt"
	});

	
	// Grandes images		
	$("a#imgp01").wrapInner(document.createElement("span"));
      $("a#imgp01 span").css("opacity","0");

	
      $("a#imgp01 span").hover(function () {
			// animate opacity to full
			$(this).stop().animate({
				 opacity: 1
			}, "fast");
		},
		 function () {
			$(this).stop().animate({
				 opacity: 0
			}, "slow");
		});
	  
	  $("a#imgp02").wrapInner(document.createElement("span"));
      $("a#imgp02 span").css("opacity","0");

	
      $("a#imgp02 span").hover(function () {
			// animate opacity to full
			$(this).stop().animate({
				 opacity: 1
			}, "fast");
		},
		 function () {
			$(this).stop().animate({
				 opacity: 0
			}, "slow");
		});
	  
	  $("a#imgp03").wrapInner(document.createElement("span"));
      $("a#imgp03 span").css("opacity","0");

	
      $("a#imgp03 span").hover(function () {
			// animate opacity to full
			$(this).stop().animate({
				 opacity: 1
			}, "fast");
		},
		 function () {
			$(this).stop().animate({
				 opacity: 0
			}, "slow");
		});
		
	$("a#imgp04").wrapInner(document.createElement("span"));
      $("a#imgp04 span").css("opacity","0");

	
      $("a#imgp04 span").hover(function () {
			// animate opacity to full
			$(this).stop().animate({
				 opacity: 1
			}, "fast");
		},
		 function () {
			$(this).stop().animate({
				 opacity: 0
			}, "slow");
		});
		
	$("a#imgp05").wrapInner(document.createElement("span"));
      $("a#imgp05 span").css("opacity","0");

	
      $("a#imgp05 span").hover(function () {
			// animate opacity to full
			$(this).stop().animate({
				 opacity: 1
			}, "fast");
		},
		 function () {
			$(this).stop().animate({
				 opacity: 0
			}, "slow");
		});
		
	$('.ajax').live('click', function(){
		$(".ajax-loading").stop(true, true).fadeIn();
		$.get($(this).attr('rel'),{},function(data){
			$('.contenuajax').empty().append(data);
			$(".ajax-loading").stop(true, true).fadeOut();
		});
		return false;
	});	

	$('#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
	});

	$("#"+$("#Idulmenu").attr("title")).addClass("current");					   
						   
	$(function() {
		if($("#Idulmenu").attr("title")=="Lhotel" || $("#Idulmenu").attr("title")=="Hotel"){
			nbitem=0;	   
		}else if($("#Idulmenu").attr("title")=="Chambres" || $("#Idulmenu").attr("title")=="Rooms"){
			nbitem=1;
		}else if($("#Idulmenu").attr("title")=="Reservation" || $("#Idulmenu").attr("title")=="Booking"){
			nbitem=2;
		}else if($("#Idulmenu").attr("title")=="Restaurant-bar" || $("#Idulmenu").attr("title")=="Restaurant-bar"){
			nbitem=3;
		}else if($("#Idulmenu").attr("title")=="Espace-bien-etre" || $("#Idulmenu").attr("title")=="Relaxation-area"){
			nbitem=4;
		}else if($("#Idulmenu").attr("title")=="Seminaires-et-groupes" || $("#Idulmenu").attr("title")=="Seminars-and-groups"){
			nbitem=5;
		}else if($("#Idulmenu").attr("title")=="Environs" || $("#Idulmenu").attr("title")=="Surroundings"){
			nbitem=6;	
		}else if($("#Idulmenu").attr("title")=="Actualites" || $("#Idulmenu").attr("title")=="News"){
			nbitem=7;
		}else if($("#Idulmenu").attr("title")=="Contact-et-acces" || $("#Idulmenu").attr("title")=="Contact-and-access"){
			nbitem=8;		
		}else{
			nbitem=0;
		}   
		$("#Idulmenu").lavaLamp({
			fx: "easeOutBack",
			speed: 800,
			startItem: nbitem
		});
	});
	
	$("a[rel=galerie1]").fancybox({
		'overlayOpacity'	: 0.7,
		'overlayColor'		: '#000',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'titlePosition' 	: 'over'
	});
	
	$("a[rel=promotions]").fancybox({
		'overlayOpacity'	: 0.7,
		'overlayColor'		: '#000',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$("a[rel=promotions2]").fancybox({
		'overlayOpacity'	: 0.7,
		'overlayColor'		: '#000',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$("a[rel=googlemaps]").fancybox({
		'overlayOpacity'	: 0.7,
		'overlayColor'		: '#000',
		'width'				: '75%',
		'height'			: '75%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
});	
