//fpv=4
function set_opacity(div, value) { 
	div.style.opacity = value; 
	div.style.filter = 'alpha(opacity=' + (value*100).toFixed() + ')'; 
	div.style.zoom=1;//necesario para Explorer 
	
	if (div.filters&&div.filters.lenght>0){
		//div.filters.item("alpha").Apply();
		if (div.filters.item("DXImageTransform.Microsoft.Alpha")){
			
			div.filters.item("DXImageTransform.Microsoft.Alpha").Opacity=(value*100).toFixed();
			div.filters.item("DXImageTransform.Microsoft.Alpha").Apply();
			div.filters.item("DXImageTransform.Microsoft.Alpha").Play();
			
		}
		
	}
	
	div.style.MozOpacity = value; 
	div.style.KhtmlOpacity = value; 
} 
var transicion=function(inicio,fin,milisegundos,avanzar){ 
	if (!avanzar){
		avanzar=1;	
	}
	this.avanzar=avanzar; 
	var _this=this; 
    this.test=0; 
    if(_this.intervalo)clearInterval(_this.intervalo); 
    if(this.val && Math.abs(fin-_this.val)<0.01)return; 
    this.val=!this.val?inicio<1?inicio+.0001:inicio:this.val; 
    set_opacity(this, this.val); 
    this.pasos=(fin-inicio)/100; 
    this.pausa=milisegundos; 
    this.intervalo=setInterval( 
    function(){ 
        if(_this.test>99 || Math.abs(fin-_this.val)<0.01){ 
          clearInterval(_this.intervalo); 
        } 
        _this.test++; 
        _this.val=_this.val+(_this.pasos * _this.avanzar); 
        if(_this.val<=.01)  
            //_this.style.display='none';
			 fp_hide_obj(_this);
        else 
           // _this.style.display=''; 
		   fp_show_obj(_this);
        set_opacity(_this, _this.val); 
    },this.pausa); 
}
function fp_hide_tr(id,mseg,av){
	
	var objeto=fp_get_element_by_id(id);
	if (objeto!=null ) {
		transicion.call(objeto,1,0,mseg,av); 
	}
}
function fp_show_tr(id,mseg,av){
	var objeto=fp_get_element_by_id(id);
	if (objeto!=null ) {
		transicion.call(objeto,0,1,mseg,av); 
	}
}
function fp_hide_show_tr(id,mseg,av){
	objeto=fp_get_element_by_id(id);
	if (objeto) {
		 fp_hide_show_tr_obj(objeto,mseg,av);
	}
}
function fp_hide_show_tr_obj(obj,mseg,av){
	if (!obj){
		return false;	
	}
	if (obj.style.display=='none'){
		transicion.call(obj,0,1,mseg,av); 
	}else{
		transicion.call(obj,1,0,mseg,av); 
	}
}

