function fade(id,tiempo){
    this.tiempo1=20;
    this.tiempo2=tiempo; //tiempo que dura la noticia

    this.obj_id=document.getElementById(id);
    this.vofertas=new Array();
    long_nodos=this.obj_id.childNodes.length;
    for(q=0;q<long_nodos;q++){  
        of=this.obj_id.firstChild;  
        this.vofertas[q]=of; 
        this.obj_id.removeChild(of);
        of.style.display='block';     
    }
    
    this.obj_id.appendChild(this.vofertas[0]);
    
    this.total=this.vofertas.length;
    this.actual=0;
    this.opacidad=100;
    this.apareciendo=false; //indica si está apareciendo o desapareciendo la publicacion
         
    this.accion=function(){  
        if (this.opacidad>0){
            if (this.apareciendo){
                cantidad=2;
            }else{
                cantidad=-2;
            }
            this.opacidad+=cantidad;       
            cambiarOpacidad(this.vofertas[this.actual],this.opacidad);
            if (this.opacidad<100){
                var self=this;
                window.setTimeout(function(){self.accion()},this.tiempo1);
            }else{ 
                this.apareciendo=!this.apareciendo;
                var self=this;
                window.setTimeout(function(){self.accion()},this.tiempo2);
            }
        }else{
                this.apareciendo=!this.apareciendo;  
                antiguo=this.vofertas[this.actual];
                this.actual++;
                if (this.actual==this.total) this.actual=0; 
                this.obj_id.replaceChild(this.vofertas[this.actual],antiguo);
                this.opacidad+=2;
                var self=this;
                window.setTimeout(function(){self.accion()},this.tiempo1);
        } 
    }
    
    this.accion();
    
}

document.write('<style>.oculta{filter:alpha(opacity=0);-moz-opacity:0; opacity: 0; display:none;}</style>');


document.write('<style>.oculta2{display:none;}</style>');