/**
 * Cycler
 * @class
 * @version 1.0
 */
Cycler = function (el) {
	
	var myCycler = el;
	var num_cyclers = jQuery(".fader-item", myCycler).length;
	var current_index = 0;
	var flip_duration = 8000;
	
	this.getItemFromIndex = function (index) {
		return jQuery(jQuery(".fader-item", myCycler).get(index));
	}
   	
   	this.setFlipDuration = function (newDuration) {
		flip_duration = newDuration;
	}
	
	this.initialize = function (initialFlipDelay) {
		
		if (typeof(initialFlipDelay) == "undefined") {
			initialFlipDelay = flip_duration;
		}
		
		//show the first
		this.getItemFromIndex(current_index).show();

		//only one item, don't do anything else
		if (num_cyclers < 2) return;
		
		// start cycling
		myCycler.cycle({
			fx:'fade',
			speed:1500,
			delay:initialFlipDelay,
			timeout:flip_duration
		});
	}
}
