// RVH alterna muestra de elementos
function mw_elementosalternos_elemento(){
	this.div=false;
	this.img=false;
	this.imgsrcon=false;
	this.imgsrcoff=false;
}

function mw_elementosalternos(nombre){
	this.nombre=nombre;
	this.activo=false;
	this.activoindex=false;
	this.timeout=1000;
	this.ocultaronmouseout=1;
	//
	this.usarelementosarray=false;
	this.elementos = new Array;
	this.elementosindex = new Array;
	this.registrarelemento=function(index,id_cont,id_img,srcon,srcoff) {
		this.elementos[index]=new mw_elementosalternos_elemento;
		this.elementos[index].div=fp_get_element_by_id(id_cont);
		if (id_img){
			this.elementos[index].img=fp_get_element_by_id(id_img);
			this.elementos[index].imgsrcon=srcon;
			this.elementos[index].imgsrcoff=srcoff;
		}
		this.elementosindex[index]=id_cont;
	}
	this.getelementoid=function(id_cont) {
		for (i=0;i<this.elementosindex.length;i++){
			if(	this.elementosindex[i]==id_cont){
				return i;
			}
		}
						
	}
	this.set_activo_si_visible_y_activo_noexiste_o_ocultar=function(id_cont) {
		var estado=fp_get_style(id_cont,'display');
		if (estado!="none"){
			if (this.activo){
				fp_hide(id_cont);	
			}else{
				this.activo=id_cont;
			}
		}
	}
	this.clearTimeout_ocultar=function(){
		if (this.timerocultar){
			clearTimeout(this.timerocultar);
		}
	}
	this.iniciarTimeout_ocultar=function(){
		this.clearTimeout_ocultar();
		this.timerocultar =  setTimeout(this.nombre+".ocultar_activo()",this.timeout);
	}
	this.ocultar_activo=function(){
		this.clearTimeout_ocultar();
		if (this.activo){
			fp_hide(this.activo);
			if (this.usarelementosarray){
				this.elementos[this.activoindex].img.src=this.elementos[this.activoindex].imgsrcoff;
			}
			this.activo=false;
		}
	}
	this.set_activo=function(id_cont){
		if (id_cont==this.activo){
			this.clearTimeout_ocultar();
		}else{
			this.ocultar_activo();
			if (id_cont){
				if (this.usarelementosarray){
					this.activoindex=this.getelementoid(id_cont);
					this.elementos[this.activoindex].img.src=this.elementos[this.activoindex].imgsrcon;
				}
				//set_opacity_id(id_cont,1);
				fp_show(id_cont);
				this.activo=id_cont;
			}
		}
	}
	this.alsalirmouse=function (){
		if(this.ocultaronmouseout){
			this.iniciarTimeout_ocultar();
		}
	}
}
