
// Trailfinders object setup
if (!TrailfindersBusiness) var TrailfindersBusiness = {}

//Setup function - called as a default method by the $ready function
TrailfindersBusiness.setup=function (){
	
	//Stay in touch expander
	TrailfindersBusiness.sliderSetup();
	//Add the cookie tracking code to the business links
	TrailfindersBusiness.openFlight();
	//Convert Hotel Images to links
	TrailfindersBusiness.hotelPicturesSetup();
	
}

//Configure stay in touch slider NB Not the picture slider
TrailfindersBusiness.sliderSetup=function(){
$('#stayInTouch').click(function(){$("#target").slideToggle("slow")});
}

//convert hotel images in the slider to links so clicking on the hotel opens it
//We cant use A links as this breaks the slider script

TrailfindersBusiness.hotelPicturesSetup=function(){
	//Add a link to the images - adding a links around the images seems to break the slider code
	$("#slideshow IMG[link]").bind("click", function(){
		var NewLink= $(this).attr("link");
		window.location.href = NewLink;
	});
	
	//Make the images appear they have a link by adding the pointer cursor
	$("#slideshow IMG[link]").css({cursor:'pointer'});
	
}

// opening business or first class flight - set cookie first so sort on hotels is correct.
TrailfindersBusiness.openFlight = function () {

	$('a[rel="business"]').click( function() {
		$.cookie("businessfirstclass", "true", { path: '/', domain: 'trailfinders.com' });
		window.location=( $(this).attr('href') );
        return false;
    });
}

