PeriodicalExecuter.prototype.registerCallback = function() {
  this.intervalID = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
}

PeriodicalExecuter.prototype.stop = function() {
  clearInterval(this.intervalID);
}

var currFeat = 0, nextFeat = 1;
function rotateFeatured() {
  new Ajax.Updater(
    'featured-'+nextFeat, 
    '/ajax_featured.php', 
    {
      asynchronous:true, 
      onComplete: crossFade 
    }
  );	  
	function crossFade() {
  	Effect.Fade('featured-'+currFeat, { duration:1.5, from:1.0, to:0.0 });
  	Effect.Appear('featured-'+nextFeat, { duration:1.5, from:0.0, to:1.0 }); 
    currFeat = currFeat == 0 ? 1 : 0;
    nextFeat = nextFeat == 0 ? 1 : 0;	  
	}
}

function changeImage(holder, newImg, newLink) {
  var img   = $(holder);
  var link  = $(holder).parentNode;
  img.src   = newImg;
  link.href = newLink;
}