//função para diminuir o tamanho do flsh em caso de foto unica
function getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY){
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	if(yScroll < windowHeight) pageHeight = windowHeight;
	else pageHeight = yScroll;
	if(xScroll < windowWidth) pageWidth = windowWidth;
	else pageWidth = xScroll;
	arrayPageSize = {pageWidth:pageWidth,pageHeight:pageHeight,windowWidth:windowWidth,windowHeight:windowHeight}
	return arrayPageSize;
}

function abrirImagem(caminho,altura,largura)
{
	//pegando altura do body - ie6
	var pageSize = getPageSize();
	document.getElementById('mascara').style.height = (pageSize.pageHeight + 'px');
	
	document.getElementById('caixa').innerHTML 		= '<img src="'+caminho+'" height="'+altura+'" width="'+largura+'" alt="Clique na imagem para fechar"><div id="caixa_legenda">Clique na imagem para fechar</div>';
	
	document.getElementById('caixa').style.width 	= largura+'px';
	
	n_altura = parseInt(altura) + 20;
	
	document.getElementById('caixa').style.height 	= n_altura +'px';
	
	document.getElementById('caixa').style.margin = "-"+ altura/2 + "px 0 0 -" + largura/2 + "px";
	
	document.getElementById('mascara').style.display 	= '';
	
	document.getElementById('caixa').style.display 	= '';
}

function fechar()
{
	document.getElementById('caixa').innerHTML 		= '';
	document.getElementById('mascara').style.display 	= 'none';
	document.getElementById('caixa').style.display 	= 'none';
}