// FIX LAYOUT - GENERAL
function fixCssLayout(e)
	{
		fixCssHeight(); // ALTURAS
		
		try{ fixLeftMarginHiding(); }catch(e){;}
		try{ window.onresize=fixLeftMarginHiding; }catch(e){;}
		
		try { // MENU ESQUERDA
			var ray = document.getElementById('Menu').getElementsByTagName('p');
			for (i in ray) {
				if(ray[i].className != 'secao') {
					
					ray[i].onmouseover = function(){ 
						//this.style.backgroundColor = '#EAEAEA';
						this.style.backgroundColor = '#333333';
						this.getElementsByTagName('A').item(0).style.color = '#FFFFFF';
						this.style.cursor = "pointer";
					} ;
					ray[i].onmouseout = function(){ 
						this.style.backgroundColor = 'transparent'; 
						this.getElementsByTagName('A').item(0).style.color = '#000000';
					} ;
					ray[i].onclick = function(e){ 
						var evtobj = window.event ? event : e;
						if (evtobj.altKey || evtobj.ctrlKey || evtobj.shiftKey) {
							return;
						}
						window.location.assign(this.getElementsByTagName('A').item(0).getAttribute('href'));
					} ;
					
				}
			}
		}catch(e){;}
	}

var fixcss_h_ray = new Array;
var fixcss_minh_ray = new Array;
var fixcss_h_ray_m = new Array;
var fixcss_flashloader = new Array;

function fixCssHeight()
	{
		// min height
		for(i in fixcss_minh_ray)
			{
				if( getElHeight(getE(i)) < fixcss_minh_ray[i] )
					getE(i).style.height = fixcss_minh_ray[i] + 'px';
			}
		// flash loader
		for(i in fixcss_flashloader)
			{
				getE(i).innerHTML = getE(fixcss_flashloader[i]).innerHTML;
			}
		
		// inherit height fix -- !!! always last
		for(i in fixcss_h_ray)
			{
				if(getElHeight(getE(i)) <= getElHeight(getE(fixcss_h_ray[i])))
					getE(i).style.height = getElHeight(getE(fixcss_h_ray[i])) + 'px';
			}
		// inherit height fix -- !!! always last
		for(i in fixcss_h_ray_m)
			{
				getE(i).style.height = (getElHeight(getE(fixcss_h_ray_m[i][0])) + fixcss_h_ray_m[i][1]) + 'px';
			}
	}

// FIX IMG MARGIN NOT BEING SHOWN
function fixImgMargin (el) {
	if(navigator.appName != 'Microsoft Internet Explorer') {						
		var here_imgs = document.getElementById(el).getElementsByTagName('img');
		for(i=0;i<here_imgs.length;i++)
			{
				try {
					here_imgs[i].style.marginLeft = here_imgs[i].getAttribute('hspace') + 'pt';
					here_imgs[i].style.marginRight = here_imgs[i].getAttribute('hspace') + 'pt';
				} catch(e) {}
				try {
					here_imgs[i].style.marginTop = here_imgs[i].getAttribute('vspace') + 'pt';
					here_imgs[i].style.marginBottom = here_imgs[i].getAttribute('vspace') + 'pt';
				} catch(e) {}
			}
	}
}

// FIX BROWSER WINDOW HIDING
function fixLeftMarginHiding() {
	if(getE('Container').style.marginLeft && getE('Container').style.width) {
		var iwidth = noPx(getE('Container').style.width)+noPx(getE('Container').style.paddingLeft)+noPx(getE('Container').style.paddingRight);
		var imargin = noPx(getE('Container').style.marginLeft);
	} else {
		if(isIe()) {
			var iwidth = noPx(getStyle(getE('Container'), 'width'))+noPx(getStyle(getE('Container'), 'paddingLeft'))+noPx(getStyle(getE('Container'), 'paddingRight'));
			var imargin = noPx(getStyle(getE('Container'), 'marginLeft'));
		} else {
			var iwidth = noPx(getStyle(getE('Container'), 'width'))+noPx(getStyle(getE('Container'), 'padding-left'))+noPx(getStyle(getE('Container'), 'padding-right'));
			var imargin = noPx(getStyle(getE('Container'), 'margin-left'));
		}
	}
	
	if(iwidth > getWinSize(window).w ) {
		if(imargin < 0) {
			getE('Container').style.marginLeft = 0;
			getE('Container').style.left = 0;
		}
	}
	else {
		if(imargin == 0) {
			getE('Container').style.marginLeft = '-' + (Math.round(iwidth / 2)+10) + 'px';
			getE('Container').style.left = '50%';
		}
	}
}