// JavaScript Document

function MarcaMenu(Div)
{
	Div.style.color = "#000000";
}

function DesmarcaMenu(Div)
{
	Div.style.color = "#FFFFFF";
}

function EnviarEmail() 
{
	if (document.User.edt_Nome.value == "")
	{
		document.User.edt_Nome.style.backgroundColor = "#8698b7";
		document.User.edt_Nome.focus();
		return;				
	}
	else
	{
		document.User.edt_Nome.style.backgroundColor = "#ffffff";		
	}
	
	if (document.User.edt_Email.value == "")
	{
		document.User.edt_Email.style.backgroundColor = "#8698b7";
		document.User.edt_Email.focus();
		return;				
	}
	else
	{
		document.User.edt_Email.style.color = "#ffffff";		
	}	
	
	if ((document.User.edt_Email.value == "") || 
		  (document.User.edt_Email.value.length > 0 && 
		  (document.User.edt_Email.value.indexOf("@",0) == - 1 || 
		   document.User.edt_Email.value.indexOf(".",0) == - 1))) 	
	{	
		document.User.edt_Email.style.backgroundColor = "#8698b7";
		document.User.edt_Email.focus();		
		return;		
	}
	else
	{
		document.User.edt_Email.style.backgroundColor = "#ffffff";
	}	
	
	if (document.User.edt_Assunto.value == "")
	{
		document.User.edt_Assunto.style.backgroundColor = "#8698b7";
		document.User.edt_Assunto.focus();
		return;				
	}
	else
	{
		document.User.edt_Assunto.style.backgroundColor = "#ffffff";		
	}	
	
	if (document.User.edt_Mensagem.value == "")
	{
		document.User.edt_Mensagem.style.backgroundColor = "#8698b7";
		document.User.edt_Mensagem.focus();		
		return;		
	}
	else
	{
		document.User.edt_Mensagem.style.backgroundColor = "#ffffff";		
	}	
	
	with(document.User)
	{
		method = "post";
		action = "FaleConoscoEnvia.asp";
		submit();
	}
}

function formata_data( x, tecla)
{
	separador = "/";
			
	tecla = tecla.keyCode;
			
	valor = x.value.split('');
	formatado = "";
			
	i = 0;
			
	while( i < valor.length)
	{
		caractere = valor[i];
		numeros = /^\d+$/;
		
		if(numeros.test(caractere) || caractere == separador)
		{
			formatado += String(caractere);
		}
		
		if((formatado.length == 2 || formatado.length == 5 ) && tecla != 8 )
		{
			formatado += separador; i++;
		}
							
		i++;
	}
			
	x.value = formatado;
}

function NumerosKeyPress(tecla)
{
  if(typeof(tecla) == 'undefined')
  
  var tecla = window.event; 
  var codigo = (tecla.which ? tecla.which : tecla.keyCode ? tecla.keyCode : tecla.charCode);

	if (codigo == '13' || codigo == '27')
	{
    return true;
	}
	else if (codigo < '48' || codigo > '58')
	{
    return false;
	}  
}

function NumerosKeyDown()
{
  if (event.ctrlKey)
  {
    return false;
	}
	
	return true;
}

function FileKeyPress(tecla)
{
  return false; 
}

function FileKeyDown()
{
  if (event.ctrlKey)
  {
    return false;
	}
	
	return true;
}

function Proximo(Qtd, objeto, obeto1)
{
	campo = eval(objeto);
	
	if (campo.value.length == Qtd)
	{
		obeto1.focus();
	}	
}