	function toggleBox(szDivID, iState) // 1 visible, 0 hidden
		{
			var obj = document.getElementById(szDivID);
			obj.style.display = iState ? "block" : "none";

		}

	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,xScroll:xScroll,yScroll:yScroll}
		return arrayPageSize;
	}
	
	function getPageScroll(){
		var yScroll;
		if (self.pageYOffset) yScroll = self.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop) yScroll = document.documentElement.scrollTop;
		else if (document.body) yScroll = document.body.scrollTop;
		arrayPageScroll = {yScroll:yScroll};
		return arrayPageScroll;
	}

 	function initZoom(container,name) {
 		if(container != null)
 		{
			var lnks = container.getElementsByTagName('a');
			for(var i=0,len=lnks.length;i<len;i++) {
				if(lnks[i].className.indexOf('ampliar') > -1) {
					lnks[i].onclick = function() {
						window.location='#';
						openZoom(this,name);
						ajustaContainer();		
						return false;
					}
				}
			}
		}
	}
	
	function closeZoom(obj) {
		document.body.removeChild(document.getElementById('zoom'));
		document.body.removeChild(document.getElementById('sombra'));
		obj.parentNode.parentNode.parentNode.removeChild(obj.parentNode.parentNode);
		
		var filtros = document.getElementsByTagName('select');
		
		for(var i=0; i < filtros.length; i++)
		{
			filtros[i].style.display = 'inline';
		}
	}
	
	
	function resizeZoom(obj) {
		var largura = 426;
		var altura = 403;
		var box = obj.parentNode;
		var pageSize = getPageSize();
		var pageScroll = getPageScroll();
		var boxTop = pageScroll.yScroll + ((pageSize.windowHeight - altura ) / 2);
		var boxLeft = ((pageSize.windowWidth - largura ) / 2);
		if(largura > pageSize.windowWidth)
		{
			boxLeft = 0;
		}
		if(altura > pageSize.windowHeight)
		{
			boxTop = 0;
		}
		box.style.top = (boxTop < 0) ? "0px" : boxTop + "px";
		box.style.left = (boxLeft < 0) ? "0px" : boxLeft + "px";
		box.style.visibility = 'visible';
		try {
			var divZoom = document.getElementById('zoom_'+obj.className);
			if(divZoom) divZoom.style.width = largura;
		} catch(erro) {}
	}
	
	function openZoom(obj,name) {
		var pageSize = getPageSize();
		var classe = 'abc';
		var divs = obj.parentNode.getElementsByTagName('div');
		
		var filtros = document.getElementsByTagName('select');
		
		for(var i =0; i < filtros.length; i++)
		{
			filtros[i].style.display = 'none';
		}

		var divContainer = document.createElement('div');
		divContainer.id = 'zoom';
		divContainer.className = 'zoom';
		divContainer.style.height = (pageSize.pageHeight + 'px');
		
		var divSombra = document.createElement('div');
		divSombra.id = 'sombra';
		divSombra.className = 'sombra';
		divSombra.style.height = (pageSize.pageHeight + 'px');
		document.body.appendChild(divSombra);
		
		var divZoom = document.createElement('div');
		divZoom.id = 'zoom_' +  classe;
		divZoom.className = 'fotoZoom';
		
		var divIframe = document.createElement('div');
			 divIframe.innerHTML = document.getElementById(name).innerHTML;
//			 divIframe.firstChild.style.display = "block";
	
		var divFechar = document.createElement('div');
		divFechar.className = 'fechar';
		
		var aFechar = document.createElement('a');
		aFechar.title = 'Fechar';
		aFechar.innerHTML = 'Fechar';
		aFechar.className = 'lnkArialBranco12B';
		aFechar.href = '#';
		aFechar.onclick = function() {
			closeZoom(this);
			return false;
		}
		
		divFechar.appendChild(aFechar);
		divZoom.appendChild(divFechar);
		divZoom.appendChild(divIframe);
		divContainer.appendChild(divZoom);		
		document.body.appendChild(divContainer);
		
		resizeZoom(divIframe);
	}
	
	
window.onresize = ajustaContainer;
function ajustaContainer() { 
 var divs = document.getElementsByTagName("div"); 
 var lumPageAux; 
 for(i=0;i<divs.length;i++) { 
    if(divs[i].className == "img_abc" || divs[i].id == "img_abc") 
    { 
      lumPageAux = divs[i];
    } 
 } 
 if(!lumPageAux) {
	lumPageAux = document.getElementById('img_abc');
 }
 if(!lumPageAux) {
   return false; 
 } 
 resizeZoom(lumPageAux); 
} 


