function ValidaAlfa( caractere )
{
	var strValidos = "abcdefghijklmnopqrstuwvxyzçABCDEFGHIJKLMNOPQRSTUWVXYZÇ"
	if ( strValidos.indexOf( caractere ) == -1 )
	{
		return false;
	}
	return true;
}

function isEmail(field) 
{
	if (field.value == '') 
	{
		alert ("\n O campo e-mail está em branco. \n\n\n Por favor preencha o campo e-mail.");
		field.focus();
		return false;
	}
	if (field.value.indexOf ('@',0) == -1 ||
	field.value.indexOf ('.',0) == -1) 
	{
		alert ("\n Seu e-mail está sem \"@\" ou incorreto. \n\n Por favor digite corretamente.")
		field.select();
		field.focus();
		return false;
	}
	return true;
}

function ValidaCaractere( caractere )
{
	var strValidos = "0123456789"
	if ( strValidos.indexOf( caractere ) == -1 )
	{
		return false;
	}
	return true;
}

//=====================================================
//
//                Validação de campos V.01
//                  por Renato Miyasaki
//
//            SCRIPT ALTERADO POR MARCEL UENO
//                     20 Agosto 2004          
//                                       
// utilização:                                
//  - na tag <form>                          
//  onSubmit="return verificaCampos(this);"
//
//  - nos campos obrigatórios
//  acao="verifica"
//
//======================================================

function Formulario(oForm) {
	this.form = oForm;
}

Formulario.prototype._tipoCampo = {};

Formulario.prototype.verificaCampos = function (){
	for (x = 0; this.form.elements[x]; x++) {
		if((this.form.elements[x].acao=='verifica') && !this.verifica(this.form.elements[x],this.form.elements[x].tipo))
			return false;
	}
	this.form.submit();
}

Formulario.prototype.verifica = function (eElement,oTipo) {
	if (this._tipoCampo[oTipo])
		return this._tipoCampo[oTipo].funcao(eElement);
	return this.verificacaoBasica(eElement);
}

Formulario.prototype.verificacaoBasica = function (eElement) {
	if(eElement.value==''){
		alert(eElement.name+' é campo obrigatório');
		return false;
	} else {
		return true;
	}
}

Formulario.prototype.novoTipoCampo = function (oTipo, fFuncao) {
	this._tipoCampo[oTipo] = {
		tipo:			oTipo,
		funcao:			fFuncao || Formulario.verificacaoBasica
	};
};
