jQuery.fn.guscycler = function(options) {
	var opts = jQuery.extend({}, jQuery.fn.guscycler.defaults, options);

	var $this = jQuery(this);
	$this.css('position','relative').css('overflow','hidden');

	//sacamos el total de fotos
	$this.fotos 	= $this.children('img');
	$this.totalFotos	= $this.fotos.length;
	$this.fotoActual = 0;
	$this.fotos.hide().css('position','absolute').css('top','0').css('left',0);
	
	if ($this.totalFotos <= 1)
		return;


	function cambiarFoto(){
		//ocultamos actual
		$this.fotos.eq($this.fotoActual).css('z-index','10').fadeOut(opts.velocidad);
		$this.fotoActual++;

		if ($this.fotoActual>=$this.totalFotos)
			$this.fotoActual = 0;

		$this.fotos.eq($this.fotoActual).css('z-index','1').show();
	}

	$this.fotos.eq($this.fotoActual).show();

	setInterval(cambiarFoto,opts.duracion);

};

jQuery.fn.guscycler.defaults = {
 	duracion : 1000,
 	velocidad : 1000
};

