function MostraTelefone( telefone )
{
	document.getElementById('NumTelefone').innerHTML = telefone;
}

function linkCadastro ( option )
{
	switch (option)
	{
		case "opcao1":
			document.getElementById("opcao1").src = "Imagens/radio-checked.gif" ;
			document.getElementById("opcao2").src = "Imagens/radio-nochecked.gif" ;
			document.getElementById("opcao3").src = "Imagens/radio-nochecked.gif" ;
			document.getElementById("CadastroLink").value = "CadastroNewsletter.asp" ;
			break;
		case "opcao2":
			document.getElementById("opcao1").src = "Imagens/radio-nochecked.gif"; 
			document.getElementById("opcao2").src = "Imagens/radio-checked.gif" ;
			document.getElementById("opcao3").src = "Imagens/radio-nochecked.gif"; 
			document.getElementById("CadastroLink").value = "CadastroCurriculo.asp"; 
			break;
		case "opcao3":
			document.getElementById("opcao1").src = "Imagens/radio-nochecked.gif"; 
			document.getElementById("opcao2").src = "Imagens/radio-nochecked.gif"; 
			document.getElementById("opcao3").src = "Imagens/radio-checked.gif"; 
			document.getElementById("CadastroLink").value = "CadastroFornecedor.asp";
			break;
	}
}

function redirectCadastro ()
{
	document.location.href = document.getElementById("CadastroLink").value ;
}

/* verifica dados do fale conosco antes de enviar */
/*****************************************************************
IsEmail - Funcao para validar e-mail.
Syntax: IsEmail(
				sEmail (Email a ser validado),
				sErrorMessage (Mensagem de erro OPCIONAL)
				)
*****************************************************************/
function IsEmail(sEmail, sErrorMessage) {
	if (sEmail) {
		var Expression = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
		
		if (!Expression.test(sEmail)) {
			if (sErrorMessage) {
				alert(sErrorMessage);
			}
			else {
				alert("Formato de Email preenchido inválido");
			}
			return false;
		}
		return true;
	}
}


function ValidaFaleConosco()
{
    areas = document.getElementById("Areas").value;
    nome = document.getElementById("Nome").value;
    email = document.getElementById("Email").value;
    telefone = document.getElementById("Telefone").value;
    mensagem = document.getElementById("Mensagem").value;
    
    if (areas=="" || nome=="" || email=="" || telefone=="" || mensagem=="")
    {    
        alert("Favor preencher todos os campos.");
        return false;
    }   
    else if (IsEmail(email))
        return true;
    else
        return false;
}

function validaContatoFornecedor()
{
    nome = document.getElementById("Nome").value;
    empresa = document.getElementById("Empresa").value;
    area = document.getElementById("AreadeAtuacao").value;
    email = document.getElementById("Email").value;
    mensagem = document.getElementById("Mensagem").value;
    
    if (nome == "" || empresa == "" || area == "" || email == "" || mensagem == "")
    {    
        alert("Favor preencher todos os campos. (Anexo é opcional!)");
        return false;
    }   
    else if (IsEmail(email))
        return true;
    else
        return false;
}


/* Funcao de Poup-up do Mapa - Contato*/
function abrePopup ( arquivo, largura, comprimento )
{
	window.open(arquivo,'ISAT','width=' + largura + ',height=' + comprimento + ',top=50,left=50') ;
}

function abrePopupHome ( pagina, largura, altura )
{
	w = screen.width;
	h = screen.height;

	meio_w = w/2;
	meio_h = h/2;

	altura2 = altura/2;
	largura2 = largura/2;
	meio1 = meio_h-altura2;
	meio2 = meio_w-largura2;
	
	window.open(pagina,'','height=' + altura + ', width=' + largura + ', top='+meio1+', left='+meio2+'');
}

/* Valida Contato Newsletter */

function ValidaNewsletter()
{
    nome = document.getElementById("nome").value;
    email = document.getElementById("email").value;
    
    if (nome == "" || email == "" )
    {
        alert("Os campos Nome e Email são obrigatórios.")
        return false;
    }
    else if (!IsEmail(email))
        return false;
    
    return true;
}
/* Valida Contato Currículo */
function ValidaCurriculo()
{
    nome = document.getElementById("nome").value;
    telefone = document.getElementById("telefone").value;
    email = document.getElementById("email").value;
    arquivo = document.getElementById("arquivo").value;
    
    if (nome =="" || telefone =="" || email =="" || arquivo =="")
    {
        alert("Todos os campos são de preenchimento obrigatório.");
        return false;
    }
    else if (!IsEmail(email))
        return false;
        
    return true;    
}



/* Valida Contato Consultores */
function ValidaConsultores()
{
    nome = document.getElementById("nome").value;
	empresa = document.getElementById("empresa").value;
	email = document.getElementById("email").value;
    telefone = document.getElementById("telefone").value;
    mensagem = document.getElementById("mensagem").value;
    
    if (nome =="" || empresa =="" || email =="" || telefone =="" || mensagem =="")
    {
        alert("Todos os campos são de preenchimento obrigatório.");
        return false;
    }
    else if (!IsEmail(email))
        return false;
        
    return true;    
}
    
/* Valida Contato Prediagnostico */
function ValidaPrediagnostico()
{
    nome = document.getElementById("nome").value;
	empresa = document.getElementById("empresa").value;
	email = document.getElementById("email").value;
    telefone = document.getElementById("telefone").value;
    mensagem = document.getElementById("mensagem").value;
    
    if (nome =="" || empresa =="" || email =="" || telefone =="" || mensagem =="")
    {
        alert("Todos os campos são de preenchimento obrigatório.");
        return false;
    }
    else if (!IsEmail(email))
        return false;
        
    return true;    
}

/* Valida Indique Este Site */
function ValidaIndique()
{
    destinatario = document.getElementById("Destinatario").value;
	emailDestinatario = document.getElementById("EmailDestinatario").value;
	remetente = document.getElementById("Remetente").value;
    emailRemetente = document.getElementById("EmailRemetente").value;
    mensagem = document.getElementById("Mensagem").value;
    
    if (destinatario =="" || emailDestinatario =="" || remetente =="" || emailRemetente =="" || mensagem =="")
    {
        alert("Todos os campos são de preenchimento obrigatório.");
        return false;
    }
    else if (!IsEmail(emailDestinatario) || !IsEmail(emailRemetente))
        return false;
        
    return true;    
}