jQuery(document).ready(function() {
	
	//CUSTOM SELECTS
	 jQuery('#hotel-picker').sSelect({ddMaxHeight: '300px'});	 
	 jQuery('#nights').sSelect({ddMaxHeight: '300px'});	 
	 jQuery('#adults').sSelect({ddMaxHeight: '300px'});	 
	 jQuery('#kids').sSelect({ddMaxHeight: '300px'});	
	 
	 //CAROUSEL
	 jQuery('#carousel-prev').hide();
	 
	 jQuery('#carousel-next').hide();
	 

	  lastcarousel = document.getElementById( "button1" );
	  function mycarousel_initCallback(carousel) {
		  jQuery('.carousel-control a').bind('click', function() {
			  carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
			  jQuery(this).addClass("on");
			  if( lastcarousel != "" )
				  jQuery(lastcarousel).removeClass("on");
			  lastcarousel = this;
			  return false;
		  });
	  
		  jQuery('#col-carousel-next').bind('click', function() {
			  currid = lastcarousel.id.replace( "button", "" );
			  currid++;
			  if( currid > numcarouselbuttons )
			  currid = 1; 
			  nextbutton = document.getElementById( "button" + currid );
			  jQuery(nextbutton).addClass("on");
			  if( lastcarousel != "" )
			  jQuery(lastcarousel).removeClass("on");
			  lastcarousel = nextbutton;
			  
			  carousel.next();
			  return false;
		  });
	  
		  jQuery('#col-carousel-prev').bind('click', function() {
			  currid = lastcarousel.id.replace( "button", "" );
			  currid--;
			  if( currid == 0 )
			  currid = numcarouselbuttons; 
			  nextbutton = document.getElementById( "button" + currid );
			  jQuery(nextbutton).addClass("on");
			  if( lastcarousel != "" )
			  jQuery(lastcarousel).removeClass("on");
			  lastcarousel = nextbutton;
			  
			  carousel.prev();
			  return false;
		  });
		};
		
		 /* function mycarousel_itemVisibleInCallbackIn(carousel, item, idx, state) {
		  // No animation on first load of the carousel
		  jQuery('.over-img', item).delay(300).fadeIn('slow');
		};
		
		function mycarousel_itemVisibleOutCallbackOut(carousel, item, idx, state) {
			jQuery('.over-img', item).delay(300).fadeOut('slow');
		};*/
		
//		function scrollTO() { 
//		var myelmDate = document.getElementById(sdate);
	
//		$('#sdate').click(function() { window.scrollY = 209; });

//}

		
		// If CSS position matches, add class to matched element
		function selectedAnchor(c, o, i, s) {
			posValue = i % 4;
			switch(posValue) {			
			case 1:
				jQuery('.carousel-control a').removeClass('on');
				jQuery('#button1').addClass('on');
				break;
			
			case 2:
				jQuery('.carousel-control a').removeClass('on');
				jQuery('#button2').addClass('on');
				break;

			case 3:
				jQuery('.carousel-control a').removeClass('on');
				jQuery('#button3').addClass('on');
				break;
				
			case 0:
				jQuery('.carousel-control a').removeClass('on');
				jQuery('#button4').addClass('on');
				break;
		
			default:
				return null;				
			}

		}
		
			jQuery("#hero-imgs").jcarousel({
				wrap: 'circular',
				auto: 6,
				animation: "slow",
				scroll: 1,
				itemVisibleInCallback: {
				  onAfterAnimation: selectedAnchor
				},
				//itemVisibleOutCallback: {
				//	onBeforeAnimation: mycarousel_itemVisibleOutCallbackOut
				//},
				initCallback: mycarousel_initCallback,
				buttonNextHTML: null,
				buttonPrevHTML: null
			});
			
		jQuery("#signup").colorbox({iframe:true, innerWidth:345, innerHeight:405});	


});

// CUFON STYLES
Cufon.replace('h1', {
	fontFamily: 'Gotham-Book',
	hover: true
});

Cufon.replace('h2', {
	fontFamily: 'Gotham-Book',
	hover: true
});

