function wOpen(pURL, pName, w, h, scroll, text, specialSettings){
	xLeft=(screen.width)?(screen.width-w)/2:0;
	xTop=(screen.height)?(screen.height-h)/2:0;
	xSettings = 'height='+h+',width='+w+',top='+xTop+',left='+xLeft+',scrollbars='+scroll+specialSettings
	hwnd = window.open(pURL,pName,xSettings);
	if(hwnd.window.focus){hwnd.window.focus();}
	if(text != "") hwnd.document.write(text);
	hwnd.document.close();
	return hwnd;
}
var popindicacao;
function indicacao (produto) {
	if(popindicacao && !popindicacao.closed){
		popindicacao.focus();
		return;
	}
	popindicacao = wOpen("indique.php?produto="+produto, "", 550, 520, "yes", "");
}

var auto = true;
var imgatual = 0;
var imgtotal = 0;

function imgant() {
	auto = false;
	imgatual--;
	imgmuda();
}
function imgpro() {
	auto = false;
	imgatual++;
	imgmuda();
}
function imgmuda() {
	if (imgatual == imgtotal) imgatual = 0; 
	else if (imgatual < 0) imgatual = imgtotal - 1;

	document.foto.src = imagens[imgatual].src;
}
function imgauto() {
	if (auto) {
		if (imagens[(((imgatual + 1) == imgtotal) ? 0 : (imgatual + 1))].complete) {
			imgatual++;
			imgmuda();
		}
		setTimeout ("imgauto()", 2000);
	}
}
