objBotao = null;
slide    = null;
	
function $(id){ return document.getElementById(id); }

function expand(idSelect) {
	$(idSelect).click();
}

function imprimir() {
	window.print();
}

function redefinirTamanho(w, h) {
	if (parseInt(navigator.appVersion) > 3) {
		if (navigator.appName == "Netscape") {
			top.outerWidth  = w;
			top.outerHeight = h;
		} else {
			top.resizeTo(w, h) ;
		}
	}
}

SlideShow = function () {
	this.parado = true;
	this.velocidadeMinima = 1000;
	this.velocidadeMaxima = this.velocidadeMinima*6;
	this.velocidade       = this.velocidadeMaxima/2;
	this.tempo = null;
	
	this.iniciar = function () {
		objBotao.onclick = function () { slide.parar() };
		objBotao.className = "stop";

		if(this.parado) {
			this.parado = false;
			
			this.tempo = window.setTimeout(function () {
				if((idxatual + 1) == fotos.length) {
					idxatual = -1;
				}
				
				mudaFoto(idxatual + 1);
							
				window.setTimeout(function () {
					slide.parar();
					slide.iniciar();
				}, 10);
				
			}, this.obterVelocidade());
		}
	}
	
	this.obterVelocidade = function () {
		return this.velocidade;
	}
	
	this.definirVelocidade = function (velo) {
		this.velocidade = velo;
	}
	
	this.parar = function () {
		objBotao.onclick = function () { slide.iniciar() };
		objBotao.className = "play";

		this.parado = true;
		window.clearTimeout(this.tempo);
	}
	
	this.aumentarIntervalo = function () {
		if((this.obterVelocidade() + this.velocidadeMinima) <= this.velocidadeMaxima) {
			this.definirVelocidade(this.obterVelocidade() + this.velocidadeMinima);
		}
	}
	
	this.diminuirIntervalo = function () {
		if((this.obterVelocidade() - this.velocidadeMinima) >= this.velocidadeMinima) {
			this.definirVelocidade(this.obterVelocidade() - this.velocidadeMinima);
		}		
	}
};
