﻿jQuery(document).ready(function($) {
	$(".accommodation .scrollable ul li:last-child").css('margin-right','0');
	$(".accommodation-page .scrollable ul li:nth-child(2n)").css('margin-right','0');
	$("ul#tabs li:last-child").css({
		'width':'320px',
		'border-right':'none'
	});
	$("#browsable-01,#browsable-02").scrollable().navigator();
	$('.wd-tab').each(function(){
		$(this).find('.wd-section').hide();
		var current = $(this).find('.wd-item').children('.wd-current');
		if (current.length == 0){
			$(this).find('.wd-item').children(':first-child').addClass('wd-current');
			$($(this).find('.wd-item').children(':first-child').find('a').attr('href')).show();
		}

		$(this).find('.wd-item').find('a').click(function(){
			var current = $(this).parent().hasClass('wd-current');
			if (current == false){
				$(this).parent()
					.addClass('wd-current')
					.siblings().each(function(){
						$(this).removeClass('wd-current');
						$($(this).find('a').attr('href')).hide();
					});
				$($(this).attr('href')).fadeIn();
			}
			return false;
		});
	});
	jQuery('.testimonials ul.wd-testimonials-block')
	.cycle({
		fx:    'fade',
		speed: 500, 
		timeout:5000
	});
	$.featureList(
		$("#tabs li a"),
		$("#output li"), {
			start_item	:	1
		}
	);
	var heightMain = $('body.layout-inner .main-content').outerHeight();
	var heightRight = $('body.layout-inner .right-content').outerHeight();
	if ( (heightMain >= heightRight) ) {
		$('body.layout-inner .right-content').css('height',heightMain)
	}
	
	// Accommodation Detail
	$(".accommodation-page .scrollable ul li a").click(function(){
		var bigImgLink = $(this).attr("href");
		var bigImgSrc = $(this).attr("rev");
		$(".big-img a").attr("href",bigImgSrc);
		$(".big-img a img").attr("src",bigImgLink);
		return false;
	});	
	$(".accommodation-page .big-img a").fancybox({
		'transitionIn'		:'none',
		'transitionOut'		:'none',
		'titlePosition' 	:'over',
		'titleFormat'		:function(title, currentArray, currentIndex, currentOpts){
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? '  ' + title :'') + '</span>';
		}
	});

});



