function crossFade() {
   current++;
   new Effect.Puff('quote'+current);
   if (current >= quotes) current = 0; 
   new Effect.Appear('quote'+(current+1), {duration:2});
}

var quotes = 0
var current = 0
var display = 4000

function cycleQuotes(numOfQuotes, displayTime) {
    quotes = numOfQuotes || quotes;
    display = displayTime || display;
    if (quotes >0) setInterval(  'crossFade()', display);
}

var lastopen;
  
Event.addBehavior({
  'a.dmenu:click' : function(e) {
    if (lastopen) lastopen.hide();
    var thediv = $('sub' + this.getAttribute('id'));                 
    //thediv.style.position = 'absolute';
    //thediv.style.top = this.offsetTop + 'px';    
    //thediv.style.left = this.offsetLeft + this.offsetWidth + 'px';    
    //thediv.show();
    Effect.SlideDown(thediv);
    lastopen = thediv;
  }
});

Event.onReady(function() {
    cycleQuotes(11, 28000)
});

