

/* 
Steven Price
Mar 2010
Pause and navigate images
*/

$(document).ready(function() { 	
	
	/* write link using JS so non-JS users will never see it*/
	$('div#pause').append('<a id="link_pause" href="#">Pause advert rotation</a>');
	
	/* write link using JS so non-JS users will never see it*/
	$('div#prev_next').append('<a id="prev2" href="#">Prev advert</a> &nbsp;&nbsp; <a id="next2" href="#">Next advert</a>');
	
	/* hide previous / next buttons on load */
	$('div#prev_next').hide();
	
	/* begin slideshow, allow user to navigate by previous/next when pause is clicked */
	$('#s2').cycle({ 	   
	     fx:     'fade', 
        speed:  2000,
         timeout: 14000, 
         next:   '#next2', 
         prev:   '#prev2'		
    });
	
	
	
/* when pause is clicked hide link, show previous/next navigation. Return false on link so user isn't returned to the top of the page */
	$('a#link_pause').click(function() {	
	   $('#s2').cycle('pause');	
	   $(this).hide();
	   $('div#prev_next').show();
	   return false;       
	});	
	
	
	/* Return false on link so user isn't returned to the top of the page */
	$('div#prev_next').click(function(){
	   return false;		   
	
	});
	
	
});


