// function: rotate_items
// description: rotates of list of items with the 
// class 'item'
// -------------------------------------------------
// index: item to rotate;
// parent_id: id of parent node
// timeout: number of milliseconds until next rotate
// -------------------------------------------------
function rotate_items(index, parent_id, timeout) {

  var items = $$('#' + parent_id + ' ' + '.item');
  var total = items.length;

  if (total > 0) {
    if (index == 1) var hide_idx = total;
    else var hide_idx = index-1;
  
    Effect.Fade(items[hide_idx-1], { queue: { position: 'end', scope: 'first'}});
    Effect.Appear(items[index-1], { queue: { position: 'end', scope: 'second'}});
    
    if (index == total) index = 1;
    else index++;
  
    window.setTimeout('rotate_items('+index+', "'+parent_id+'", "'+timeout+'")', timeout);
  }

}
