function makeFlash(arquivo,id,largura,altura) {
    if (window.navigator.appName == "Microsoft Internet Explorer") {
        document.write('<object id="'+id+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+largura+'" height="'+altura+'">');
        document.write('<param name="allowScriptAccess" value="sameDomain">');
        document.write('<param name="movie" value="swf/'+arquivo+'">');
        document.write('<param name="quality" value="high">');
        document.write('<param name="menu" value="false">');
        document.write('<param name="wmode" value="transparent">');
        document.write('<param name="salign" value="t">');
        document.write('</object>');

    }else{
        document.write('<embed src="swf/'+arquivo+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'" wmode="transparent"></embed>');
    }
}

function sumir() {
		document.getElementById("popup").style.display = "none";
		document.getElementById("bannerAlta").style.display = "none";
}

function doMenu(elemento, tipo) {
		if(tipo == "on") {
			document.getElementById(elemento).className = "menuOn";
		}
		if (tipo == "out") {
			document.getElementById(elemento).className = "menu";
		}
}

function validarSugestao() {
  var passou = true;
  var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

  // validações dos campos gerais
  if (document.getElementById("sugestao").value == "") {
	 passou = false; alerta += "- Sugestão preenchido incorretamente.\n";
  }
  if (document.getElementById("nome").value == "") {
	 passou = false; alerta += "- Assunto preenchido incorretamente.\n";
  }
  if (document.sugestaoForm.email.value == "") {
     passou = false; alerta += "- E-mail preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.sugestaoForm.email.value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
      }
  }
  if (passou == true) { return true; }
  else { alert(alerta); return false; }
}


function validarNews() {
  var passou = true;
  var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

  // validações dos campos gerais
  if (document.newsForm.news.value == "") {
     passou = false; alerta += "- E-mail preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.newsForm.news.value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
      }
  }
  
  if (passou == true) { return true; }
  else { alert(alerta); return false; }
}

function validarEmail(email)
{
	var s = email;
	var filter=/^[A-Za-z][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	if (s.length == 0 ) return true;
	if (filter.test(s))
	return true;
	else
	return false;
}

function validanum(campo, event) { 
	var BACKSPACE= 8;   
	var key; 
	var tecla; 
	CheckTAB=true; 
	if(navigator.appName.indexOf("Netscape")!= -1) 
		tecla= event.which; 
	else 
		tecla= event.keyCode; 
	key = String.fromCharCode( tecla);   
	if ( tecla == 13 ) 
		return true; 
	if ( tecla == BACKSPACE ) 
		return true; 
	return ( chnum(key)); 
}

//mascara data onkeyup="mdata(this)" onkeypress="return validanum(this, event)"
 function mdata(campo){
     if (campo.value.length > 2)
     	if (campo.value.charAt(campo.value.length - 1) == '/' && campo.value.charAt(campo.value.length - 2) == '/')
        	campo.value = campo.value.substr(0,campo.value.length - 2);
	 if (event.keyCode != 8)			   
     	if (campo.value.length == 2 || campo.value.length == 5)
    		campo.value += '/';
  }
//mascara cep onkeyup="mcep(this)" onkeypress="return validanum(this, event)"
 function mcep(campo){
	 if (campo.value.length == 5)
   	 	campo.value += "-";
  }
//mascara hora onkeyup="mhora(this)" onkeypress="return validanum(this, event)"
 function mhora(campo){
     if (campo.value.length > 2)
       if(campo.value.charAt(campo.value.length - 1) == ':' && campo.value.charAt(campo.value.length - 2) == ':')
          campo.value = campo.value.substr(0,campo.value.length - 2);
	 if (event.keyCode != 8)
   	  if (campo.value.length == 2 || campo.value.length == 5) 
	  	campo.value += ':';
  }
//mascara validade onkeyup="mdata(this)" onkeypress="return validanum(this, event)"
 function mvalidade(campo){
     if (campo.value.length == 2)
    	campo.value += '/';
  }

function bookmarksite(title, url){
	if (document.all) {
		window.external.AddFavorite(url, title);
	}
	else if (window.sidebar) {
		window.sidebar.addPanel(title, url, "");
	}
}

function restaurantesForm() {
	var alerta = "Você buscou por:\n\n";
	alerta += "Estado: "+document.getElementById("estado").value+"\n";
	alerta += "Cidade: "+document.getElementById("cidade").value+"\n";
	alerta += "Star: "+document.getElementById("star").value+"\n";
	alerta += "Tipo: "+document.getElementById("tipo").value+"\n";
	alert(alerta);
	return false;
}

function validarContato() {
  var passou = true;
  var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

  // validações dos campos gerais
  if (document.getElementById("nomeContato").value == "") {
	 passou = false; alerta += "- Nome preenchido incorretamente.\n";
  }
  if (document.contato.emailContato.value == "") {
     passou = false; alerta += "- E-mail preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.contato.emailContato.value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
      }
  }
  if (document.getElementById("telefoneContato").value == "") {
	 passou = false; alerta += "- Telefone preenchido incorretamente.\n";
  }
  if (document.getElementById("assuntoContato").value == "") {
	 passou = false; alerta += "- Assunto preenchido incorretamente.\n";
  }
  if (document.getElementById("mensagemContato").value == "") {
	 passou = false; alerta += "- Mensagem preenchido incorretamente.\n";
  }
  
  if (passou == true) { return true; }
  else { alert(alerta); return false; }
}

function validarAssine() {
  var passou = true;
  var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

  // validações dos campos gerais
  if (document.getElementById("ano1").checked == false && document.getElementById("ano2").checked == false) {
	 passou = false; alerta += "- Escolha um período.\n";
  }
  if (document.getElementById("parcelas").value == "0") {
	 passou = false; alerta += "- Escolha o número de parcelas.\n";
  }
  if (document.getElementById("nome_completo").value == "") {
	 passou = false; alerta += "- Nome preenchido incorretamente.\n";
  }
  if (document.getElementById("endereco").value == "") {
	 passou = false; alerta += "- Endereço preenchido incorretamente.\n";
  }
  if (document.getElementById("cep").value == "") {
	 passou = false; alerta += "- CEP preenchido incorretamente.\n";
  }
  if (document.getElementById("estado").value == "") {
	 passou = false; alerta += "- Estado preenchido incorretamente.\n";
  }
  if (document.getElementById("cidade").value == "") {
	 passou = false; alerta += "- Cidade preenchido incorretamente.\n";
  }
  if (document.form_assine.email_assine.value == "") {
     passou = false; alerta += "- E-mail preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.form_assine.email_assine.value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
      }
  }
  if (document.getElementById("telefone").value == "") {
	 passou = false; alerta += "- Telefone preenchido incorretamente.\n";
  }
  if (document.getElementById("cartao").value == "") {
	 passou = false; alerta += "- Número do cartão preenchido incorretamente.\n";
  }
  if (document.getElementById("codigo_seguranca").value == "") {
	 passou = false; alerta += "- Código de segurança preenchido incorretamente.\n";
  }
  if (document.getElementById("validade").value == "") {
	 passou = false; alerta += "- Validade preenchido incorretamente.\n";
  }
  
  if (passou == true) { return true; }
  else { alert(alerta); return false; }
}

/* <================================================= Funções Carrinho ====================================================> */
function verifica(cad){
	
	if(cad.pessoa[0].checked==true){	
		if(cad.nome.value==''){
			alert ('Preencha o campo nome');
			cad.nome.focus;
			return false;
		}
	}
	if(cad.pessoa[1].checked==true){
		if(cad.razao.value==''){
			alert('Preencha o campo Razão Social!');
			cad.razao.focus();
			return false;
		}
		if(cad.contato.value==''){
			alert('Preencha o campo Contato');
			return false;
		}
	}
	
	if(cad.remetente.value==''){
		alert ('Preencha o campo e-mail');
		cad.remetente.focus;
		return false;
	}
	if(cad.endereco.value==''){
		alert ('Preencha o campo endereço');
		cad.remetente.focus;
		return false;
	}
	if(cad.bairro.value==''){
		alert('Preencha o Bairro');
		cad.bairro.focus();
		return false;		
	}
	if(cad.cidade.value==''){
		alert('Preencha o campo cidade');
		cad.cidade.focus();
		return false;
		
	}
	if(cad.cep.value==''){
		alert('Preencha o campo CEP');
		cad.cep.focus();
		return false;
	}
	if(cad.id.value==''){
		alert('O seu pedido está sem produto.\n Favor escolher um');
		return false;
	}
	return true;
}

function habilitaCartoes(param){
	if(param == 1){
		document.getElementById("vencimento").disabled = false;
		document.getElementById("cc_nome").disabled = true;
		document.getElementById("cc_num").disabled = true;
		document.getElementById("cc_cod").disabled = true;
		document.getElementById("cc_mes").disabled = true;
		document.getElementById("cc_ano").disabled = true;
		document.getElementById("cc_par").disabled = true;
	}else if(param == 2){
		document.getElementById("vencimento").disabled = true;
		document.getElementById("cc_nome").disabled = true;
		document.getElementById("cc_num").disabled = true;
		document.getElementById("cc_cod").disabled = true;
		document.getElementById("cc_mes").disabled = true;
		document.getElementById("cc_ano").disabled = true;
		document.getElementById("cc_par").disabled = true;
	}else if(param == 3){
		document.getElementById("vencimento").disabled = true;
		document.getElementById("cc_nome").disabled = false;
		document.getElementById("cc_num").disabled = false;
		document.getElementById("cc_cod").disabled = false;
		document.getElementById("cc_mes").disabled = false;
		document.getElementById("cc_ano").disabled = false;
		document.getElementById("cc_par").disabled = false;
	}
}

function formataData(campo, event){
	var codigo 	= 	event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	var palavra = String.fromCharCode(codigo);
	
	if(codigo == 32){
		return false;
	}
	
	if(palavra >= 0 || palavra <= 9){
		if(campo.value.length == 2){
			campo.value += "/";
		}
		
		if(campo.value.length == 5){
			campo.value += "/";
		}
		
		return true;
	}else if(codigo == 8 || codigo == 46 || codigo == 116){
		return true;
	}else if(codigo == 37 || codigo == 39){
		return true;
	/*}else if(campo.value.length == 10 && codigo == 97){
		return true;*/
	}else{
		return false;
	}	
}


function verificaCartoes(form){
	
	dataAtual = new Date();
	
	if(form.pagamento[0].checked == true){
		if(document.getElementById("vencimento").value == ""){
			alert("Por favor, informe a data de vencimento.");
			return false;
		}
		
		var data_vencimento = document.getElementById("vencimento").value;
		
		if(data_vencimento.length < 10){
			alert("Por favor, informe a data completa.");
			return false;
		}
		
		var data = data_vencimento.split("/");
		
		var dia   = dataAtual.getDate();
		var mes   = dataAtual.getMonth()+1;
		var atual = dataAtual.getFullYear();
		
		if(data[2] < atual){
			alert("A data de vencimento não pode ser menor que a data atual");
			return false;
		}
		
		if(data[0] < dia){
			if(data[1] == mes){
				if(data[2] == atual){
					alert("A data de vencimento não pode ser menor que a data atual");
					return false;		
				}
			}
			
			if(data[1] < mes){
				if(data[2] == atual){
					alert("A data de vencimento não pode ser menor que a data atual");
					return false;
				}
			}			
		}
		
		if(data[0] > dia){
			if(data[1] < mes){
				alert("A data de vencimento não pode ser menor que a data atual");
				return false;
			}
		}
		
		if(data[1] <= 0 || data[1] > 12){
			alert("Data inválida.");
			return false;
		}
		
		if(data[0] > 31 || data[0] <= 0){
			alert("Data inválida.");
			return false;
		}
		
		if(data[1] == 4 || data[1] == 6 || data[1] == 9 || data[1] == 11){
			if(data[0] > 30){
				alert("Data inválida.");
				return false;
			}
		}
		
		if(data[1] == 2){
			if(data[0] > 29){
				alert("Data inválida.");
				return false;
			}
		}
		
	}else if(form.pagamento[3].checked == true || form.pagamento[4].checked == true){
		if(document.getElementById("cc_nome").value == ""){
			alert("Por favor, informe o nome do cartão.");
			return false;
		}
		
		if(document.getElementById("cc_num").value == ""){
			alert("Por favor, informe o número do cartão.");
			return false;
		}
		
		if(document.getElementById("cc_cod").value == ""){
			alert("Por favor, informe o código do cartão.");
			return false;
		}
		
		if(document.getElementById("cc_mes").value == ""){
			alert("Por favor, informe o mês de vencimento.");
			return false;
		}
		
		if(document.getElementById("cc_ano").value == ""){
			alert("Por favor, informe o ano de vencimento.");
			return false;
		}
		
		
		
		var ano = dataAtual.getYear() + "";
		var mes = dataAtual.getMonth() + 1;
		
		if(navigator.appName == "Netscape"){
			ano = ano.substring(1, 3);
        }else if(navigator.appName == "Microsoft Internet Explorer"){
			ano = ano.substring(2, 4);
		}
		
		if(document.getElementById("cc_mes").value < mes){
			alert("A data de vencimento não pode ser menor que a data atual");
			return false;
		}
		
		if(document.getElementById("cc_mes").value <= 0 || document.getElementById("cc_mes").value > 12){
			alert("Mês inválido.");
			return false;
		}
		
		var cc_ano = document.getElementById("cc_ano").value;
		
		if(cc_ano < ano){
			alert("A data de vencimento não pode ser menor que a data atual");
			return false;
		}
	}
	
	return true;
}

function chnum( caractere ){ 
	var strValidos = "0123456789" 
	if ( strValidos.indexOf( caractere ) == -1 ) 
		return false; 
	return true;  
} 
function validanum(campo, event) { 
	var BACKSPACE= 8;   
	var key; 
	var tecla; 
	CheckTAB=true; 
	if(navigator.appName.indexOf("Netscape")!= -1) 
		tecla= event.which; 
	else 
		tecla= event.keyCode; 
	key = String.fromCharCode( tecla);   
	if ( tecla == 13 ) 
		return true; 
	if ( tecla == BACKSPACE ) 
		return true; 
	return ( chnum(key)); 
}

function mcep(campo){
if (campo.value.length == 5)
	campo.value += "-";
}
/*=========================================================================================================================*/

function exibirForm(id) {
	document.getElementById(id).className = "aparecer";
	document.getElementById('botoesLoja').style.display = "none";
}

function doSubMenu(id, tipo) {
	
		if(tipo == "revista"){
			submenu  = "<li><a href=\""+variavel+"paginas/alta_gastronomia.php?pagina=1\">Alta Gastronomia</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"paginas/alta_gastronomia_premium.php\">Alta Gastronomia Premium</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"paginas/receitas_maravilhosas.php\">Receitas Maravilhosas</a></li>\n";
		}
		
		if(tipo == "secoes"){
			submenu  = "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_editorial.php\">Editorial</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_profissao_cozinheiro.php\">Profissão Cozinheiro</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_gastronomia_e_turismo_venezuela.php\">Gastronomia &amp; Turismo</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_formacao_profissional.php\">Formação Profissional</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_tecnicas_de_cozinha_moda_confeiteiros.php\">Técnicas de Cozinha</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_perolas_gastronomia.php\">Pérolas da Gastronomia</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"paginas/assine.php\">Assine Já</a></li>\n";
		}
		
		if (tipo == "secoes2"){
			submenu  = "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_espaco_casa.php\">Espaço Casa</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_fique_por_dentro.php\">Fique por Dentro</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_para_sonhar.php\">Para Sonhar</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_nutricao_e_gastronomia.php\">Nutrição &amp; Gastronomia</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_foyer.php\">Foyer</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_espaco_leitor.php\">Espaço do Leitor</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"revistas/alta_gastronomia/edicao_87/alta_gastronomia_edicao87_gastronomia_tv_arte.php\">Gastronomia, TV e Arte</a></li>\n";
		}
		if(tipo == "contato"){
			submenu  = "<li><a href=\"#\">Trabalhe Conosco</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\"#\">Assessoria de Imprensa</a></li>\n";
			submenu += "<li>&bull;</li>\n";
			submenu += "<li><a href=\""+variavel+"paginas/contato.php\">Críticas e Sugestões</a></li>\n";
		}
	
	document.getElementById(id).innerHTML = submenu;
}

// Função que monta Ajax
function ajaxFuncao(){
    var xmlHttp;
    try{
        // Internet Explorer
        xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e){
        try{
            // Firefox, Opera 8.0+, Safari
            xmlHttp=new XMLHttpRequest();
        }
        catch (e){
            try{
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e){
                alert("O seu browser não suporta AJAX!");
                return false;
            }
        }
    }
    return xmlHttp;
}

// Objeto do Ajax
var ajax;

function addCarrinho(produto,preco){
	ajax=ajaxFuncao();
	parametros='acao=add&produto='+produto+'&preco='+preco;
	ajax.open('POST','../system/carrinho_manipula.php',true);
	ajax.setRequestHeader('encoding','ISO-8859-1');
    ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    ajax.setRequestHeader("Pragma", "no-cache");
    ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded, text/xml, charset=iso-8859-1');
    ajax.setRequestHeader("Content-length", parametros.length);
    ajax.setRequestHeader("Connection", "close");
    ajax.onreadystatechange=executadoCarrinho;
    ajax.send(parametros);
}

function delCarrinho(id){
	ajax=ajaxFuncao();
	parametros='acao=del&id_produto='+id;
	ajax.open('POST','../system/carrinho_manipula.php',true);
	ajax.setRequestHeader('encoding','ISO-8859-1');
    ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    ajax.setRequestHeader("Pragma", "no-cache");
    ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded, text/xml, charset=iso-8859-1');
    ajax.setRequestHeader("Content-length", parametros.length);
    ajax.setRequestHeader("Connection", "close");
    ajax.onreadystatechange=executadoCarrinho;
    ajax.send(parametros);
}

function limpaCarrinho(){
	ajax=ajaxFuncao();
	parametros='acao=limpa';
	ajax.open('POST','../system/carrinho_manipula.php',true);
	ajax.setRequestHeader('encoding','ISO-8859-1');
    ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    ajax.setRequestHeader("Pragma", "no-cache");
    ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded, text/xml, charset=iso-8859-1');
    ajax.setRequestHeader("Content-length", parametros.length);
    ajax.setRequestHeader("Connection", "close");
    ajax.onreadystatechange=executadoCarrinho;
    ajax.send(parametros);
}

function executadoCarrinho(){
	if(ajax.readyState==4){
		if (ajax.status == 200){
			eval(ajax.responseText);
		}
	}
}

function formAparecer(acao, id) {
		if (acao == "aparecer") {
			document.getElementById(id).className = "aparecer";
		}
		if (acao == "sumir") {
			document.getElementById(id).className = "sumir";
		}
}

function habilitar(quem) {
	if (quem == "deficiencia") {
			document.getElementById("tipo_deficiencia").disabled = false;
			document.getElementById("ajudas_tecnicas").disabled = false;
			document.getElementById("meio_locomocao").disabled = false;
	}
	if (quem == "experiencia_profissional") {
			document.getElementById("area_atuacao_ultima").disabled = false;
			document.getElementById("renumeracao").disabled = false;
			document.getElementById("tipo_relacao_funcional").disabled = false;
			document.getElementById("nivel_profissional").disabled = false;
	}
}

function validarTrabalheConosco() {
  var passou = true;
  var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

  // validações dos campos gerais
  if (document.getElementById("nome_completo").value == "") {
	 passou = false; alerta += "- Nome preenchido incorretamente.\n";
  }
    if (document.getElementById("dia").value == "") {
	 passou = false; alerta += "- Dia preenchido incorretamente.\n";
  }
    if (document.getElementById("mes").value == "") {
	 passou = false; alerta += "- Mês preenchido incorretamente.\n";
  }
    if (document.getElementById("ano").value == "") {
	 passou = false; alerta += "- Ano preenchido incorretamente.\n";
  }
  if (document.getElementById("estado_civil").value == "") {
	 passou = false; alerta += "- Estado Civil preenchido incorretamente.\n";
  }
   if (document.getElementById("email_trabalhe").value == "") {
     passou = false; alerta += "- E-mail preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.getElementById("email_trabalhe").value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
      }
  }
  if (document.getElementById("telefone").value == "") {
	 passou = false; alerta += "- Telefone preenchido incorretamente.\n";
  }
  if (document.getElementById("celular").value == "") {
	 passou = false; alerta += "- Celular preenchido incorretamente.\n";
  }
    if (document.getElementById("endereco").value == "") {
	 passou = false; alerta += "- Endereço preenchido incorretamente.\n";
  }
  if (document.getElementById("numero").value == "") {
	 passou = false; alerta += "- Número preenchido incorretamente.\n";
  }
    if (document.getElementById("bairro").value == "") {
	 passou = false; alerta += "- Bairro preenchido incorretamente.\n";
  }
  if (document.getElementById("estado").value == "") {
	 passou = false; alerta += "- Estado preenchido incorretamente.\n";
  }
    if (document.getElementById("cidade").value == "") {
	 passou = false; alerta += "- Cidade preenchido incorretamente.\n";
  }
    if (document.getElementById("cep").value == "") {
	 passou = false; alerta += "- CEP preenchido incorretamente.\n";
  }
    if (document.getElementById("experiencia_profissional").value == "Sim") {
	 
	  if (document.getElementById("area_atuacao_ultima").value == "") {
		 passou = false; alerta += "- Área de Atuação preenchido incorretamente.\n";
	  }
	  if (document.getElementById("renumeracao").value == "") {
		 passou = false; alerta += "- Remuneração preenchido incorretamente.\n";
	  }
	  if (document.getElementById("tipo_relacao_funcional").value == "") {
		 passou = false; alerta += "- Tipo de relação funcional preenchido incorretamente.\n";


	  }
	  if (document.getElementById("nivel_profissional").value == "") {
		 passou = false; alerta += "- Nível Profissional preenchido incorretamente.\n";
	  }
  }
  if (document.getElementById("curriculo").value == "") {
	 passou = false; alerta += "- Currículo preenchido incorretamente.\n";
  }
  if (document.getElementById("ingles_leitura").value == "" || document.getElementById("ingles_escrita").value == "" ||  document.getElementById("ingles_fala").value == ""){
	 passou = false; alerta += "- Nível de Inglês preenchido incorretamente.\n";
  }
  if (document.getElementById("espanhol_leitura").value == "" || document.getElementById("espanhol_escrita").value == "" ||  document.getElementById("espanhol_fala").value == ""){
	 passou = false; alerta += "- Nível de Espanhol preenchido incorretamente.\n";
  }
  if (document.getElementById("info_word").value == "" || document.getElementById("info_ppt").value == "" ||  document.getElementById("info_excel").value == "" || document.getElementById("info_internet").value == "") {
	 passou = false; alerta += "- Conhecimentos em Microinformática preenchido incorretamente.\n";
  }
  
  if (passou == true) { return true; }
  else { alert(alerta); return false; }
}

// Função que monta Ajax
function ajaxFuncao(){
    var xmlHttp;
    try{
        // Internet Explorer
        xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e){
        try{
            // Firefox, Opera 8.0+, Safari
            xmlHttp=new XMLHttpRequest();
        }
        catch (e){
            try{
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e){
                alert("O seu browser não suporta AJAX!");
                return false;
            }
        }
    }
    return xmlHttp;
}

// Objeto do Ajax
var ajax;

function montaCidade(estado, retorno){
	ajax=ajaxFuncao();
	parametros='estado='+estado;
	ajax.open('post',retorno+'system/cidade.php',true);
    ajax.setRequestHeader('encoding','ISO-8859-1');
    ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    ajax.setRequestHeader("Pragma", "no-cache");
    ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded, text/xml, charset=iso-8859-1');
    ajax.setRequestHeader("Content-length", parametros.length);
    ajax.setRequestHeader("Connection", "close");
    ajax.onreadystatechange=montadoCidade;
    ajax.send(parametros);
}

function montadoCidade(){
	if(ajax.readyState==4){
    	 if(ajax.status == 200){
    	 	document.getElementById('cidade_div').innerHTML=ajax.responseText;
    	 }
	}
}

function linkarLocalizacao() {
	document.getElementById("localizacaoContato").href = "http://www.google.com.br/maps?f=q&source=s_q&hl=pt-BR&geocode=&q=Rua+Jo%C3%A3o+Fraissat,+232&ie=UTF8&hq=&hnear=R.+Jo%C3%A3o+Fraissat+-+Lapa,+S%C3%A3o+Paulo+-+SP,+05048-040&ll=-23.53214,-46.69683&spn=0.00962,0.013754&z=16&iwloc=A";
	document.getElementById("localizacaoContato").target = "_blank";
}

function validarEnviarAmigo() {
  var passou = true;
  var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

  // validações dos campos gerais
  if (document.getElementById("nome_remetente").value == "") {
	 passou = false; alerta += "- Nome do Remetente preenchido incorretamente.\n";
  }
  if (document.enviar_amigo.email_remetente.value == "") {
     passou = false; alerta += "- E-mail do Remetente preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.enviar_amigo.email_remetente.value)) {
           passou = false; alerta += "- E-mail do Remetente preenchido incorretamente.\n";
      }
  }
  if (document.getElementById("nome_destinatario").value == "") {
	 passou = false; alerta += "- Nome do Destinatário preenchido incorretamente.\n";
  }
  if (document.enviar_amigo.email_destinatario.value == "") {
     passou = false; alerta += "- E-mail do Destinatário preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.enviar_amigo.email_destinatario.value)) {
           passou = false; alerta += "- E-mail do Destinatário preenchido incorretamente.\n";
      }
  }
  if (document.getElementById("mensagem_amigo").value == "") {
	 passou = false; alerta += "- Mensagem preenchido incorretamente.\n";
  }
  
  if (passou == true) { return true; }
  else { alert(alerta); return false; }
}

function validaNoticia(form){
	var titulo  = form.titulo_not.value;
	var chamada = form.chamada.value;
	//document.getElementById("corpo").value = 
	
	if(titulo == ""){
		alert("Por favor, informe o titulo da notícia.");
		return false;
	}
	
	
	if(chamada == ""){
		alert("Por favor, informe a chamada.");
		return false;
	}
	
	return true;
}

function limitaCampoNoticia(param){
	if(param == 1){
		
		 if (window.navigator.appName == "Microsoft Internet Explorer") {
		 	
		 	var input = "<input name=\"titulo_not\" type=\"text\" id=\"titulo_not\" size=\"48\" maxlength=\"23\">";
		 	document.getElementById("tit").innerHTML = "";
		 	document.getElementById("tit").innerHTML = input;
			
		 	var cham  = "<input name=\"chamada\" type=\"text\" id=\"chamada\" size=\"81\" maxlength=\"50\">"
		 	document.getElementById("cham").innerHTML = "";
		 	document.getElementById("cham").innerHTML = cham;
		}else{
		
			document.getElementById("titulo_not").setAttribute("maxlength", "23");
			document.getElementById("chamada").setAttribute("maxlength", "50");
		}
	}else{
		
		 if (window.navigator.appName == "Microsoft Internet Explorer") {
		 	
		 	var valor = document.getElementById("titulo_not").value;
		 	var chamada = document.getElementById("chamada").value;
		 	
		 	var input = "<input name=\"titulo_not\" type=\"text\" id=\"titulo_not\" size=\"48\" maxlength=\"80000\" value="+valor+" >";
		 	document.getElementById("tit").innerHTML = "";
		 	document.getElementById("tit").innerHTML = input;
			
		 	var cham  = "<input name=\"chamada\" type=\"text\" id=\"chamada\" size=\"81\" maxlength=\"90000\" value="+chamada+" >"
		 	document.getElementById("cham").innerHTML = "";
		 	document.getElementById("cham").innerHTML = cham;
		}else{
			document.getElementById("titulo_not").setAttribute("maxlength", "80000");
			document.getElementById("chamada").setAttribute("maxlength", "80000");
		}
	}
}