<!--
//#############################################################
msg = "Os campos marcados com * são de preenchimento obrigatório";
//#############################################################
function vld_adm_competencias_tipos(){
	with(document.form1){
		if (pasComTipTitulo.value.length == 0){
			alert(msg);
			pasComTipTitulo.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
function vld_adm_empresas(){
	with(document.form1){
		if (empNome.value.length == 0){
			alert(msg);
			empNome.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
function vld_boletim(){
	with(document.formBoletim){
		for(var i=0; i<elements.length; i++){
			if(elements[i].type == 'text'){
				campo = elements[i].name.substring(0,7);
				if(campo=='avaBol_'){
					if(isNaN(elements[i].value) || elements[i].value>5){
						alert('Valor inválido, as notas devem ser de 1 a 5.');
						elements[i].focus();
						return false;
					}
				}
			}
		}
	}
	return true;
}
//#############################################################
function vld_desafio(){
	with(document.formDesafio){
		for(var i=0; i<elements.length; i++){
			if(elements[i].type == 'text'){
				campo = elements[i].name.substring(0,10);
				if(campo=='avaDesAuto' || campo=='avaDesGest'){
					if(isNaN(elements[i].value) || elements[i].value>5){
						alert('Valor inválido, as notas devem ser de 1 a 5.');
						elements[i].focus();
						return false;
					}
				}
			}
		}
	}
	return true;
}
//#############################################################
function vld_passaporte(){
	with(document.formPassaporte){
		for(var i=0; i<elements.length; i++){
			if(elements[i].type == 'text'){
				campo = elements[i].name.substring(0,10);
				if(campo=='avaPasAuto' || campo=='avaPasGest'){
					if(isNaN(elements[i].value) || elements[i].value>5){
						alert('Valor inválido, as notas devem ser de 1 a 5.');
						elements[i].focus();
						return false;
					}
				}
			}
		}
	}
	return true;
}
//#############################################################
function vld_adm_desafios2(){
	with(document.form1){
		if (desFasId.value == 0){
			alert(msg);
			desFasId.focus();
			return false;
		}
		if (desIndTitulo.value.length == 0){
			alert(msg);
			desIndTitulo.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
function vld_adm_desafios(){
	with(document.form1){
		if (desFasTitulo.value.length == 0){
			alert(msg);
			desFasTitulo.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
function vld_adm_passaportes3(){
	with(document.form1){
		if (pasAreId.value == 0){
			alert(msg);
			pasAreId.focus();
			return false;
		}
		if (pasComTipId.value == 0){
			alert(msg);
			pasComTipId.focus();
			return false;
		}
		if (pasComConhecimentos.value.length == 0){
			alert(msg);
			pasComConhecimentos.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
function vld_adm_passaportes2(){
	with(document.form1){
		if (pasAreTitulo.value.length == 0){
			alert(msg);
			pasAreTitulo.focus();
			return false;
		}
		if (pasAreTempo.value.length == 0){
			alert(msg);
			pasAreTempo.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
function vld_adm_passaportes(){
	with(document.form1){
		if (pasTitulo.value.length == 0){
			alert(msg);
			pasTitulo.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
function vld_adm_usuarios(){
	with(document.form1){
		if (usuGruId.value == 0){
			alert(msg);
			usuGruId.focus();
			return false;
		}
		if (usuNome.value.length == 0){
			alert(msg);
			usuNome.focus();
			return false;
		}
		if (empId.value == 0){
			alert(msg);
			empId.focus();
			return false;
		}
		if (usuEmail.value.length == 0){
			alert(msg);
			usuEmail.focus();
			return false;
		}else{
			prim = usuEmail.value.indexOf("@");
			if((usuEmail.value.indexOf("@",prim + 1) != -1) || (usuEmail.value.indexOf(".") < 1)){
				alert("Esse não é um e-mail válido.");
				usuEmail.focus();
				return false;
			}
		}
		if (usuSenha.value.length == 0){
			alert(msg);
			usuSenha.focus();
			return false;
		}
		if (usuSenha2.value.length == 0){
			alert(msg);
			usuSenha2.focus();
			return false;
		}
		if (usuSenha.value != usuSenha2.value){
			alert("As senhas devem ser iguais.");
			usuSenha.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
function vld_contato(){
	with(document.form1){
		if (Nome.value.length == 0){
			alert(msg);
			Nome.focus();
			return false;
		}
		if (Email.value.length == 0){
			alert(msg);
			Email.focus();
			return false;
		}else{
			prim = Email.value.indexOf("@");
			if((Email.value.indexOf("@",prim + 1) != -1) || (Email.value.indexOf(".") < 1)){
				alert("Esse não é um e-mail válido.");
				Email.focus();
				return false;
			}
		}
		if (Assunto.value.length == 0){
			alert(msg);
			Assunto.focus();
			return false;
		}
		if (Mensagem.value.length == 0){
			alert(msg);
			Mensagem.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
function loadSwf(swfWidht,swfHeight,swfPath){
	document.writeln('<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="' + swfWidht + '" height="' + swfHeight + '">');
	document.writeln('  <param name="movie" value="' + swfPath + '">');
	document.writeln('  <param name="quality" value="high">');
	document.writeln('  <embed src="' + swfPath + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + swfWidht + '" height="' + swfHeight + '"></embed>');
	document.writeln('</object>');
}
//#############################################################
function checkDate(field){
	if(field.value.length > 0){
		if(!vld_date(field.value)){
			alert("Essa não é uma data válida.");
			field.focus();
			return true;
		}
	}
}
//#############################################################
function vld_date(DATA){
	var expReg = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[1-2][0-9]\d{2})$/;
	var vdt = new Date();
	var vdia = vdt.getDay();
	var vmes = vdt.getMonth();
	var vano = vdt.getYear();
	if((DATA.match(expReg)) && (DATA!='')){
		var dia = DATA.substring(0,2);
		var mes = DATA.substring(3,5);
		var ano = DATA.substring(6,10);
		if((mes==04 && dia > 30) || (mes==06 && dia > 30) || (mes==09 && dia > 30) || (mes==11 && dia > 30)){
			return false;
		}else{
			if(ano%4!=0 && mes==2 && dia>28){
				return false;
			}else{
				if(ano%4==0 && mes==2 && dia>29){
					return false;
				}else{
					return true;
				}
			}
		}
	}else {
		return false;
	}
}
//#############################################################
function confirma(msg){
	var confirmado = confirm(msg);
	if(confirmado){
		return true;
	}else{
		return false;
	}
}
//#############################################################
-->
