slide = {

	//vetor com os slides ###### AQUI ADICIONA OU ATUALIZA AS NOTICIAS EX: ver modelo abaixo #######
	//["caminho e nome da img","titulo da msg","texto da msg","endereço de destino da msg"], 
	//###### Atenção coloque a virgula somente se for adicionar mais um item ao fim não coloque virgula #######
	_imagens : [
			["01.jpg","Revista Intensiva Edição Dez/2009","http://www.sobrati.com.br/ri-23.htm"],
			["02.jpg","Diretor da NASA recebe SOBRATI","astronauta-sobrati-nasa.htm"],
			["03.jpg","Iniciado Mestrado em São Paulo","mpti-sp-2010.htm"],
			["04.jpg","Morre idealizador do Swan-Ganz","william-ganz.htm"]
		],
	
	// variáveis do sistema
	_count : 0,
	_length : null,
	_timeOutID : null,
	_pause : false,
	_timer : 8,
	
	// função que inicia o slide e seta todas os parâmetros necessários
	start : function(){
		with(this){ _preLoader(); _length = _imagens.length; _work(); }
	},
	
	// faz o pré-carregamento das imagens
	_preLoader : function(){
		for(x in this._imagens){
			var image = new Image();
			image.src = this._imagens[x][0];
		}
	},
	
	// função principal que faz as checagens necessárias
	_work : function(){
		with(this){
			(_count == _length) ? _count = 0 : (_count < 0) ? _count = _length-1 : void(0);
			var current = _imagens[_count];
			_exchange(current);
			if(!_pause){
				(typeof(_timeOutID) == "number") ? clearTimeout(_timeOutID) : void(0);
				_timeOutID = setTimeout(function(){ slide.next(); }, (Number(_timer)*1000));
			}
		}
	},
	
	// função que altera os elementos da página, altere os IDs se necessário
	_exchange : function(img){
		document.getElementById("slideImg").src = img[0];
		document.getElementById("linkSlide").innerHTML = img[1];
		document.getElementById("linkSlide").href = img[2];	
	},
	
	// altera para o próximo slide ao clicar no botão Próximo
	next : function(){
		with(this){ _count++; _work(); }
	},
	
	// altera para o slide anterior ao clicar no botão correspondente
	previous : function(){
		with(this){ _count--; _work(); }
	},
	
	// pause e continua a apresentação
	pause : function(){
		var img = document.getElementById("playpause");
		if(this._pause){ this._pause = false; img.src = 'layout/img/pause.gif'; img.title = 'Parar'; }
		else{ this._pause = true; img.src = 'layout/img/play.gif'; img.title = 'Continuar'; }
		with(this){(typeof(_timeOutID) == "number") ? clearTimeout(_timeOutID) : void(0); _work();}
	},
	
	// controla o tempo de troca de cada slide
	tControl : function(act){
		with(this){
		(act=="m")?((_timer==4)?void(0):_timer=_timer-1):((_timer==9)?void(0):_timer= _timer +1);
			document.getElementById('showTimer').innerHTML = _timer+"s";	
		}
		
	}	
}
