// CODE FOR ROTATOR
$(function() {

    $('#rotator-items').cycle({
			fx: 'fade',
			speed:  	'slow',
			timeout: 	6000,
			prev:    	'#prev-button',
			next:    	'#next-button',
			pager:   	'#nav-items',
			pause: 		0,
			pagerAnchorBuilder: pagerFactory
		});

	function pagerFactory(idx, slide) {        
		return '<div><a href="#">'+(idx+1)+'</a></div>';
	};
	
	// HIDE PLAY BUTTON INITIALLY
	$('#play-button').hide();	
	
});

// TOGGLE PAUSE AND SHOW RESUME BUTTON
$(function() {
	
	// run the code in the markup!
	$('#pause-button > img').click(function() { 
		$('#rotator-items').cycle('pause'); 
		$('#pause-button').hide();
		$('#play-button').show();
	});
	
});

// TOGGLE RESUME AND SHOW PAUSE BUTTON
$(function() {
					 
	$('#play-button > img').click(function() { 
		$('#rotator-items').cycle('resume',true); 
		$('#pause-button').show();
		$('#play-button').hide();
	});
	
});
