$(function() {

	// Sifr
	$('div#content h1').sifr({ strSWF: 'flash/avant-garde-book-bt.swf', strColor: '#260800', strWmode: 'transparent' },{ expressInstall: true });
	$('div.post-date h4').sifr({ strSWF: 'flash/headline.swf', strColor: '#eb6e20', strWmode: 'transparent', strFlashVars: 'textalign=center&' },{ expressInstall: true });
	$('div.post-date h5').sifr({ strSWF: 'flash/avant-garde-book-bt-italic.swf', strColor: '#260800', strWmode: 'transparent', strFlashVars: 'textalign=center&' },{ expressInstall: true });
	
	// Flash	
	$("div#signup-flash-form").flash({src:"flash/Email-Club-Sign-up.swf", width:249, height:300, wmode:"transparent", align:"top", salign:"tl", quality:"high"}, {version:"7"});
	

	$("div#photo-gallery").flash(
		{src:"flash/photo_gallery.swf",
		 width:500,
		 height:400,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"},
			function(htmlOptions) { //Use this to specify a query string, take out if not needed.
				htmlOptions.flashvars.epostConfigXML = "/mauna-kea-beach-hotel/flash/xml/epostConfig.xml";
				htmlOptions.flashvars.imagesXML = "/mauna-kea-beach-hotel/flash/xml/images.xml";
				htmlOptions.flashvars.langXML="/mauna-kea-beach-hotel/flash/xml/formLabels_english.xml";
				//htmlOptions.flashvars.browser = BROWSER;  //Used for SSP Postcard feature, comment out if not needed.
				$(this).html($.fn.flash.transform(htmlOptions));
		});

	// this function is invoked by the photo gallery swf
	window.openPreview = function( url ) {
		var winRef = window.open(
		    url, 
		    'myWindow', 'width=750,height=520,left=100,top=100,toolbar=no,location=no,scrollbars=no,status=no,resizable=no,fullscreen=no'
		);
		if ( winRef ) {
		    winRef.focus();
		}
	}
	
	$("div#wedding-gallery").flash({src:"flash/Wedding-PhotoGallery.swf", width:500, height:400, wmode:"transparent", quality:"high"},{version:"8"});
	$("body.home div#home-masthead").flash({src:"flash/home-masthead.swf", width:960, height:355, wmode:"window", quality:"high"},{version:"8"});
	
	
	// Table Striping
	$('table.stripe-table tbody tr:even').addClass('even');
	$("table.stripe-table tbody tr").each(function (i) {
		$(this).children('td:first').addClass('first');
	})
	
	
	
	// Check Avail Show-Hide Action
	$('div#code-box').hide();
	$('p#book-link').hide();
	
	$('a#advanced-search-link').toggle(function() { 
		$('div#code-box').slideDown();
		$('p#book-link').show();
		$('a#advanced-search-link').addClass('down');
		$('div.buttons').addClass('fixie');
	
	}, function(){
		$('p#book-link').hide();
		$('div#code-box').slideUp();
		$('a#advanced-search-link').removeClass('down');
		$('div.buttons').removeClass('fixie');
	});
	
	// Wedding Blog
	$('div.post-remainder').hide();
	
	$('p.more-link a').toggle(function() { 
		$('div.post-remainder').show();
		$(this).html('Hide');
	
	}, function(){
		$('div.post-remainder').hide();
		$(this).html('Read More');
	});
	
	// Expand and Collapse
	$('.expand-wrapper').expand({openText: 'Read More', closeText: 'Close Details', longClass: '.open-close'});
	
	// Homepage Push marketing Carousel
	$('#home-push-carousel').jcarousel({
        scroll: 1,
		wrap: 'last',
        initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });	
	
	
	
	
	
});





function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('#offer-link').bind('click', function() {
        carousel.next();
        return false;
    });
};


/* ----- Interactive Course Map launcher -------------*/
function launchCourseMap( url ) {
	window.open( url, "coursemap", "width=720,height=450,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no" );
}