jQuery.noConflict();

jQuery(document).ready( function($) {
	// init all global front end features here
							
	//initCufon(); // initialize cufon text replacement - this is now done in front of the body closing tag
	
	initExternalLink();
	
	initNavGradients();
	
	// adds styling to sidebar listing for content pages
	zebraStripe('.sidebar_listing ul li:even');
	noborderLast('.sidebar_listing ul li:last');
	
	//newsletter popup event
	jQuery('.newsletter_popup').click( function() {
			tb_show('', this.href + '?isAjax=true&amp;TB_iframe=true&amp;height=590&amp;width=430', '');
			this.blur();
			stopSlideShow(); //stop header slideshow to improve performance
			return false;
		});
		
	 //send to friend popup event
   jQuery('.send-to-friend_popup').click( function() {
      		tb_show('', this.href + '?isAjax=true&amp;TB_iframe=true&amp;height=530&amp;width=370', '');
      		this.blur();
      		stopSlideShow(); //stop header slideshow to improve performance
      		return false;                      
    });
    
   //brochure popup event
   jQuery('.brochure_popup').click( function() {
          tb_show('', this.href + '?isAjax=true&amp;TB_iframe=true&amp;height=570&amp;width=370', '');
          this.blur();
          stopSlideShow(); //stop header slideshow to improve performance
          return false;                      
    });
   
   jQuery('#booking_button').click(function(){
		stopSlideShow();
		jQuery('#booking_form').animate({ opacity: 'toggle', height: 'toggle' }, "slow");
		return false;
	});
   
   jQuery('#booking_button').hover(
		function(){
			 $(this).addClass('rollover');
		},
		function(){
			$(this).removeClass('rollover');
		}
		);
   
   jQuery('#booking_check_button').hover(
		function(){
			 $(this).addClass('rollover');
		},
		function(){
			$(this).removeClass('rollover');
		});

   
   jQuery('.round_yellow').click(function(){
		jQuery('#booking_form').css({'display':'block'});
	});

});


function initCufon() {			
	Cufon.replace('.cufon_helvetica_neue', { fontFamily: 'HelveticaNeue', hover: true, hoverables: { a: true } });
	Cufon.replace('body h1', { fontFamily: 'HelveticaNeue' });
	Cufon.replace('body h2', { fontFamily: 'HelveticaNeue' });
	Cufon.replace('body h3', { fontFamily: 'HelveticaNeue' });
	Cufon.now(); // IE flicker fix
}

function initExternalLink() {
	jQuery("a[rel='external']").attr({'target': '_blank'});
	jQuery(".external").attr({'target': '_blank'});
}

function initNavGradients() {
	jQuery(".header .topnav a").prepend("<span class='gradient'>&nbsp;</span>");
}

function zebraStripe(target){
	jQuery(target).addClass('odd');
}

function noborderLast(target){
	jQuery(target).addClass('noborder');
}

function stopSlideShow() {
	jQuery("div.carousel_images > ul", '.slideshow').cycle('pause');
}

function startSlideShow() {
	jQuery("div.carousel_images > ul", '.slideshow').cycle('resume');
}

