function slideTransparencia(slide_id){
    this.image = new Array();
    this.current = 0;
    var _this = this;

    this.anyadirEvento = function(elemento,evento,funcion)
    {
        if(elemento.addEventListener)return elemento.addEventListener(evento,funcion,false);
        if(elemento.attachEvent)return elemento.attachEvent("on"+evento,funcion);
    }
    this.transparencia = function()
    {
        var current_img = _this.image[_this.current].xOpacity;
        var next = _this.image[_this.current + 1]?_this.current + 1:0;
        var next_img = _this.image[next].xOpacity;
        current_img -= .05;
        next_img += .05;
        _this.image[_this.current].xOpacity = current_img;
        _this.image[next].xOpacity = next_img;
        _this.setTransparencia(_this.image[_this.current]);
        _this.setTransparencia(_this.image[next]);
        _this.image[next].style.display = 'block';
        if(current_img <= 0){
            _this.image[_this.current].style.display = 'none';
            _this.current = next;
            setTimeout(_this.transparencia, 3000);
        }
        else{
            setTimeout(_this.transparencia, 50);
        }
    }
    this.setTransparencia = function(obj)
    {
        if(obj.xOpacity > .99){
            obj.xOpacity > .99;
            return;
        }
        obj.style.opacity = obj.xOpacity;
        obj.style.MozOpacity = obj.xOpacity;
        obj.style.filter = 'alpha(opacity=' + (obj.xOpacity * 100) + ')';
    }
    this.init = function(){_this.anyadirEvento(window,"load",_this.load)}
    this.load = function()
    {
        _this.image = document.getElementById(slide_id).getElementsByTagName('span');
        for(var i = 0; i < _this.image.length; i++){
            _this.image[i].xOpacity = 0;
        }
        _this.image[0].xOpacity = .99;
        _this.image[0].style.display = 'block';
        setTimeout(_this.transparencia, 3000);
    }
}
var slide = new slideTransparencia('slide_inicio');
slide.init();
slide = null;
