var status = 0;

function showhide(lyr,type)
{
	if(document.getElementById(lyr).style.display == "block")
	{
		$("#uniSP").fadeOut("slow");
		document.getElementById('footer-universo-image').src = "_img/footer-universo-sp.gif";
		status = 1;
		return;
	}
	if(type == "show")
	{
		$("#"+lyr).fadeIn("slow");
		document.getElementById('footer-universo-image').src = "_img/footer-universo-sp-up.gif";
		status = 1;
	}
}


function setLyr(obj,lyr,type)
{
		var coors = findPos(obj);
		var x = document.getElementById(lyr);
			if(navigator.appName == "Netscape")
			{
			x.style.top = coors[1] - 110 + 'px';
			x.style.left = coors[0] - 405 + 'px';
			}
		else{
			x.style.top = coors[1] - 88 + 'px';
			x.style.left = coors[0] - 405 + 'px';
			}
		showhide(lyr,type);

}

function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function mouseLeaves (element, evt)
{

	if (typeof evt.toElement != 'undefined' && typeof element.contains != 'undefined') 
	{
		return !element.contains(evt.toElement);
	}
	else if (typeof evt.relatedTarget != 'undefined' && evt.relatedTarget)
	{
		return !contains(element, evt.relatedTarget);
	}
}

function contains (container, containee)
{
	
	
	while (containee)
	{
		if (container == containee) 
		{
			return true;
		}
		containee = containee.parentNode;
	}
	return false;
}


function hideElement (element)
{
	if(status == 1)
	{
		if (element.style)
		{
			$("#uniSP").fadeOut("slow");
			document.getElementById('footer-universo-image').src = "_img/footer-universo-sp.gif";
		}
		status = 0;
	}
}

function debug(txt)
{
	document.getElementById('javascrip-debug').innerHTML = document.getElementById('javascrip-debug').innerHTML + txt + "<br>";
}
