// JavaScript Document
function checkNewSenha(){
	if (document.AlteraSenha.NovaSenha.value=="" || document.AlteraSenha.NovaSenha.value.length < 6 || document.AlteraSenha.ConfSenha.value=="" || document.AlteraSenha.ConfSenha.value.length < 6){
		alert("SENHA INVÁLIDA. \n Informe 6 dígitos numéricos");
	}
	if(document.AlteraSenha.NovaSenha.value != document.AlteraSenha.ConfSenha.value){
		alert("SENHA INVÁLIDA. \n As senhas devem ser idênticas nos campos \"Nova Senha\" e \"Confirme a Nova Senha\". \n Informe 6 dígitos numéricos.");
	}
return true;
}
function Rolagem(){
if (document.all){
window.scroll(0, document.body.clientHeight);
}else{
window.scroll(0,10000);
}
}
function janela(url,w,h,rolagem, status){

xpos=0;
ypos=0;

 if (screen){
 xpos= (screen.width - w)/2;
 ypos= (screen.height - h)/2;
 }
 var janela;

	if(rolagem == "no")
		janela="noScroll";
	else
		janela="yesScroll";
	

 desktop=window.open(url,janela,'toolbar=no,location=no,top=' + ypos + ',left=' + xpos + ',directories=no,status=' + status + ',scrollbars=' + rolagem + ',menubar=no,resizable=no,width= ' + w + ',height=' + h + '' );
 desktop.focus();
}

function validaEnter(){
	if (event.keyCode==13){
	return false;
	}
}
function openWindow(url,janela,w,h) { 

xpos=0;
ypos=0;

 if (screen){
 xpos= (screen.width - w)/2;
 ypos= (screen.height - h)/2;
 }

 desktop=window.open(url,janela,'toolbar=no,location=no,top=' + ypos + ',left=' + xpos + ',directories=no,status=no,scrollbars=yes,menubar=no,resizable=no,width= ' + w + ',height=' + h + '' );
 desktop.focus();
}

function validaOportunidades(entrada){
		if(entrada.nomeEmpresa.value == "" || entrada.ramoAtividade.value == "" || entrada.tituloAnuncio.value == "" || entrada.qtdadeVagas.value == "" || entrada.cargo.value == "" || entrada.salario.value == "" || entrada.formaContratacao.value == "" || entrada.escolaridade.value == "" || entrada.atribuicoes.value == "" || entrada.localTrabalho.value == ""){
			alert("ATENÇÃO - Preencha os campos obrigatórios");
			return false;
			}
	
	return true;
	}
	
function validaProfissionais(entrada){
		if(entrada.perfilProfissional.value == "" || entrada.cargo.value == "" || entrada.escolaridade.value == ""){
			alert("ATENÇÃO - Preencha os campos obrigatórios");
			return false;
			}
	
	return true;
	}

function validate(form) {
	if (form.elements[0].value=="") {
		alert('Não vai colocar o apelido?')
		form.elements[0].focus()
		return false
	}
	return true
}


function validaCadHistoria(entrada){
	if (entrada.titulo.value == "" || entrada.historia.value == ""){
		alert("ATENÇÃO: Preencha todos os campos para incluir sua história");	 
		return false;
	}
	return true;
}

function confirma_exc(codHistoria,atrib){
 if (confirm("Tem certeza de que deseja excluir esta história?")){
  window.location.href=("del_historia.asp?codHistoria="+codHistoria+"&"+atrib);
 }
}
function excOp(codVaga,atrib){
 if (confirm("Tem certeza de que deseja excluir este anúncio?")){
  window.location.href=("del_Oportunidades.asp?codVaga="+codVaga+"&"+atrib);
 }
}
function excProf(codVaga,atrib){
 if (confirm("Tem certeza de que deseja excluir este anúncio?")){
  window.location.href=("del_Profissionais.asp?codVaga="+codVaga+"&"+atrib);
 }
}
 function valida()  {
    var l1 = window.document.form.id.value;
    var l2 = window.document.form.senha.value;
    var cont = 0;

    if (l1.length == 0)    {
     alert("Digite o seu login.");
     return false;
    }

    if (l2.length == 0)    {
     alert("Digite a sua senha.");
     return false;
    }

    if (l2.length < 6)    {
     alert("Sua senha dever ter no mínimo 6 caracteres.");
     return false;
    }

    for (i=0; i < l1.length; i++)     {
         if (l1.substring(i,i+1) == "@")     	{
      	cont += 1;
     	}
     }

   if (cont > 1)    {
     alert("Login invalido.");
   return false;
    }

    return true;
  }


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function validemail(email){

invalid=(" /:,;")

			if(email==""){
			return false 
			}
				 	for(i=0;i<invalid.length;i++){
					badchar=invalid.charAt(i)
						if(email.indexOf(badchar,0) > -1){
						return false
						}																											
					}
			atpos=email.indexOf("@",1)
			if (atpos==-1){
			return false
			}
			if(email.indexOf("@",atpos+1)>-1){
			return false
			}
			periodpos=email.indexOf(".",atpos)
			if(periodpos==-1){
			return false
			}
			if (periodpos+3>email.length){
			return false
			}
			return true
}

function valida_cad(entrada){
 if (entrada.nome.value==""){
  alert("Campo obigatório inválido");
  entrada.nome.focus();
  return false;
 }
 
 if (entrada.userID.value==""){
  alert("Campo obigatório inválido");
  entrada.userID.focus();
  return false;
 }
 
 if (entrada.userSenha.value==""){
  alert("Campo obigatório inválido");
  entrada.userSenha.focus();
  return false;
 }  
  
  if (!validemail(entrada.email.value)){
  alert("Endereço de e-mail incorreto!")
  entrada.email.focus()
  entrada.email.select()
  
  return false
 }
 
 return true;
}

function JustNumber() {
		//	alert(event.keyCode);
	
     if (((event.keyCode) > 47) && ((event.keyCode) < 58)) {
          return(true);
     }
     else {
		 if((event.keyCode) != 45){
          return(false);
		 }else{
		  return (true);
		 }
     }
	 
}
function Data() {

     if (((event.keyCode) > 46) && ((event.keyCode) < 58)) {
          return(true);
     } else {
		  return (true);
     }
	 
}
function JustNumberSENHA() {
     if (((event.keyCode) > 47) && ((event.keyCode) < 58)) {
          return(true);
     }else{
	      return(false);
	}	
}

