// JavaScript Document
function fp_slide (nomgenerico) {
   	this.nitems = 0;
    this.nomgenerico = nomgenerico;
    this.elemactual = 0;
    this.abririmgoriginalalhacerclick = 1;

	this.hideshowportransicion = 0;
	this.hideshowportransicionmseg = 10;
	this.hideshowportransicionav = 1;

 	this.elementos = new Array;
    this.add_elemento = function(idelem) {
         this.elementos[this.nitems]=idelem;
		 this.nitems=this.nitems+1;
    };
    this.getdatosactualfromdiv = function() {
       var id_div_item=this.nomgenerico+"_item_"+ this.elementos[this.elemactual];
		this.datosactual_titulo=fp_get_contenido(id_div_item+'_titulo');
		this.datosactual_titalbum=fp_get_contenido(id_div_item+'_titalbum');
	  	this.datosactual_desc=fp_get_contenido(id_div_item+'_desc');
	  	this.datosactual_urlimg=fp_get_contenido(id_div_item+'_urlimg');
	  	this.datosactual_urlimgorig=fp_get_contenido(id_div_item+'_urlimgorig');
	  	this.datosactual_onclimggrande=fp_get_contenido(id_div_item+'_onclimggrande');
		
    };
    this.showdatosactual = function() {
		var id_div_itemactual=this.nomgenerico+"_item_"+ this.elementos[this.elemactual];
		fp_hide(this.nomgenerico+"_titulo");
		fp_hide(this.nomgenerico+"_desc");
		fp_hide(this.nomgenerico+"_titalbum");
		
		
		fp_modificar_contenido(this.nomgenerico+"_titulo",this.datosactual_titulo );
		fp_modificar_contenido(this.nomgenerico+"_desc",this.datosactual_desc );
		fp_modificar_contenido(this.nomgenerico+"_titalbum",this.datosactual_titalbum );
		
		
		
		var htmlimg="<img src='"+this.datosactual_urlimg+"' border='0'>";
		if (this.abririmgoriginalalhacerclick==1){
			if (this.datosactual_urlimgorig.length>0){
				var htmlimga="<a href='"+this.datosactual_urlimgorig+"' target='_blank' ";
				if (this.datosactual_onclimggrande.length>0){
					htmlimga+="onclick=\""+this.datosactual_onclimggrande+"\"";
					
				}
				
				htmlimga+=">";
				htmlimg=htmlimga+htmlimg+"</a>";
			}
		}
		
		fp_modificar_contenido(this.nomgenerico,htmlimg );
		if (this.datosactual_titulo.length>0){
			fp_show(this.nomgenerico+"_titulo");
		}
		if (this.datosactual_desc.length>0){
			fp_show(this.nomgenerico+"_desc");
		}
		if (this.datosactual_titalbum.length>0){
			fp_show(this.nomgenerico+"_titalbum");
		}
		fp_cambiar_propiedad(id_div_itemactual+'_titulomostrar','className',this.classtitulossel);
		
		if(this.marcooculto){
			this.showmarco();	
		}

		//fp_get_output('img.php?src='+this.datosactual_urlimg,this.nomgenerico,'cont',true);
    };
	this.show_elem_from_div = function(actual) {
		this.set_actual(actual);
		this.getdatosactualfromdiv();
		this.showdatosactual();
	}
	this.set_next = function() {
		if ((this.elemactual+1)>=this.nitems){
			var nuevoactual=0;
		}else{
			var nuevoactual=this.elemactual+1;
		}
		this.set_actual(nuevoactual);
	}
	this.set_prev = function() {
		if (this.elemactual<=0){
			var nuevoactual=this.nitems-1;
		}else{
			var nuevoactual=this.elemactual-1;
		}
		
		this.set_actual(nuevoactual);
	}
	this.show_next_from_div = function() {
		this.set_next();
		this.getdatosactualfromdiv();
		this.showdatosactual();
	}
	this.show_prev_from_div = function() {
		this.set_prev();
		this.getdatosactualfromdiv();
		this.showdatosactual();
	}

	this.showmarco= function(){
		if (this.marcooculto){
			this.marcooculto=false;
			var id_div_marco=this.nomgenerico+"_marco";
			if (this.hideshowportransicion==1){
				fp_show_tr(id_div_marco,this.hideshowportransicionmseg,this.hideshowportransicionav);
			}else{
				fp_show(id_div_marco);
			}
		}
	}
	this.ocultarmarco= function(){
		if (!this.marcooculto){
			this.marcooculto=true;
			var id_div_marco=this.nomgenerico+"_marco";
			if (this.hideshowportransicion==1){
				fp_hide_tr(id_div_marco,this.hideshowportransicionmseg,this.hideshowportransicionav);
			}else{
				fp_hide(id_div_marco);
			}
		}
	}

	this.set_actual= function(idelem){
		var id_div_itemactual=this.nomgenerico+"_item_"+ this.elementos[this.elemactual];
		fp_cambiar_propiedad(id_div_itemactual+'_titulomostrar','className',this.classtitulos);
		this.elemactual=idelem;
	}


}