//fpv=6
function fp_accionesbk_hideshow(obj,nestado,params,donextactionobj){
	if(!nestado){
		nestado='show';
	}
	
	efecto=false;
	
	if(params){
		if(params.ocultarsiactivo){
			if(nestado=='hide'){
				nestado='show';
			}else{
				nestado='hide';	
			}
		}
		if(params.efecto){
			if(params.efectocfg){
				efecto=	params.efecto;	
			}
		}
	}
	
	if(nestado=='show'){
		if (obj.childNodes[0]){
			
			if(	obj.childNodes[0].tagName=="FP_LOAD_AJAX_BEFORE_SHOW"){
				var fp_load_ajax_before_show_url=obj.childNodes[0].getAttribute("url");	
				if(fp_load_ajax_before_show_url){
					if(donextactionobj){
						donextactionobj.accionesdoactual--;	
					}
					fp_ajax_cargaURL_onelem(fp_load_ajax_before_show_url,obj,false,donextactionobj);
					if(donextactionobj){
						return;
					}
				}
			}
		}
			
	}
	if (obj.style.display=='none'){
		if(nestado=='hide'){
			if(donextactionobj){
				donextactionobj.donextaction();
			}
			return true;	
		}
	}else{
		if(nestado=='show'){
			if(donextactionobj){
				donextactionobj.donextaction();
			}
			return true;	
		}
	}
	if(efecto=='transicion'){
		if(nestado=='show'){
			transicion.call(obj,0,1,parseInt(params.efectocfg.periodo),parseInt(params.efectocfg.etapas),donextactionobj); 
		}else{
			transicion.call(obj,1,0,parseInt(params.efectocfg.periodo),parseInt(params.efectocfg.etapas),donextactionobj);
		}
	}else if(efecto=='acordeon'){
		acordeon.call(obj,params.efectocfg.sentido,nestado,parseInt(params.efectocfg.periodo),parseInt(params.efectocfg.etapas),donextactionobj); 
	}else{
		if(nestado=='show'){
			fp_show_obj(obj);
		}else{
			fp_hide_obj(obj);
		}
		if(donextactionobj){
			donextactionobj.donextaction();
		}
	}
}

function fp_accionesbk_alternar_elems(params){
	
	this.paramsok=false;
	this.divparent_activo=false;
	this.elems_parents_divs=false;
	this.elemejecutandoactualactivo=false;
	this.elemejecutandoactual_divparent=false;
	this.ejecutarunoauno=false;
	this.cargarcontvp=false;
	this.cargarcontvpid=false;
	this.numaccionesdo=0;
	this.accionesdoactual=0;
	this.cargandovp=false;
	this.accionesdo=new Array();
	//fp_cont_cargarvistaprevia_ajax('".$datos["id"]."');
	if(params){
		if(params.bks){	
			this.paramsok=true;
			this.bks=params.bks;
		}
		if(params.ejecutarunoauno){
			this.ejecutarunoauno=true;	
		}
		if(params.cargarcontvp){
			if(params.cargarcontvpid){
				this.cargarcontvp=true;	
				this.cargarcontvpid=params.cargarcontvpid;
				
			}
		}
		
	}
	this.ejecutaracciones_elemsbks=function(){
		this.numaccionesdo=0;
		this.accionesdoactual=0;
		this.accionesdo=new Array();
		this.cargandovp=false;
		if(this.cargarcontvp){
			this.cargandovp=true;	
		}
		
		for (x=0;x<this.elems_parents_divs.length;x++){
			this.elemejecutandoactualactivo=false;
			if(this.elems_parents_divs[x]!=this.divparent_activo){
				//this.elemejecutandoactualactivo=true;
				this.elemejecutandoactual_divparent=this.elems_parents_divs[x];
				this.ejecutaracciones_bksin();
			}
		}
		if(this.divparent_activo){
			this.elemejecutandoactualactivo=true;
			this.elemejecutandoactual_divparent=this.divparent_activo;
			this.ejecutaracciones_bksin();
		}
		this.accionesdo_ejecutar();
	}
	this.donextaction=function(){
		this.accionesdo_ejecutar();
	}
	this.accionesdo_ejecutar=function(){
		if(this.cargandovp){
			this.cargandovp=false;
			fp_cont_cargarvistaprevia_ajax(this.cargarcontvpid,false,true,this,false,false,true);
			return;
		}
		
		
		if(this.numaccionesdo>this.accionesdoactual){
			if(acc=this.accionesdo[this.accionesdoactual]){
				this.accionesdoactual++;
				if(this.ejecutarunoauno){
					fp_accionesbk_hideshow(acc.bkin,acc.nestado,acc.params,this);
				}else{
					fp_accionesbk_hideshow(acc.bkin,acc.nestado,acc.params);
					this.accionesdo_ejecutar();
				}
			}
		}else{
			this.numaccionesdo=0;
			this.accionesdoactual=0;
			this.accionesdo=new Array();
		}
	}
	this.ejecutaracciones_bksin=function(){
		for (bkid in this.bks){

			if(bkin=mw_dom_get_childdeep_by_nameandtagname(this.elemejecutandoactual_divparent,bkid,"DIV")){
				if(this.elemejecutandoactualactivo){
					nestado='show';
				}else{
					nestado='hide';	
				}
				this.accionesdo[this.numaccionesdo]=new Object;
				this.accionesdo[this.numaccionesdo].bkin=bkin;
				this.accionesdo[this.numaccionesdo].nestado=nestado;
				this.accionesdo[this.numaccionesdo].params=this.bks[bkid];
				this.numaccionesdo++;
			}
		}
	}
	this.set_elems_parents=function(){
		if(this.elems_parents_divs){
			return true;	
		}
		if(this.divparent_main){
			if(this.divparent_elem_id){
				if (this.elems_parents_divs= mw_dom_get_childdeep_by_idandtagname(this.divparent_main,this.divparent_elem_id,"div",true)){
					return true;													  
				}
			}
		}
			
	}
	this.set_activofrom_inner=function(innerobj){
		if(!this.paramsok){
			return false;	
		}
		if(this.divparent_activo=fp_get_div_parent_dis(innerobj)){
			this.divparent_elem_id=this.divparent_activo.id;
			if(this.divparent_main=fp_get_div_parent_dis(this.divparent_activo)){
				if(this.set_elems_parents()){
					this.ejecutaracciones_elemsbks();
				}
			}
		}
		
	}
}
function fp_accionesbk_alternar_elems_set_activofrom_inner(inner,params){
	var objfp_accionesbk_alternar_elems=new fp_accionesbk_alternar_elems(params);
	objfp_accionesbk_alternar_elems.set_activofrom_inner(inner);
}

function fp_accionesbk_alternar_elems_set_activo_first(id,params){
	if(inner=fp_get_element_by_id_siexiste(id)){
		var objfp_accionesbk_alternar_elems=new fp_accionesbk_alternar_elems(params);
		objfp_accionesbk_alternar_elems.set_activofrom_inner(inner);
		//alert(obj);	
	}
}
function fp_accionesbk_doauto_on_parents(){
	var e=document.getElementsByTagName("fp_bk_auto_ejex");
	if(e){
		for (var i=0;i<e.length;i++){
			if(e[i].getAttribute('done')=="false"){
				e[i].setAttribute('done','true');
				fp_accionesbk_doauto_on_parent_elem(e[i]);
			}
		}
	}
}
function fp_accionesbk_doauto_on_parent_elem(ee){
	var pn;
	pn=ee.parentNode;
	var ppp=new Object;
	var psrt=ee.getAttribute('params');
	if(psrt){
		ppp=eval("("+psrt+")");
	}
	var fncsrt=ee.getAttribute('fnc');
	if(fncsrt){
		var fnc=eval("("+fncsrt+")");
		fnc(pn,ppp);
	}
	
}


