function legenda(msg) {
    window.status = msg ;
	return true;
}

function volta(){
	history.go(-1);	
}

function mostraEvCur(url){
	window.open(""+url+"", "EventosCursos", "width=600,height=590,top=90,left=90,menubar=no,location=no,resizable=no,scrollbars=yes,status=no");
}

function abreFoto(dir, foto, larg, altu, rolagem){
	window.open("foto.php?dir="+dir+"&foto="+foto+"", "Foto", "width="+larg+",height="+altu+",top=90,left=90,menubar=no,location=no,resizable=no,scrollbars="+rolagem+",status=no");
}

function abreVaga(id_vaga, tipo){
	if(tipo==1){
		height = '250';
	}else{
		height = '350';	
	}
	window.open("vagas_detalhes.php?id_vaga="+id_vaga+"", "Vagas", "width=350,height="+height+",top=90,left=90,menubar=no,location=no,resizable=no,scrollbars=no,status=no");
}

function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	alert("O endereço de email "+emailStr+" não está correto.")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    // user is not valid
    alert("O nome do usuário do e-mail "+emailStr+" não parece ser válido.")
    return false
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("O número do IP não é válido no e-mai "+emailStr+" !")
		return false
	    }
    }
    return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("O domínio do e-mail "+emailStr+" não parece estar correto.")
    return false
}

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("O endereço precisa terminar com 3 letras do domínio ou 2 letras do país.")
   return false
}

if (len<2) {
   var errStr="O endereço "+emailStr+" não contém o domínio. Revise o endereço que digitaste."
   alert(errStr)
   return false
}

return true;
}


function validaContato(){
	
        f = document.contato;
		
		if (f.nome.value == ""){
			alert("Diga-nos seu nome para conhecê-lo melhor.");
			f.nome.focus();
			return false;
		}
		if(!emailCheck(f.email.value)){
			return false;
		}
		if (f.assunto.value == ""){
		   alert("Escreva no campo Assunto o porque de estar entrando em contato conosco.");
		   f.assunto.focus();
		   return false;
		}
		if (f.mensagem.value == ""){
		   alert("Ops! O principal não foi preenchido! Todo contato necessita de uma mensagem.");
		   f.mensagem.focus();
		   return false;
		}
		return true;
}






var tgs = new Array( 'div', 'ul', 'li', 'p', 'a', 'span', 'table', 'td', 'font', 'b' );
var szs = new Array( '9', '10', '11', '12', '13','14', '15' );
var startSz = 2;
function ts( trgt,inc ) {
	
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;
sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 6 ) sz = 6;
startSz = sz;
if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

	for ( i = 0; i < tgs.length; i++ ) {
	cTags = cEl.getElementsByTagName( tgs[ i ] );
	for ( j = 0; j < cTags.length; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
}




function Mascara(objeto, evt, mask) {
 
var LetrasU = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var LetrasL = 'abcdefghijklmnopqrstuvwxyz';
var Letras  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var Numeros = '0123456789';
var Fixos  = '().-:/ '; 
var Charset = " !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_/`abcdefghijklmnopqrstuvwxyz{|}~";

evt = (evt) ? evt : (window.event) ? window.event : "";
var value = objeto.value;
if (evt) {
	 var ntecla = (evt.which) ? evt.which : evt.keyCode;
	 tecla = Charset.substr(ntecla - 32, 1);
	 if (ntecla < 32) return true;
	
	 var tamanho = value.length;
	 if (tamanho >= mask.length) return false;
	
	 var pos = mask.substr(tamanho,1); 
	 while (Fixos.indexOf(pos) != -1) {
	  value += pos;
	  tamanho = value.length;
	  if (tamanho >= mask.length) return false;
	  pos = mask.substr(tamanho,1);
	 }
	
	 switch (pos) {
	   case '#' : if (Numeros.indexOf(tecla) == -1) return false; break;
	   case 'A' : if (LetrasU.indexOf(tecla) == -1) return false; break;
	   case 'a' : if (LetrasL.indexOf(tecla) == -1) return false; break;
	   case 'Z' : if (Letras.indexOf(tecla) == -1) return false; break;
	   case '*' : objeto.value = value; return true; break;
	   default : return false; break;
	 }
	}
	objeto.value = value; 
	return true;
}

function MaskCep(objeto, evt) { 
return Mascara(objeto, evt, '#####-###');
}

function MaskData(objeto, evt) { 
return Mascara(objeto, evt, '##/##/####');
}

function MaskTelefone(objeto, evt) { 
return Mascara(objeto, evt, '(##) ####-####');
}

function checaFormCurr(frm_curriculo){ 

		if (frm_curriculo.nome.value == ""){ 
		alert("Preencha o campo nome!"); 
		frm_curriculo.nome.focus(); 
		return (false); 
		} 
		if (frm_curriculo.endereco.value == ""){ 
		alert("Preencha o campo endereço!"); 
		frm_curriculo.endereco.focus(); 
		return (false); 
		} 
		if (frm_curriculo.numero.value == ""){ 
		alert("Preencha o campo número!"); 
		frm_curriculo.numero.focus(); 
		return (false); 
		} 
		if (frm_curriculo.bairro.value == ""){ 
		alert("Preencha o campo bairro!"); 
		frm_curriculo.bairro.focus(); 
		return (false); 
		} 
		if (frm_curriculo.cep.value == ""){ 
		alert("Preencha o campo cep!"); 
		frm_curriculo.cep.focus(); 
		return (false); 
		} 
		if (frm_curriculo.cidade.value == ""){ 
		alert("Preencha o campo cidade!"); 
		frm_curriculo.cidade.focus(); 
		return (false); 
		} 
		if (frm_curriculo.estado.value == ""){ 
		alert("Preencha o campo estado!"); 
		frm_curriculo.estado.focus(); 
		return (false); 
		}
		if (frm_curriculo.email.value == ""){ 
		alert("Preencha o campo e-mail!"); 
		frm_curriculo.email.focus(); 
		return (false); 
		}						
		if (frm_curriculo.nascimento.value == ""){ 
		alert("Preencha o campo data de nascimento!"); 
		frm_curriculo.nascimento.focus(); 
		return (false); 
		} 
		if (frm_curriculo.motorista.value == ""){ 
		alert("Preencha a pergunta: Possui carteira de motorista?"); 
		frm_curriculo.motorista.focus(); 
		return (false); 
		} 
		if (frm_curriculo.motorista.value == "Sim" && curriculo.categoria.value == ""){ 
		alert("Preencha o campo categoria!"); 
		frm_curriculo.categoria.focus(); 
		return (false); 
		} 
		if (frm_curriculo.estado_civil.value == ""){ 
		alert("Preencha o campo estado civil!"); 
		frm_curriculo.estado_civil.focus(); 
		return (false); 
		} 
		if (frm_curriculo.sexo.value == ""){ 
		alert("Preencha o campo sexo!"); 
		frm_curriculo.sexo.focus(); 
		return (false); 
		} 
		if (frm_curriculo.filhos.value == ""){ 
		alert("Informe o número de filhos que você possui!"); 
		frm_curriculo.filhos.focus(); 
		return (false); 
		} 
		if (frm_curriculo.curriculo.value == ""){ 
		alert("Informe se você já possui currículo cadastrado em nosso banco de dados!"); 
		frm_curriculo.curriculo.focus(); 
		return (false); 
		} 
		if (frm_curriculo.empregado.value == ""){ 
		alert("Preencha a pergunta: Atualmente está empregado?"); 
		frm_curriculo.empregado.focus(); 
		return (false); 
		} 
		if (frm_curriculo.interesse.value == ""){ 
		alert("Informe a(s) sua(s) área(s) de interesse para atuação!"); 
		frm_curriculo.interesse.focus(); 
		return (false); 
		} 
		if (frm_curriculo.instrucao.value == ""){ 
		alert("Informe o seu grau de instrução!"); 
		frm_curriculo.instrucao.focus(); 
		return (false); 
		} 
} 

/*
function verificaArquivo() {
  var ext = document.frm_curriculo.arquivo.value;
  ext = ext.substring(ext.length-3,ext.length);
  ext = ext.toLowerCase();
  if(ext != 'doc' && ext != 'rtf' && ext != 'pdf') {
    alert('Por favor, selecione apenas arquivos dos tipos .doc, .rtf e .pdf');
    return false; 
  }else{
    return true; 
  }
}*/

function checaFormCurrAtualizacao(frm_curriculo){ 

		if (frm_curriculo.nome.value == ""){ 
			alert("Por favor, não deixe o seu nome em branco!"); 
			frm_curriculo.nome.focus(); 
			return (false); 
		} 
		
		if (frm_curriculo.email.value == ""){ 
			alert("Por favor, não deixe de informar seu e-mail."); 
			frm_curriculo.email.focus(); 
			return (false); 
		} 
		
		if (frm_curriculo.arquivo.value != ""){ 
			var ext = document.frm_curriculo.arquivo.value;
			ext = ext.substring(ext.length-3,ext.length);
			ext = ext.toLowerCase();
			if(ext != 'doc' && ext != 'rtf' && ext != 'pdf') {
			alert('Por favor, selecione apenas arquivos dos tipos .doc, .rtf e .pdf');
				return (false); 
			}
		}else{
			alert("Anexe o currículo e após clique em 'Enviar'"); 
			frm_curriculo.arquivo.focus(); 
			return (false); 
		} 
} 

function checaFormOrcamento(frm_orcamento){ 

		if (frm_orcamento.razao.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar o campo Razão Social."); 
			frm_orcamento.razao.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.email.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar o seu e-mail."); 
			frm_orcamento.email.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.contato.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar uma referência para contato."); 
			frm_orcamento.contato.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.endereco.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar o seu endereço."); 
			frm_orcamento.endereco.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.cidade.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar a sua cidade."); 
			frm_orcamento.cidade.focus(); 
			return (false); 
		}

		if (frm_orcamento.estado.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar o seu estado."); 
			frm_orcamento.estado.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.atividade.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar a principal atividade de sua empresa."); 
			frm_orcamento.atividade.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.regime.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar a situação do regime tributário de sua empresa."); 
			frm_orcamento.regime.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.funcionarios.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar o n° de funcionários de sua empresa."); 
			frm_orcamento.funcionarios.focus(); 
			return (false); 
		}

		if (frm_orcamento.lancamentos.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar o n° de lançamentos contábeis por mês."); 
			frm_orcamento.lancamentos.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.filiais.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar o n° de filiais de sua empresa."); 
			frm_orcamento.filiais.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.notas.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar o n° de notas fiscais/mês de sua empresa."); 
			frm_orcamento.notas.focus(); 
			return (false); 
		}
		
		if (frm_orcamento.impostos.value == ""){ 
			alert("Para enviar seu orçamento com sucesso, não deixe de informar a situação de pagamento de impostos de sua empresa."); 
			frm_orcamento.impostos.focus(); 
			return (false); 
		}

} 


function checaFormCadastroEmpresa(frm_cadastro){ 

		if (frm_cadastro.razao.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar o campo Razão Social."); 
			frm_cadastro.razao.focus(); 
			return (false); 
		}
		
		if (frm_cadastro.nomefantasia.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar o nome fantasia."); 
			frm_cadastro.nomefantasia.focus(); 
			return (false); 
		}
		
		if (frm_cadastro.endereco.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar o endereço."); 
			frm_cadastro.endereco.focus(); 
			return (false); 
		}
		
		if (frm_cadastro.cidade.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar a cidade."); 
			frm_cadastro.cidade.focus(); 
			return (false); 
		}
		
		if (frm_cadastro.cep.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar o CEP."); 
			frm_cadastro.cep.focus(); 
			return (false); 
		}
		
		if (frm_cadastro.estado.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar o seu estado."); 
			frm_cadastro.estado.focus(); 
			return (false); 
		}	
		
		if (frm_cadastro.telefone.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar o seu e-mail."); 
			frm_cadastro.telefone.focus(); 
			return (false); 
		}	
		
		if (frm_cadastro.email.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar o seu e-mail."); 
			frm_cadastro.email.focus(); 
			return (false); 
		}
		
		if (frm_cadastro.atividade.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar a principal atividade de sua empresa."); 
			frm_cadastro.atividade.focus(); 
			return (false); 
		}	
		
		if (frm_cadastro.nome1.value == ""){ 
			alert("Para cadastrar sua empresa com sucesso, não deixe de informar uma pessoa para contato."); 
			frm_cadastro.nome1.focus(); 
			return (false); 
		}

} 
function mostraFlash(src, larg, alt, vars){
	var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ larg +'" height="'+ alt +'">';
	flash += '<param name="movie" value="'+ src +'" />';	
	flash += '<param name="menu" value="false" />';	
	flash += '<param name="wmode" value="transparent" />';	
	flash += '<embed src="'+ src +'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ larg +'" height="'+ alt +'" menu = "false" wmode="transparent"></embed>';
	flash += '</object>';	
	
	document.write(flash);
}