/* $BD:Slide - version 0.9.4$ $LastModified: 04/02/2006$ Sistema Free para uso pessoal ou comercial contanto que os créditos permaneçam intactos. Eu já nem estou colocando um monte de coisa pra não deixar o código pesado. ^^ Maiores Informações: http://my.opera.com/bimonti/ */ slide = { //vetor com os slides _imagens : [ ["includes/thumb.php?imagem=../upload/3084f295d20949a7bdf833ab4b26c6d0.JPG&x=270&y=210","Eleições do Conselho Tutelar acontecem hoje, 4 ...","","noticia_ler.php?s=4&conteudo_id=2216"],["includes/thumb.php?imagem=../upload/effc009f0430a02472b321ed443d81a2.JPG&x=270&y=210","Puleirão: O sonho durou pouco","","noticia_ler.php?s=3&conteudo_id=2215"],["includes/thumb.php?imagem=../upload/bf78e6f7af3e01ad34393fa887494c3b.JPG&x=270&y=210","Van com 12 ocupantes capota no final da Castelo B...","","noticia_ler.php?s=1&conteudo_id=2214"],["includes/thumb.php?imagem=../upload/b7ae7a71f0337897ccf2616c779ef092.jpg&x=270&y=210","Vagas de emprego para o dia 06 de Setembro","","noticia_ler.php?s=7&conteudo_id=2213"],["includes/thumb.php?imagem=../upload/4e36ca7213b064f9ebdbd6c49c6d2fc0.jpg&x=270&y=210","Bandidos aplicam novo golpe do telefone","","noticia_ler.php?s=1&conteudo_id=2212"] ], // variáveis do sistema _count : 0, _length : null, _timeOutID : null, _pause : false, _timer : 10, // 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("textSlide").innerHTML = img[2]; document.getElementById("linkSlide").href = img[3]; document.getElementById("linkSlideImg").href = img[3]; }, // 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 = 'imagens/pause.jpg'; img.title = 'Parar'; } else{ this._pause = true; img.src = 'imagens/play.jpg'; img.title = 'Continuar'; } with(this){(typeof(_timeOutID) == "number") ? clearTimeout(_timeOutID) : void(0); _work();} } }