function abrirJanela( url, nome ) {
	ft = 'width=$w$, height=$h$';
	ft = ft.replace( '$w$', screen.Width-10);
	ft = ft.replace( '$h$', screen.Height-90);

	ft = ft + 'toolbar=no, menubar=no, scrollbars=yes, status=yes, left=1, top=1';
	w = window.open( url, nome, ft );
}

function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
		while(1) 
		{
			curleft += obj.offsetLeft;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	
	if(obj.offsetParent) {
		
		while(1)
		{
			curtop += obj.offsetTop;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	}	
	else if(obj.y)
		curtop += obj.y;
	return curtop;
}

function enviarEmail(){
	var m = "mailto:?subject=" + escape("Indicação de Página") + "&body=" + escape("Você esta recebendo um convite para a seguinte página do site Arcelor Brasil ");
	var n = m.split("<");
	t = n[0];
	for (i=1; i < n.length; i++) {
		a = n[i].split(">");
		t+=a[1];
	}
	location = t +  escape(location.href);
}

function mostraObrigatoriedade(id, altura, largura, texto){
	
	
	//Função foi modificada para utilizar calculo automático de posicionamento.
	var posicao = findPos(document.getElementById(id));
	
	
	var posicaoCaixaY = posicao[1] + 30;
	var posicaoCaixaX = posicao[0] + 3;
	
	document.getElementById("preenchimento").style.top = posicaoCaixaY;
	document.getElementById("preenchimento").style.left = posicaoCaixaX;
	
	
	/*ESSA PARTE ERA UTILIZADA PARA EFETUAR CALCULO DOS ITENS*/
	/*NÂO È MAIS EFETUADA DEVIDO AO ITEM SER CONFIGURADO DE FORMA AUTOMÀTICA*/
	/*if(altura == 0){
		document.getElementById("preenchimento").style.top = document.getElementById(id).parentNode.offsetTop + 556
	}
	else{
		document.getElementById("preenchimento").style.top = document.getElementById(id).offsetTop + altura + 23
	}			
	document.getElementById("preenchimento").style.left = document.getElementById(id).parentNode.offsetLeft + largura*/
	/*FIM DE CALCULO MANUAL*/	
		
		
	document.getElementById("preenchimento").style.display = "block"
	document.getElementById("preenchimento").innerHTML = "<img src='../../Images/Site/cadastro/box_01.gif'><br><div style=\"width: 176px;\"><div style=\"padding: 0px 5px 0px 5px;\">" + texto + "</div></div><img src='../../Images/Site/cadastro/box_02.gif'><br>"
	
	//esconde os combos
	var selects = document.getElementsByTagName('select');
	for(var i = 0; i < selects.length; i ++)
		selects[i].style.visibility = 'visible';
}

function escondeObrigatoriedade(){
	document.getElementById("preenchimento").style.display = "none"	
	
	//mostra os combos
	var selects = document.getElementsByTagName('select');
	for(var i = 0; i < selects.length; i ++)
		selects[i].style.visibility = 'visible';
}

function showMenu(id, s) {
	var o = document.getElementById(id);
	if (o != null) {
		o.style.display = 'block';
		if (s != null) {
			if (String(o.id).search('SubItem') < 0) {
				o.style.left = s.getClientRects()[0].left-5;
			} else if (String(o.id).search('SubItem_') > -1) {
				o.style.left = s.getClientRects()[0].right - s.getClientRects()[0].left;
				o.style.top = s.offsetTop-1; //s.getClientRects()[0].top;
			} else if (String(o.id).search('SubItemLat_') > -1) {
				var p = findPos(s);
				o.style.left = p[0] + (s.getClientRects()[0].right - s.getClientRects()[0].left);
				o.style.top = p[1]-1;
			} 
		}
	} 
}

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 hideMenu(id) {
	var o = document.getElementById(id);
	if (o != null) {
		o.style.display = 'none';
	} 
}

function imprimir(){
	window.print();
}
	
