

// PRELOAD LARGE IMAGES USED IN SLIDESHOWS  ************************************************************************************
function preloadSlideshowImages() {

	return; // FINISH
	
	// Preload all images used in the portfolio slideshows
	MM_preloadImages( 
					 '/img/CDD_Rec-Room.gif' 
	); 
};



// GENERIC PLAY SLIDESHOW (CYCLE THUMBNAILS)  **********************************************************************************
function playThumbnailSlideshow( suffix ) {
	// Auto-transition a .8 second fade every 9 seconds
	$('#slideshow-' + suffix)
	.before('<div class="thumbnailNav" id="thumbnailNav' + suffix + '">') /* jQuery will properly close the tag */
	.cycle({ 
	    fx: 'fade',
		cssAfter: { opacity: 1, zIndex: 1 },
		cssBefore: { opacity: 0, zIndex: 0 },
		speed: 800, // Transitions in .8 seconds
		timeout: 9000, // Displays for 9 seconds
		next: '#next-' + suffix, 
		prev: '#prev-' + suffix,
	    pager:  '#thumbnailNav' + suffix, 
    
   		// Callback fn that creates a thumbnail to use as pager anchor 
	    pagerAnchorBuilder: function(idx, slide) { 
			// Change to the thumbnail img directory. Change the .png file extension to .gif.
			var src = replaceSubstring(  
					replaceSubstring(slide.src,"/examples/","/examples/thumbnails94/")
				, ".png",".gif");
			return '  <div class="thumbnail"><a href="#" title="' + slide.alt + '"><span style="background-image: url(' + src 
			+ ')"></span></a></div>';
		}
	}) // end cycle
};



// EMHE PLAY SLIDESHOW (CYCLE THUMBNAILS)  **********************************************************************************
function playEMHEThumbnailSlideshow() {
	// Auto-transition a .8 second fade every 9 seconds
	$('#slideshow-EMHE')
	.before('<div class="thumbnailNav" id="thumbnailNavEMHE">') /* jQuery will properly close the tag */
	.cycle({ 
	    fx: 'fade',
		cssAfter: { opacity: 1, zIndex: 1 },
		cssBefore: { opacity: 0, zIndex: 0 },
		speed: 800, // Transitions in .8 seconds
		timeout: 9000, // Displays for 9 seconds
		next: '#next-EMHE', 
		prev: '#prev-EMHE',
	    pager: '#thumbnailNavEMHE', 
    
   		// Callback fn that creates a thumbnail to use as pager anchor 
	    pagerAnchorBuilder: function(idx, slide) { 
			// Change to the thumbnail img directory. Change the .png file extension to .gif.
			var src = replaceSubstring(slide.src,"/examples/","/examples/thumbnails60/");
			return '  <div class="thumbnail"><a href="#" title="' + slide.alt + '"><span style="background-image: url(' + src 
			+ ')"></span></a></div>';
		}
	}) // end cycle
};



// GENERIC PLAY SLIDESHOW (FADE EFFECT)  ***************************************************************************************
function playFadeSlideshow( suffix, delaySec ) {
	// Auto-transition a .8 second fade every 9 seconds (delay = delay transition for 1st slide)
	$('#slideshow-' + suffix)
	.cycle({ 
	    fx: 'fade',
		cssAfter: { opacity: 1, zIndex: 1 },
		cssBefore: { opacity: 0, zIndex: 0 },
		speed: 800, // Transitions in .8 seconds
		timeout: 9000, // Displays for 9 seconds
		delay: (0 + delaySec )
	}) // end cycle
};



// PORTFOLIO (3-STACK OF SLIDES)  **********************************************************************************************
function playPortfolioSlides() {
	// Auto-transition a 1.7 second fade every 16 seconds (Stagger transition between slides with a delay on slides 2 and 3)
	// STACKED SLIDE #1 (TOP)
	$('#portfolioSlide1')
	.cycle( { 
		fx: 'fade',
		cssAfter: { opacity: 1, zIndex: 1 },
		cssBefore: { opacity: 0, zIndex: 0 },
		speed: 1700,
		timeout: 16000,
		delay: 0
	} );
	// STACKED SLIDE #2 (MIDDLE)
	$('#portfolioSlide2')
	.cycle( { 
		fx: 'fade',
		cssAfter: { opacity: 1, zIndex: 1 },
		cssBefore: { opacity: 0, zIndex: 0 },
		speed: 1700,
		timeout: 16000,
		delay: 2000
	} );
	// STACKED SLIDE #3 (BOTTOM)
	$('#portfolioSlide3')
	.cycle( { 
		fx: 'fade',
		cssAfter: { opacity: 1, zIndex: 1 },
		cssBefore: { opacity: 0, zIndex: 0 },
		speed: 1700,
		timeout: 16000,
		delay: 4000
	} );
};



// HOMEPAGE - PORTFOLIO SAMPLER  ************************************************************************************************
function playHomepageSlideshow( idSuffix ) {
	// Auto-transition a 1.7 second fade every 7 seconds (kickstart transition by 5 sec early for 1st slide)	
	$('#home_' + idSuffix )
	.cycle( { 
		fx: 'fade',
		cssAfter: { opacity: 1, zIndex: 1 },
		cssBefore: { opacity: 0, zIndex: 0 },
		speed: 1700,
		timeout: 7000,
		delay: -5000
	} );
	
};


// SLIDESHOW NAVIGATION ********************************************************************************************************
function slideshowPause( suffix, nPause ) {
	if( !suffix ) return;
	if( nPause == 1 ) {  // PAUSE
		$('#slideshow' + suffix ).cycle('pause');
		$('#slidenav' + suffix + ' #pause' + suffix ).css({ display:"none" });
		$('#slidenav' + suffix + ' #play' + suffix ).css({ display:"block" });
	}
	else if( nPause == 0 )  {  // PLAY
		$('#slideshow' + suffix ).cycle('resume');
		$('#slidenav' + suffix + ' #pause' + suffix ).css({ display:"block" });
		$('#slidenav' + suffix + ' #play' + suffix ).css({ display:"none" });
	}
};




/*  ****************   OLD   ***************************************************************************************************
function playPortfolioSlideshows() {

	// Auto-transition a 1.7 second fade every 7 seconds (delay = only 2 sec for 1st slide), 
	// pause-on-hover, and generate manual control via pager links after the slides.
	
	//  CONCEPT DRAWINGS - EXTERIOR ELEVATIONS  **************
	$('#CDExt_Slideshow')
	.after('<div id="navCDExt" class="navslide">')
	.cycle( { 
		fx: 'fade',
		cssAfter: { opacity: 1, zIndex: 1 },
		cssBefore: { opacity: 0, zIndex: 0 },
		speed: 1700,
		timeout: 7000,
		delay: -5000,
		pause: 1,
		pager: '#navCDExt'

	} );
	
	//  CONCEPT DRAWINGS - SPECIAL HOME DETAILS  *******************************************************************************
	$('#CDDetails_Slideshow')
	.after('<div id="navCDDetails" class="navslide">')
	.cycle( { 
		fx: 'fade',
		cssAfter: { opacity: 1, zIndex: 1 },
		cssBefore: { opacity: 0, zIndex: 0 },
		speed: 1700,
		timeout: 7000,
		delay: -5000,
		pause: 1,
		pager: '#navCDDetails'
	} );
		
	// Pause the slideshows that don't need to immediately run
	slideshowAction( '#CDDetails_Slideshow', 'pause' );
};
*/


/*  *******************************   CURRENTLY UNUSED   ***********************************************************************
function slideshowAction( shName, shAction ) {
	// shAction - i.e. stop, resume, pause
	if ( !shName  ||  !shAction ) return;
	$(shName).cycle(shAction);
};
	
	
function switchSlideshow( objSelect ) {
	if ( !objSelect ) return;
	
	idName = objSelect.value;
	if ( !idName || idName == "" ) return;
	
	//idName = getSelectedValues( objSelect, false );
	// Hide all shows
	if ( idName != "CDExt" )   {
		$('#CDExt').css('display','none');
		slideshowAction( idName + '_Slideshow', 'pause' );
	}
	if ( idName != "CDDetails" )   {
		$('#CDDetails').css('display','none');
		slideshowAction( idName + '_Slideshow', 'pause' );
	}
		
	// Show and start the select slideshow
	$('#' + idName).css('display','block');
	slideshowAction( idName + '_Slideshow', 'resume' );
};
*/