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_hotel').click(function(){
		stopSlideShow();
		jQuery('#booking_form_hotel').animate({ opacity: 'toggle', height: 'toggle' }, "slow");
		jQuery('#booking_form_package').css({'display':'none'});
		return false;
	});
   
   jQuery('#booking_button_hotel').hover(
		function(){
			 $(this).addClass('rollover');
		},
		function(){
			$(this).removeClass('rollover');
		}
		);
   
	jQuery('#booking_button_package').click(function(){
    stopSlideShow();
    jQuery('#booking_form_package').animate({ opacity: 'toggle', height: 'toggle' }, "slow");
    jQuery('#booking_form_hotel').css({'display':'none'});
    return false;
  });
   
  jQuery('#booking_button_package').hover(
		function(){
			 $(this).addClass('rollover');
		},
		function(){
			$(this).removeClass('rollover');
    }
  );
  
  jQuery('#booking_hotel_check_button').hover(
		function(){
			 $(this).addClass('rollover');
		},
		function(){
			$(this).removeClass('rollover');
		});

  jQuery('#booking_package_check_button').hover(
    function(){
       $(this).addClass('rollover');
    },
    function(){
      $(this).removeClass('rollover');
  });
   
  jQuery('#booking_package_check_button').click(function(){
		jQuery('#booking_form_package').css({'display':'block'});
	});

	jQuery('#booking_hotel_check_button').click(function(){
    jQuery('#booking_form_hotel').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');
}