/* Common jQuery for Resort Websites */
 
$(document).ready(function() {
	
	
	
	// *  Optimised Nav toggle  *
	$("#ski-holiday-links").hide();
	
	$("#ski-holidays a").click(function() {
		$("#ski-holiday-links").slideToggle(300);
	});
	
	
	// *  Faq - add 'back to top' links  *
	$('div#faq-list dd').append('<br /><br /><a href="#header">Back to top</a>');
	
	$("table.display-table tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
	$("table.display-table tr:even").addClass("alt");
	
	
	// *  Smooth Scrolling  *
	
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
			&& location.hostname == this.hostname) {
			var $target = $(this.hash);	
			$target = $target.length && $target		
			|| $('[name=' + this.hash.slice(1) +']');	
			if ($target.length) {		
				var targetOffset = $target.offset().top;	
				$('html,body')	
				.animate({scrollTop: targetOffset}, 500);	
				return false;	
			}		
		}
	});
	
	
	/* Enquiry */
	$('select').each(toggleExtraInfo);
    $('select').change(toggleExtraInfo);
    
	$('input#chkotherresorts').each(toggleChkboxExtraInfo);
	$('input#chkotherresorts').click(toggleChkboxExtraInfo);
	
	
	
	
	
});


function toggleExtraInfo() {
	if ($(this).attr("selectedIndex") == 0) {
		$(this).next('div').slideUp(250);
	} else {
		$(this).next('div').slideDown(250);
	}
}
function toggleChkboxExtraInfo() {
	if ($(this).attr("checked") == true){
		$(this).parent().find('div.extra-info').slideDown(250);
	} else {
		$(this).parent().find('div.extra-info').slideUp(250);
	}
}
