slide = {
	_imagens : [["../images/noticias/119/sesso_do_dia_02_03_10_007.jpg","Miron esclarece dúvidas aos funcionários da Santa Casa de Coxim.","?pg=destaques&id=119"] ],
	_slideImg : 'slideImg',
	_titleSlide: 'titleSlide',
	_linkSlide : 'linkSlide',
	_playPause : 'playpause',
	_showTimer : 'showTimer',
	_count : 0,
	_length : null,
	_timeOutID : null,
	_pause : false,
	_timer : 90,
	
	start : function(){
		with(this){
			_preLoader();
			_length = _imagens.length;
			_work(); 
		}
	},
	
	_preLoader : function(){
		for(x in this._imagens){
			var image = new Image();
			image.src = this._imagens[x][0];
		}
	},
	
	_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();
							fade(0,0,$(_slideImg));
						}, (Number(_timer)*1000)
				);
			}
		}
	},
	
	_exchange : function(img){
		this.$(this._slideImg).src = img[0];
		this.$(this._titleSlide).innerHTML = img[1];
		this.$(this._linkSlide).href = img[2];
		this.fade(0,100,this.$(this._slideImg));
	},
	
	next : function(){
		with(this){
			_count++;
			_work();
		}
	},
	
	previous : function(){
		with(this){
			_count--;
			_work();
		}
	},
	
	pause : function(){
		var img = this.$(this._playPause);
		if(this._pause){
			this._pause = false;
					img.src = 'imgs/pause.gif';
				img.title = 'Parar';
		}
		else{
			this._pause = true;
					img.src = 'imgs/play.gif';
				img.title = 'Continuar';
		}
		with(this){(typeof(_timeOutID) == 'number') ? clearTimeout(_timeOutID) : void(0); _work();}
	},
	
	tControl : function(act){
		with(this){
		(act=='m')?((_timer==4)?void(0):_timer=_timer-1):((_timer==9)?void(0):_timer= _timer +1);
			this.$(this._showTimer).innerHTML = _timer+'s';	
		}
		
	},
	
	fade : function (){
		
		var type,signal;
		var from 	= arguments[0];
		var to		= arguments[1];
		var el		= arguments[2];
		
		(document.all) ? type = 'filter' : type = 'opacity';
		(from>to) ? signal = '-' : signal= '+';
		
		if(from >= to/2){
			from = eval(from+signal+10);
		}else{
			from = eval(from+signal+5);
		}
		
		if(type=='opacity'){
			try{el.style[type] = Number(from*0.01); }catch(e){}
		}else{
			try{el.style[type] = 'alpha(opacity='+from+')'; }catch(e){}
		}
		
		if(from != to){
			setTimeout( function(){ slide.fade(from,to,slide.$(slide._slideImg)); } ,50);
		}
	},
	
	$ : function(){
		return document.getElementById(arguments[0]);	
	}
}
