////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Pleasure Island Javascript functions
// This file includes a collection of functions for use on the Pleasure Island site
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

$(function()
{
	// rotate header images
   setInterval('rotate_images("#header_slideshow")',3500);

   if($('#home_slideshow').length > 0) {
      // rotate header images
      setInterval('rotate_images("#home_slideshow")',7000);

      // open pop up window
      //window.open('http://pleasureislandrentals.com/shuckin_popup.html','','width=400,height=150,top=0,left=0');

   }
});


function rotate_images(id)
{
   var current_image = $(id+' img:visible');
   var next_image = current_image.next().attr('tagName') != 'IMG' ? current_image.siblings('img:first') : current_image.next();

   if(next_image.attr('alt') != '') {
      rotate_descriptions(next_image.attr('alt'));
   }

   current_image.fadeOut(3000);
   next_image.fadeIn(3000);

}


function rotate_descriptions(alt)
{
   $('#home_slideshow_desc div').fadeOut(3000);
   $('#home_slideshow_desc div[alt="'+alt+'"]').fadeIn(3000);
}