<!-- ------------------------------ VERIFICA CAMPOS EM BRANCO DO FORMULÁRIO ------------------- -->
function checkform(formName) {
	errors="";
	d=document.forms[formName];
	for (i=0; i<d.elements.length; i++) {
		valor = d.elements[i].value;
		obrigatorio = d.elements[i].obrigatorio;
		if ((valor=="" || valor=="<P>&nbsp;</P>") && obrigatorio!="" && obrigatorio!=null) {
			errors+=d.elements[i].obrigatorio+"!\n";
			y = d.elements[i]
		}
	}
//	if (errors!="" && d.acao.value=="Incluir") {
	if (errors!="") {
		alert("Foram encontrados os seguintes erros:\n\n"+errors);
		if (y.getAttribute("type")!='hidden') {
			y.focus();
		}
		return false;
	}
return true;
}
<!-- ----------------------------------------------------------------------------------------- -->


<!-- ----------------------------------------------------------------------------------------- -->
function checkradios(form) {
var el = document.forms[form].elements;
var itemchecked = false;
for(var i=0; i<el.length; ++i) {
	if (el[i].type=="radio" && el[i].obrigatorio!=null) {
		var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
		var itemchecked = false;
		for(var j=0; j<radiogroup.length; ++j) {
			if(radiogroup[j].checked) {
				itemchecked = true;
				break;
			}
		}
		if (radiogroup.length==undefined) { itemchecked=true }
		if (!itemchecked) {
			if (el[i].focus) el[i].focus();
			alert(el[i].obrigatorio+"!");
			return false;
		}
	}
}
return true;
}
<!-- ----------------------------------------------------------------------------------------- -->


<!-- ----------------------------------------------------------------------------------------- -->
function checktudo(formName) {
	d=document.forms[formName];
	btn_excluir = "Excluir;deltudo";
	//alert(d.acao.value);
	if (d.acao==null) {	acione='' } else { acione = d.acao.value }
	if (btn_excluir.indexOf(d.acao.value)>0) { if (confirm('Tem certeza que deseja EXCLUIR?????')) { return true } else { return false } }
	else
	{
		//if (checkform(formName) && checkradios(formName) && confirm('Confirma?'))
		if (checkform(formName) && checkradios(formName))
		{ return true } else { return false }
	}
}
<!-- ----------------------------------------------------------------------------------------- -->


<!-- ------------------------------ VERIFICA SE O E-MAIL É VÁLIDO ---------------------------- -->
function checkemail(formName) {
	d=document.forms[formName];
	parte1 = d.email.value.indexOf("@");
	parte2 = d.email.value.indexOf(".com");
	parte3 = d.email.value.length;
	if (!(parte1 >= 2 && parte2 >= 6 && parte3 >= 9)) {
		alert ("O e-mail digitado é inválido!");
		d.email.focus();
		d.email.select();
		return false;
	}
}
<!-- ----------------------------------------------------------------------------------------- -->


<!-- ------------------------------------------------------------------------------------------ -->
function validaCPF(cpf) {
               erro = new String;
               if (cpf.length < 11) erro += "Sao necessarios 11 digitos para verificacao do CPF! \n\n"; 
               var nonNumbers = /\D/;
               if (nonNumbers.test(cpf)) erro += "A verificacao de CPF suporta apenas numeros! \n\n"; 
               if (cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999"){
                       erro += "Numero de CPF invalido!"
              }
              var a = [];
              var b = new Number;
              var c = 11;
              for (i=0; i<11; i++){
                      a[i] = cpf.charAt(i);
                      if (i < 9) b += (a[i] * --c);
              }
              if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11-x }
              b = 0;
              c = 11;
              for (y=0; y<10; y++) b += (a[y] * c--); 
              if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11-x; }
              if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10])){
                      erro +="Digito verificador com problema!";
              }
              if (erro.length > 0){
                      alert(erro);
                      return false;
              }
              return true;
}
<!-- ------------------------------------------------------------------------------------------ -->

