var state = 1;

$(document).ready(function(){
  $('#home').cycle({
    fx:      'fade',
    timeout: 9500,         // milliseconds between slide transitions (0 to disable auto advance) 
    speed:   3000,         // speed of the transition (any valid fx speed value) 
    pause:   1,
    pager:  '#nav', 

    // callback fn that creates a thumbnail to use as pager anchor 
    pagerAnchorBuilder: function(idx, slide) { 
      return '#nav li:eq(' + (idx) + ') a'; 
    } 
  });

  $('#controller').click(function() {
    if (state == 1) {
      $('#home').cycle('pause'); 
      state = 0;
      $('#controller').attr('alt','Play').attr('title', 'Play').attr('src', '/images/home/slides/pager/play.png');
    }
    else {
      $('#home').cycle('resume'); 
      state = 1;
      $('#controller').attr('alt', 'Pause').attr('title', 'Pause').attr('src', '/images/home/slides/pager/pause.png');
    }
  });
});


