// JavaScript Document
if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/Android/i)) || (navigator.userAgent.match(/Windows Phone/i))|| (navigator.userAgent.match(/blackberry/i))) { 
		if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "http://www.hotelnoailles.mobi/fr/"; 
	}
function showmenuhaut(id){
	if(!$("#Idulmenu").hasClass(id)){
		$("#"+id+"haut").stop(true,true);
		$("#"+id+"haut").animate( { color:"#FFFFFF" }, 200);
	}
}

function hidemenuhaut(id){
	if(!$("#Idulmenu").hasClass(id)){
		$("#"+id+"haut").stop(true,true);	
		$("#"+id+"haut").animate({ color:"#9C9E9F" }, 200);
	}
}
	
$(document).ready(function() {
					
	$('#Nivoslider').nivoSlider({
		effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
		slices:45,
		animSpeed:500,
		pauseTime:4000,
		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
	});
	
	$('.ajax').live('click', function(){
		$(".ajax-loading").stop(true, true).fadeIn();
		$('ul[rel=ulpdb]').removeClass().addClass($(this).attr('class'));
		$.get($(this).attr('rel'),{},function(data){
			$('.contenupdb').empty().append(data);
			$(".ajax-loading").stop(true, true).fadeOut();
		});
		return false;
	});
	
	$("a[rel=languages]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#000',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$("a[rel=carte]").fancybox({
		'overlayOpacity'	: 0.9,
		'overlayColor'		: '#000',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$("a[rel=googlemaps]").fancybox({
		'width'				: '75%',
		'height'			: '75%',
        'autoScale'     	: false,
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	function formatTitle1(title, currentArray, currentIndex, currentOpts) {
		return'<div class="boxfancyconteneur"><table><tr><td valign="middle" align="center"><h2>' + chambreStd + '</h2></td><td align="left"><p>'+title+'</p></td><td><a href="http://hotel.reservit.com/reservit/reserhotel.php?id=2&action=resa&hotelid=5713&roomtcode=23437&lang=' + lang + '" target="_blank" class="btreservation">' + name + '</a></td></tr></table></div>';
	}

	$("a[rel=standard]").fancybox({
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titleFormat'		: formatTitle1,
		'titlePosition' 	: 'inside',
		'titleShow'			: true, 
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9	
	});
	
	function formatTitle2(title, currentArray, currentIndex, currentOpts) {
		return'<div class="boxfancyconteneur"><table><tr><td valign="middle" align="center"><h2>' + chambreSup + '</h2></td><td align="left"><p>'+title+'</p></td><td><a href="http://hotel.reservit.com/reservit/reserhotel.php?id=2&action=resa&hotelid=5713&roomtcode=34931&lang=' + lang + '" target="_blank" class="btreservation">' + name + '</a></td></tr></table></div>';
	}

	$("a[rel=superieure]").fancybox({
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titleFormat'		: formatTitle2,
		'titlePosition' 	: 'inside',
		'titleShow'			: true, 
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9	
	});
	
	function formatTitle3(title, currentArray, currentIndex, currentOpts) {
		return'<div class="boxfancyconteneur"><table><tr><td valign="middle" align="center"><h2>' + chambreDel + '</h2></td><td align="left"><p>'+title+'</p></td><td><a href="http://hotel.reservit.com/reservit/reserhotel.php?id=2&action=resa&hotelid=5713&roomtcode=34932&lang=' + lang + '" target="_blank" class="btreservation">' + name + '</a></td></tr></table></div>';
	}

	$("a[rel=deluxe]").fancybox({
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titleFormat'		: formatTitle3,
		'titlePosition' 	: 'inside',
		'titleShow'			: true, 
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9	
	});
	
	function formatTitle4(title, currentArray, currentIndex, currentOpts) {
		return'<div class="boxfancyconteneur"><table><tr><td valign="middle" align="center"><h2>' + chambreJun + '</h2></td><td align="left"><p>'+title+'</p></td><td><a href="http://hotel.reservit.com/reservit/reserhotel.php?id=2&action=resa&hotelid=5713&roomtcode=106554&lang=' + lang + '" target="_blank" class="btreservation">' + name + '</a></td></tr></table></div>';
	}

	$("a[rel=juniorsuite]").fancybox({
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titleFormat'		: formatTitle4,
		'titlePosition' 	: 'inside',
		'titleShow'			: true, 
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9	
	});
	
	$("a[rel=galerie1]").fancybox({
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9	
	});
	
	$("a[rel=galerie2]").fancybox({
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9	
	});
	
	$("a[rel=galerie3]").fancybox({
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9	
	});
	
	$("a[rel=galerie4]").fancybox({
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9	
	});
	
});	
