$(document).ready(function(){


if (!$('body#sLocation').length) {

$('.slides').cycle({
	timeout: 4000,
	speed: 1000
});


/* ADDS ALL THE HALF DAY STYLES ===== */

$('.wp-availability-booked').each(function(i) {
	if($(this).is(':first-child') && ($(this).parent('tr').prev().find('td:last-child').not('.wp-availability-booked').length)) {
		$(this).addClass('wp-half-start');
	}
	if($(this).prev(':not(.wp-availability-booked)').length) {
		$(this).addClass('wp-half-start');
	}
	
	if($(this).is(':last-child') && ($(this).parent('tr').next().find('td:first-child').not('.wp-availability-booked').length)) {
		$(this).addClass('wp-half-end');
	}
	if($(this).next(':not(.wp-availability-booked)').length) {
		$(this).addClass('wp-half-end');
		
		if($(this).prev(':not(.wp-availability-booked)').length) {
			$(this).removeClass('wp-half-start').removeClass('wp-half-end');
		}
	}
	
});


$('.slides').mouseenter(function(){
		if(!$('.slides img:only-child').length) {
		  $('.play').show();
		  $('.slides').cycle('pause');
	    }
});

$('.slides').mouseleave(function(){
		if(!$('.slides img:only-child').length) {
		  $('.play').hide();
		  $('.slides').cycle('resume');
	    }
});
}


if($('.btn-download-floorplan').length) {
$('.btn-download-floorplan').lightBox({
	    overlayBgColor: '#B8B0A4',
		overlayOpacity: 0.6,
		imageLoading: 'http://ourfrenchfarm.com/wp-content/themes/labellegrange/images/lightbox-ico-loading.gif',
		imageBtnClose: 'http://ourfrenchfarm.com/wp-content/themes/labellegrange/images/lightbox-btn-close.gif'
});
}

$('#currencyList').change(function(){

if($('#currencyList').val() != '') {

 var urlPath = "http://ourfrenchfarm.com/wp-content/themes/labellegrange/ajax_converter.php"

 //Get all the values
 var amount1 = $('#amount1').text();
 var amount1 = amount1.replace(/\,/g,'');
 var amount2 = $('#amount2').text();
 var amount2 = amount2.replace(/\,/g,'');
 var amount3 = $('#amount3').text();
 var amount3 = amount3.replace(/\,/g,'');
 var from = 'EUR';
 var to = $('#currencyList').val();
 
 //Make data string
 var dataString = "amount=" + amount1 + "&from=" + from + "&to=" + to;
 var dataString2 = "amount=" + amount2 + "&from=" + from + "&to=" + to;
 var dataString3 = "amount=" + amount3 + "&from=" + from + "&to=" + to;
 
	 $.ajax({
	   type: "POST",
	   url: urlPath,
	   data: dataString,
	   success: function(data){
		 $('#results1').html(data);
	   }
	 });
	
	 $.ajax({
	   type: "POST",
	   url: urlPath,
	   data: dataString2,
	   success: function(data){
		 $('#results2').html(data);
	   }
	 });
	
	 $.ajax({
	   type: "POST",
	   url: urlPath,
	   data: dataString3,
	   success: function(data){
		 $('#results3').html(data);
	   }
	 });
}
	
});


}); /* end onload */
