code: function getIndex(increment) {
  		var 
  		max = $related.length, 
  		newIndex = (index + increment) % max;
  		
  		return (newIndex < 0) ? max + newIndex : newIndex;
  	}
docs: Determine the next and previous members in a group.