$(document).ready(
	function() 
	{	
		$('#bookings .form').hide();

		$('#bookings .telephone a').click(function() {
			$('#bookings .telephone').hide();
			$('#bookings .form').slideDown();
			return false;
		});
		$('.long-stay-2').click(function() {
			return false;
		});
		$('.offer').css("display","block");
		$('.course-only ul').hide();
		$('.course-only').css("background","url(/images/course-only-bg.gif) left -129px no-repeat");
		$('.course-only').mouseover( function() {
			$(this).css("background-position","left top");
			$('.course-only ul').show();
		});
		$('.course-only').mouseout( function() {
			$(this).css("background-position","left -129px");
			$('.course-only ul').hide();
		});
	// Show and hide more info text
	$('#content .featured-course p:not(p:first)').hide();
	var original = $('#content .featured-course p:first').text();
	if ($('#content .featured-course p').length > 1)
		$('#content .featured-course p:first').append("..");
	$('#content .featured-course a').toggle(function() {
		$('#content .featured-course p:not(p:first)').show();
		$('#content .featured-course p:first').text(original);
		var altText = this.getAttribute('data-alt');
		this.setAttribute('data-alt', $(this).text());
		$(this).text(altText)
		$(this).attr('title', altText);
		return false;
	}, function() {
		$('#content .featured-course p:not(p:first)').hide();
		$('#content .featured-course p:first').append("..");
		var altText = this.getAttribute('data-alt');
		this.setAttribute('data-alt', $(this).text());
		$(this).attr('title', altText);
		$(this).text(altText)
		return false;
	});
	// Button overs
	$("#search, #get-price, #contact_form .submit").hover(function () {
		$(this).addClass("button-over");
	},
	function () {
		$(this).removeClass("button-over");
	});
	// Hover listings
	$(".featured-course, .popular-courses ol li, .results li, #sub-content ul li").hover(function () {
		$(this).addClass("over");
	},
	function () {
		$(this).removeClass("over");
	});
	// Turn on course navigation
	$('#course-content').css("padding-top","186px");
	$('#course-navigation').css("display","block");
	// Course navigation highlights
	$('#course-navigation li a').click(function() {
		$('#course-navigation li').removeClass("selected");
		$(this).parents("li").addClass("selected");
		return false;
	});
	// Hide and show course divs
	$('#school-location, #accommodation, #gallery, #reviews, #book-now').hide();
	$('#course-navigation .summary a').click(function() {
		$('#summary, #school-location, #accommodation, #gallery, #reviews, #book-now').hide();
		$('#summary').show();
		return false;
	});
	$('#course-navigation .school-location a').click(function() {
		$('#summary, #school-location, #accommodation, #gallery, #reviews, #book-now').hide();
		$('#school-location').show();
		return false;
	});
	$('#course-navigation .accommodation a').click(function() {
		$('#summary, #school-location, #accommodation, #gallery, #reviews, #book-now').hide();
		$('#accommodation').show();
		return false;
	});
	$('#course-navigation .gallery a').click(function() {
		$('#summary, #school-location, #accommodation, #gallery, #reviews, #book-now').hide();
		$('#gallery').show();
		return false;
	});
	$('#course-navigation .reviews a').click(function() {
		$('#summary, #school-location, #accommodation, #gallery, #reviews, #book-now').hide();
		$('#reviews').show();
		return false;
	});
	$('#course-navigation .book-now a').click(function() {
		$('#summary, #school-location, #accommodation, #gallery, #reviews, #book-now').hide();
		$('#book-now').show();
		return false;
	});
	// Hide and show accommodation divs
	$('#course-content #accommodation .information').append('<p class="toggle"><a href="#" title="Toggle details">Show details</a></p>');
	$('#course-content #accommodation .information p').hide();
	$('#course-content #accommodation .information p.toggle').show();
	$('#course-content #accommodation .information p.toggle a').toggle(function() {
		$(this).text("Hide details");
		$(this).parent("p").siblings("p").show();
		$(this).parent("p").show().css("padding-top","10px");
		return false;
	}, function() {
		$(this).text("Show details");
		$(this).parent("p").siblings("p").hide();
		$(this).parent("p").show().css("padding-top","0");
		return false;
	});
	// Gallery hovers
	$('#course-content #gallery ul li a img').hover(function() {
		var source = $(this).attr("src");
		$(this).parent("a").parent("li").parent("ul").parent("div").children(".large").attr("src",source);
	}, function() {
		// Do nothing
	});
	$('#course-content #gallery ul li a').click(function() {
		return false;
	});
	
	$('#accreditations .lloyds a').hover(function() {
		$(this).parent().next().hide();
		$('li.message').show();
	}, function() {
		$(this).parent().next().show();
		$('li.message').hide();
	});
});

