function initZoomImages()
{
	for(i=0;i<document.links.length;i++)
	{
		currentLink=document.links[i];
		if(currentLink.className && currentLink.className.search(/zoomContainer/) != -1)
		{
			currentLink.onclick=function()
			{
				doZoom(this);
				return false;
			}
		}
	}
}

function doZoom(container)
{
	image = getInsideImage(container);
	if(container.href == image.src)
	{
		zoomImage(image);
	}
	else
	{
		img = new Image();
		img.onload = function()
		{
			zoomImage(this);
		}
		
		img.setAttribute('alt',image.attributes['alt'].value);
		img.src = container.href;
	}
}
function getInsideImage(container)
{
	image='';
	for(child=0;child<container.childNodes.length;child++)
	{
		if(container.childNodes[child].nodeName.toLowerCase()=='img')
			image=container.childNodes[child];
	}
	return image;
}
function zoomImage(image)// V 2.5
{
	if(typeof image == 'string')
	{
		img = new Image();
		img.src = image;
		img.onload = function(){zoomImage(this)};
		return 0;
	}
	pos = new Object(
	{
		'top' : window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
	});

	showOverlay();
	div=document.createElement('div');
	div.setAttribute('id','ss_jsImgHolder');
	div.style['visibility'] = 'hidden';
	getBody().appendChild(div);

	img=document.createElement('img');
	img.src=image.src;
	div.appendChild(img);
	
	if(image.attributes['alt'])
	{
		p=document.createElement('p');
		p.setAttribute('id','ss_jsLegend');
		div.appendChild(p);
		p.innerHTML=image.attributes['alt'].value;
	}
	
	a=document.createElement('a');
	a.className='noText';
	a.setAttribute('id','ss_jsCloseHolder');
	a.onclick=function() { unzoomImage(); }
	div.appendChild(a);

	max_width=600;
	max_height=480;
	
	p_height = Math.ceil((image.height * max_width) / image.width);
	if(p_height>max_height)
	{
		p_width = Math.ceil((image.width * max_height) / image.height);
		p_height = max_height;
		
		if(p_width < 415)
		{
			margin = ((415-p_width)/2)-10;
			
			img.style['margin'] = '0 0 0 '+margin+'px';
		}
	}
	else p_width = max_width;

	img.width = p_width;
	img.height = p_height;

	topDist = ((getPageSize()[2]/2)-((img.height/2)+40));
	
	div.style['top'] = (pos.top+topDist)+'px';
	div.style['left']=((getPageSize()[0]/2)- ((img.width/2)+40))+'px'; // 40 = left padd + right padd

	div.style['visibility'] = 'visible';
}
function unzoomImage()
{
	hideOverlay();
	getBody().removeChild(document.getElementById('ss_jsImgHolder'));
}
function hideOverlay()
{
	getOverlay().style['display']='none';	
	getBody().style['overflow']='visible';
}
function showOverlay()
{
	getOverlay().style['width']=getPageSize()[0]+'px';
	getOverlay().style['height']=getPageSize()[1]+'px';
	getOverlay().style['display']='block';	
	//getBody().style['overflow']='hidden'; //improve-me
}
function getOverlay()
{
	if(!(div=document.getElementById('ss_jsBodyOverlay')))
	{
		div=document.createElement('div');
		div.setAttribute('id','ss_jsBodyOverlay');
		div.onclick=function() { unzoomImage(); }
		getBody().appendChild(div);
	}
	return div;
}
function getBody()
{
	if(!document.body)
	{
		for(n1=0;n1<document.childNodes.length;n1++)
			if((htmlNode=document.childNodes[n1]).nodeName.toLowerCase()=='html')
				for(n2=0;n2<htmlNode.childNodes.length;n2++)
					if((bodyNode=htmlNode.childNodes[n2]).nodeName.toLowerCase()=='body')
						return bodyNode;
	}
	else
		return document.body;
}
function getHead()
{
	for(n1=0;n1<document.childNodes.length;n1++)
		if((headNode=document.childNodes[n1]).nodeName.toLowerCase()=='head')
			return headNode;
}
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)
	{ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	}
	else
	{ // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight)
	{	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	}
	else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight)
	{
		pageHeight = windowHeight;
	}
	else
	{
		pageHeight = yScroll;
	}
	return [windowWidth, pageHeight, windowHeight];
}

Array.prototype.hasValue=function(value)
{
	for(n=0;n<this.length;n++)
		if(this[n]==value)
			return true;
	return false;
}

var GET ={
	_constructor : function()
	{
		try	{ qString=window.location.search; } catch(e) { }
		if(qString)
		{
			if(qString.indexOf('?')==0) qString=qString.replace('?','');
			qStrings=qString.split('&');
			for(i in qStrings)
			{
				if(!(qStrings[i] instanceof Function))
				{
					current=qStrings[i].split('=');
					this[current[0]]=current[1];
				}
			}
		}
	}
}
GET._constructor();

var __scripts=new Array();
function require_once(script)
{
	if(!__scripts.hasValue(script))
	{
		inc=document.createElement('script');
		inc.setAttribute('type','text/javascript');
		getBody().appendChild(inc);
		inc.setAttribute('src','http://www.tripoa.com.br/files/scripts/'+script+'.js');
		inc.src='http://www.tripoa.com.br/files/scripts/'+script+'.js';
		__scripts.push(script);
		return true;
	}
	else return true;
}