// JavaScript Document

function align(){

	var lmt = document.getElementById('site');
	var container = document.documentElement;

	if(lmt && container){
	    var containerWidth;
	    var containerHeight;
	    if (container.innerWidth){
            containerWidth = container.innerWidth;
            containerHeight = container.innerHeight;
		}else{
            containerWidth = container.clientWidth;
            containerHeight = container.clientHeight;
		}
		
	    var lmtWidth;
	    var lmtHeight;
	    if (lmt.innerWidth){
            lmtWidth = lmt.innerWidth;
            lmtHeight = lmt.innerHeight;
		}else{
            lmtWidth = lmt.offsetWidth;
            lmtHeight = lmt.offsetHeight;
		}
		
		var x = Math.ceil((containerWidth - lmtWidth) / 2);
		var y = Math.ceil((containerHeight - lmtHeight) / 2);
		if(y<0){
			y = 0;
		}
		if(x<0){
			x = 0;
		}
		
		// adjust site
		lmt.style.position = "relative";
		lmt.style.left = x + "px";
		//lmt.style.top = y + "px";
		
		// adjust quad
		document.getElementById('quad').style.left = x + "px";
		//document.getElementById('quad').style.top = (y+40) + "px";
		// adjust title
		document.getElementById('titulo_p').style.left = x + "px";
		document.getElementById('titulo_p').style.top = "185px";
		
	}
	if (document.getElementById)
	{
		document.body.style.visibility = 'visible';
	}

}

function addevent(obj,evt,fn,capt){
	if(obj.addEventListener)
	{
		obj.addEventListener(evt, fn, capt);
		return true;
	}
	else if(obj.attachEvent)
	{
		obj.attachEvent('on'+evt, fn);
		return true;
	}
	else return false;
}

if (document.getElementById && document.getElementsByTagName)
{
	addevent(window, 'load', align, false);
	addevent(window, 'resize', align, false);
}
