var LNL = {
	
	// toggle contact title - when other, show extra text field
	ct: function(q) {
		
		if(q == 'other') {

			jQuery('#title_extra').show();
			jQuery('#title_extra input').select();
			
		} else {
			
			jQuery('#title_extra').hide();
			
		}
	
	},

	// set fancybox for gallery
	fb: function() {
	
		if(jQuery('a[rel=gallery]').length) {

			jQuery('a[rel=gallery]').fancybox({
				'overlayColor' : '#000',
				'overlayOpacity':'0.7'
			});
			
		}
	
	}
    
};

// execute some scripts when document is loaded
jQuery(document).ready(function () {

	// fancybox
	LNL.fb();

	// book now
	jQuery('.top_book_date').datepicker({
		changeMonth:true,changeYear:true,dateFormat:'dd/mm/y',firstDay:1,minDate:LNLT.DateToday,selectOtherMonths:true,
		beforeShow: function(dateText, inst) {
			var book = (inst.id == 'top_book_check_in') ? 'in' : 'out';
			if(book == 'out') inst.dpDiv.css({marginLeft:'-115px'});
			else inst.dpDiv.css({marginLeft:'0'});
		},
		onSelect: function(dateText, inst) {
			var book = (inst.id == 'top_book_check_in') ? 'in' : 'out';
			jQuery('input[name="'+book+'day"]').attr('value', inst.selectedDay);
			jQuery('input[name="'+book+'monthyear"]').attr('value', inst.selectedYear+'-'+(parseInt(inst.selectedMonth)+1));
		}
	});

});
