// Atualiza imagem da galeria
function upd_img (n) {
	img_offset += n;
	
	img = document.getElementById('galeria').getElementsByTagName('IMG')[0];
	img.src = imgs[img_offset];
	
	p_desc = document.getElementById('pic_desc');
	p_desc.innerHTML = desc[img_offset];
}
// Próxima imagem
function next_img () {
	if (img_offset < (imgs.length - 1)) {
		upd_img(1);
	}
}
// Imagem anterior
function prev_img () {
	if (img_offset > 0) {
		upd_img(-1);
	}
}

// Janela pop-up com tamanho específico e centralizada
function pop (url, width, height) {
	var top = (screen.availHeight - height) / 2;
	var left = (screen.availWidth - width) / 2;

	window.open(url, '', "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",toolbar=no,location=no,menubar=no,status=no,resizable=yes");
}

// Simulação de :hover para o IE
init = function () {
	if (document.all && document.getElementById) {
		mnu = document.getElementById('menu');
		for (i = 0; i < mnu.childNodes.length; i++) {
			node = mnu.childNodes[i];
			if (node.nodeName == 'LI') {
				node.onmouseover = function () {
					this.className += ' over';
				}
				node.onmouseout = function () {
					this.className = this.className.replace(' over', '');
				}
			}
		}
	}
}

window.onload = init;
