// Funções gerais do portal loterias
/**************************************************************************
 Function:	mandaEmail
 Purpose:	verifica se o campo e-mail está correto e submete a página push
 **************************************************************************/
function mandaEmail(idResposta,idEmail,idfrm)
{
	var objResposta = document.getElementById(idResposta);
	var objEmail = document.getElementById(idEmail);
	
	if (formatonulo(objEmail.value)) 
	{
		objResposta.innerHTML = ("<b>Informe seu e-mail!</b>");
		objEmail.focus();
	}
	else if (verifica_acento(objEmail.value, objEmail.length)) 
	{
		objResposta.innerHTML = ("<b>O e-mail não pode conter acentos!</b>"); 
		objEmail.focus();
	}
	else if (!EmailCorreto(objEmail.value)) 
	{
		objResposta.innerHTML = ("<b>E-mail inválido!</b><br />Por favor informe seu e-mail no seguinte formato:<br /> <b>usuario@provedor</b>");
		objEmail.focus();
	}     
	else
	{
		document.getElementById(idfrm).submit();
	}					 
}

/**************************************************************************
 Function:	montar_acoes
 Purpose:	insere nas tabelas os id e as ações necessárias para funcionar 
			o sombreamento de cada linha da tabela, passando como referencia 
			o id da div que contem a(s) tabela(s)
 **************************************************************************/

function montar_acoes(alvo){
	var oDiv = document.getElementById(alvo);
	
	var elementos = oDiv.getElementsByTagName("tr");
	for(var w = 0; w < elementos.length; w++) { 
	
		var ide;
		var itemTD = elementos.item(w); 
		
		ide = "linhas";
		if (w>9){
			ide = ide + w.toString()+"0";
		}else if(w>99){
			ide = ide + w.toString()+"00";
		}else{
			ide = ide + w.toString();
		}
		itemTD.id = ide;
		var aDiv = document.getElementById(ide);
		var elemento = aDiv.getElementsByTagName("td");
	
		for(var i = 0; i < elemento.length; i++) { 
			   var itemTR = elemento.item(i);
			   itemTR.id = ide+i.toString();
				//alert(itemTR.id);
			   itemTR.onmouseover = trocaBG;
			   itemTR.onmouseout = voltaBG;
			   
		}
	
	}
}

/**************************************************************************
 Function:	trocaBG() e voltaBG
 Purpose:	ações de sombreamento das linhas da tabela
 **************************************************************************/
function trocaBG()
{
	var Ide = this.id;
	Ide = Ide.substring(0,Ide.length-1);
  	var novo_elemento = document.getElementById(Ide);
	novo_elemento.style.background = "#EBEBEB";
	novo_elemento.style.background = "#EBEBEB";
}

function voltaBG()
{
	var Ide = this.id;
	Ide = Ide.substring(0,Ide.length-1);
  	var novo_elemento = document.getElementById(Ide);
	novo_elemento.style.background = null;
}

/**************************************************************************/
