// JavaScript para o site Recanto Som das Įguas

var novaImagem = new Array();
var fotoConta = 0;

function mudaFoto(imagem) {
	img = document.getElementById('fotoPrincipal');
	novaImagem[fotoConta] = new Image();
	novaImagem[fotoConta].src = imagem;
	setTimeout('verificaLoad('+fotoConta+')', 100 );
	img.src = imagem;
}

function verificaLoad(atual) {
	if (novaImagem[atual].complete ) {
		loading(0);
	}
	else {
		loading(1);
		setTimeout('verificaLoad('+atual+')', 100 );
	}
}


function loading(estado) {
	var loading = document.getElementById('loading');
	if (estado == 1) {
		loading.style.display = 'block';
	}
	else {
		loading.style.display = 'none';
	}
}

function fcBotao(numero,estado) { // numbero = <int>, estado = <int 1,0>
	var obj = 'botao'+numero;
	var classec = 'botao'+numero+'c';
	botao = document.getElementById(obj);
	botao.className = (estado == 1)?obj:classec;
}

function abriMapa() {
	var largura = 640;
	var altura = 480;
	window.open('mapa.php',"Mapa","top=" + parseInt((screen.availHeight/2) - (altura/2))+ " , left=" + parseInt((screen.availWidth/2) - (largura/2)) + " directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, titlebar=yes, toolbar=no, width=" + largura + ", height=" + altura, false);
}

function marcaLink(id) {
	var i = 1;
	var atual = 'opcao'+i;
	var obj = document.getElementById(atual);
	while (obj.className != '') {
		if (i != id) {
			obj.className = 'normal';
		}
		else {
			obj.className = 'selecionado';
		}
		i++;
		atual = 'opcao'+i;
		obj = document.getElementById(atual);
	}
}

function goto(url) {
	document.location.href = url;
}