//SlideShow-->
var _length;


slide = {
	
	
	_count : 0,
	
	
	
	_timeOutID : null,
	
	pause : false,
	
	_start : function(){
		this._preLoader();
		this._work();
	},
        _dados : function(valor){
		this._imagens = valor;		
	}
        ,
	
		_preLoader : function(){
		for(x in this._imagens){
			var image = new Image();
			//alert(this._imagens[x][0]);            
			image.src = this._imagens[x][0];
		}
	},
	
	_work : function(){
		(this._count == this._length) ? this._count = 0 : (this._count < 0) ? this._count = this._length-1 : void(0);
		var current = this._imagens[this._count];
		this._exchange(current);
		if(!this.pause){
			(typeof(this._timeOutID) == "number") ? clearTimeout(this._timeOutID) : void(0);
			this._timeOutID = setTimeout(function(){ slide._next(); }, 7000);
		}
	},
	
	_exchange : function(img){
		
                document.getElementById("slideImg").style.background = "url("+img[0]+")";
		
                var clickImg = document.getElementById("textSlide");
                
                clickImg.onclick = function() { abrir(img[1]); }
                
                
                
               // document.getElementById("link").href = img[1]
		document.getElementById("textSlide").innerHTML = img[2];
	// Se ligar nas diferenças de cada objeto, Ex.: src, href e innerHTML.
	},
	
	_next : function(){
		this._count++;
		this._work();
	},
	
	_previous : function(){
		this._count--;
		this._work();
	},
	
	_pause : function(){
		var img = document.getElementById("play|pause");
		if(this.pause){
			this.pause = false;
			img.src = 'images/pause.gif';
			img.title = 'Parar';
		}
		else{
			this.pause = true;
			img.src = 'images/play.gif';
			img.title = 'Continuar';		
		}
		(typeof(this._timeOutID) == "number") ? clearTimeout(this._timeOutID) : void(0);
		this._work();
	}
}
//SlideShow-->