//Script creado por Jose David Bravo (jbravo@colombiahosting.com.co)
function iniciarContenido(idContenido,tiempoEfecto,tiempoMuestra,descripcion,claseDescripcion) {
	if ($(idContenido).length > 0) {
		c = $(idContenido);
		c.addClass("contenido_dinamico");
		c.children("div").hide();
		c.show();
		d=null;
		if (descripcion) {
			d=$('<div></div>').fadeTo(0,0.6).appendTo(c);
			d.addClass("contenido_dinamico_descripcion");
			d.addClass(claseDescripcion);
			d.width(c.width()-parseInt(d.css("padding-left"))-parseInt(d.css("padding-right")));
			d.hide();
		}
		if (c.children(":first").length > 0) {
			mostrarContenido(c,0,tiempoEfecto,tiempoMuestra,d);
			if (d!=null) {
				d.html(c.find("div:eq(0)").find("img").attr("alt"));
			}
		}
	}
}
function mostrarContenido(c,idImagen,tiempoEfecto,tiempoMuestra,d) {
	
	c.children().eq(idImagen).fadeIn(tiempoEfecto, function() {
		if (d!=null) {
			d.slideDown(tiempoEfecto); //down muestra
		}
	});
	setTimeout(function() {
		var descripcionSiguiente="";
		var imagenSiguiente=-1;
		if (c.children(":not(.contenido_dinamico_descripcion)").eq(idImagen+1).length > 0) {
			imagenSiguiente=idImagen+1;
		} else {
			imagenSiguiente=0;
		}
		
		mostrarContenido(c,imagenSiguiente,tiempoEfecto,tiempoMuestra,d);
		if (d!=null) {
			descripcionSiguiente=c.find("div").eq(imagenSiguiente).find("img").attr("alt");
			d.fadeOut(tiempoEfecto, function() {
				d.html(descripcionSiguiente);
			});
		}
		c.children().eq(idImagen).fadeOut(tiempoEfecto);
    }, tiempoMuestra); 
}
