//////////////////////////////////////////////////////
//
//	The purpose of this file is to
//	apply a hover class on mouseover
//	on the <li> elements in the nav.
//	This is because IE doesn't put
//	the pseudo class :hover on <li> elements
//
//	This is code that uses the
//	jquery javascript library (http://jquery.com/)
//
//////////////////////////////////////////////////////
$(document).ready(function() {
	if ($.browser.msie && $.browser.version <= 6) {
		// this is needed for the IE 6 pseudo hover class bug
		$(".navtop > li").hover(function() {
			$(this).addClass("hover");
		},
		function () {
			$(this).removeClass("hover");
		});
		// this adds flyout support for IE 6
		$(".navtop > li li ").hover(function () {
			$(this).addClass("hover");
		},
		function () {
			$(this).removeClass("hover");
		});
		
	}
	
	prettyOptions = {show_title: false,deeplinking: false, changepicturecallback: function(){_gaq.push(['_trackEvent','lightbox','click',document.location.pathname]);}}
	$("a[rel^='prettyPhoto'],a[rel^='lightBox']").prettyPhoto(prettyOptions);


	 jqModalOptions = {};
	 /*$("#superAmbassadorModal").jqm({
	 	trigger: '#b1'
	 });*/

	 $('.nyroModalPackage').nyroModal({sizes: {minW: '645'}});
	 $('.nyroModal').nyroModal();
	 
	 
	 $('.offerButton').click(function(){
		window.location = $(this).find('a').attr('href');
	 });
	 
	  $('.expandoClicker').click(function(){
	    me = $(this);
		dad = me.parent();
		if(!dad.hasClass('open')){
			dad.animate({height: '148px'},'fast');
			dad.addClass('open');
		}else{
			dad.animate({height: '70px'},'fast');
			dad.removeClass('open');
		}
	 });
});

/* homeNewSpecials slides*/
$(function() {
	$('#homeNewSpecials').each(function(){
		var me = $(this);
		var slides = me.find('.slides .slide').hide();
		$(slides.get(0)).show();
		var boxButtons = me.find('.boxButtons li').each(function(index){
			var bb = $(this);
			if(index == 0){
				bb.addClass('selected');
			}
			bb.click(function(){
				boxButtons.removeClass('selected');
				$(this).addClass('selected');
				slides.hide();
				$(slides.get(index)).fadeIn();
			});
		});
		
	});

});
$(function() {
	
	$('#facebook').append('<fb:like-box href="https://www.facebook.com/polynesia2" width="225" height="320" show_faces="false" stream="true" header="false" style="background: #eeeeee;"></fb:like-box>');
	//$('#facebook').append('<fb:like-box href="https://www.facebook.com/polynesia2?sk=wall" width="225" height="320" show_faces="false" stream="true" header="false" style="background: #eeeeee;"></fb:like-box>');
	//document.write('<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>');	

	$('#haBreathSeating').each(function(){
		var container = $(this);
		var cardsContainer = container.find('.cards');
		cardsContainer.find('.card').each(function(i){
			if(i != 0){
				$(this).hide();
			}
		});
		container.find('.links a').hover(function(){
			
			cardsContainer.find('.card').hide();
			cardsContainer.find('.' + $(this).attr('class')).show();
		},function(){
			
		});
	});

});

