function soNumero(e){
    // ===--- Evento obj:
    if (window.ActiveXObject != null) e = event;
	
	var code = e.keyCode;
	var valido = false;
	
	switch (code) {
		case 8:
		case 9:
		case 46:
			valido = true;
	}
	
	if ((code >= 48 && code <= 57) || (code >=96 && code <= 105)
		|| (code >= 35 && code <= 40) || valido) return true;	
	
	return false;
}

function validaForm(){

	var el  = concatObj(document.getElementsByTagName('input'), document.getElementsByTagName('select'));
	var l   = el.length;
	var ret = true;
	
	for (y=0; y<l; y++){
		if(el[y].getAttribute('req')){
			var valor = el[y].value;
			if(valor.split(" ").join('') == ""){
				// se não tiver id no input, ele coloca a mesma coisa q o name
				if(!el[y].id){
					el[y].id = el[y].name;	
				}
				// troca a cor do label, se definir um label no padrão correto.
				if(document.getElementById('lab_'+el[y].id)){
					//document.getElementById('lab_'+el[y].id).style.color = '#FF0000'; // colore o texto para vermelho
					document.getElementById('lab_'+el[y].id).className = 'error'; // muda a classe do css
				}
				// coloca a imagem no lugar certo, se definir local no padrão correto.
				if(document.getElementById('img_'+el[y].id)){
					document.getElementById('img_'+el[y].id).innerHTML   = '<img src="imagens/requerido.gif" title="Este campo é de preenchimento obrigatório.">';
				}
				// muda a ret para não submeter o formulario
				var ret = false;
			}
			
		}
	}
	
	if(ret == false){
		alert('Os campos em vermelhos são obrigatórios!');
	}
	
	return ret;
	
}

function concatObj() {
	var obj = new Array();
	
	for (var i = 0; i < arguments.length; i++) {
		for (var j = 0; j < arguments[i].length; j++) {
			obj.push(arguments[i][j]);
		}
	}
	
	return obj;
}