<!--
function somenteNumero(e,id_element){
	var key
	if(window.event) {
	// Atenter o IE
		key = e.keyCode; 
		if (( key < 47 )||( key > 58 )) {
				window.event.returnValue = null; 
				return;
		}		
	}
	else if (e.which) {
	//Atender NetScape.
			key = e.which;
			if (( key < 47 )||( key > 58 )) {
					e.preventDefault();
					return ; 
			}		
	}

}


function autojump(fieldName,nextFieldName,fakeMaxLength)
{
var myForm=document.forms[document.forms.length - 1];
var myField=myForm.elements[fieldName];
myField.nextField=myForm.elements[nextFieldName];

if (myField.maxLength == null)
   myField.maxLength=fakeMaxLength;

myField.onkeydown=autojump_keyDown;

if(myField.name.substring(0, 4) == 'cnpj1')
	myField.onkeyup=autojump_keyUpCNPJ;
else if(myField.name.substring(0, 3) == 'cpf1')
	myField.onkeyup=autojump_keyUpCPF;
else
myField.onkeyup=autojump_keyUp;
}

function autojump_keyDown()
{
this.beforeLength=this.value.length;
downStrokeField=this;
}

function autojump_keyUp()
{
if ((this == downStrokeField) && (this.value.length > this.beforeLength) && (this.value.length >= this.maxLength)){
	if(this.nextField.type == "text")
		this.nextField.select();
	else
		this.nextField.focus();	
}
downStrokeField=null;
}

function verifica_mail(mail) {		
	if (mail.value.length > 0) {		
		if (!/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(mail.value)) {
			alert('E-mail incorreto.');
			mail.focus();
			return false;
		}
		var nome, sufixo;
		nome = $('id_nome');
		sufixo = $('id_sufixo');
		var _dominio = nome.value + '.' + sufixo.value;
		var _dominio_email = mail.value;
		var _iPos = _dominio_email.indexOf('@', 0);
		_dominio_email = _dominio_email.substring(_iPos+1, _dominio_email.length);
		if (_dominio_email == _dominio) {
			alert('E-mail Inválido.\n Este deve ser um e-mail válido!');
			mail.focus();
			return false;
		}		
	}
	return true;
}


function valida() {
if (document.teligaform.ddd.value == ""){alert('Informe o DDD');this.document.teligaform.ddd.focus();return false;}
if (document.teligaform.ddd.value.length < 2){alert('O DDD deve conter dois números');this.document.teligaform.ddd.focus();return false;}
if (document.teligaform.telefone.value == ""){alert('Informe o número de telefone');this.document.teligaform.telefone.focus();return false;}
if (document.teligaform.telefone.value.length < 7){alert('O número de telefone deve conter pelo menos 7 números');this.document.teligaform.telefone.focus();return false;}

if (document.teligaform.nome.value == ""){alert('Informe o nome ou razão social');this.document.teligaform.nome.focus();return false;}
if (document.teligaform.email.value.length == 0){alert('Email é um campo obrigatório!');document.teligaform.email.focus();return false;}

if(!verifica_mail(document.teligaform.email)){return false;}	

return true;
}


//-->
