// 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) {
    var hide_idx = (index == 1) ? total : index - 1;
    items.eq(hide_idx-1).fadeOut(500, function() { items.eq(index-1).fadeIn(500); });
    index = (index == total) ? 1 : index + 1;
    window.setTimeout(function() { rotate_items(index,parent_id,timeout); }, timeout);
  }
}

