function focusField(currentField, nextField){
		
		var element = document.getElementById(currentField);
		
		if(element.value.length == element.maxLength){
			document.getElementById(nextField).focus();
		}
	
	}
	
	function isNumberKey(evt){
		var charCode = (evt.which) ? evt.which : event.keyCode
		if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;

		return true;
	}
	
	function changeVisibility(which){
		
		if (!document.getElementById)
		
		return
		
		if (which.style.visibility == "hidden"){
			which.style.visibility 	= "visible";
			which.style.display 	= "block";
		}
		else{
			which.style.visibility	= "hidden";
			which.style.display 	= "none";
		}
	}
	
	function contarCaracteres(campo, contador, limite) {
		
		var field = document.getElementById(campo);
		var fieldCount = document.getElementById(contador);
		
        if (field.value.length > limite)
          field.value = field.value.substring(0, limite);
        else
          fieldCount.innerHTML = limite - field.value.length;
    }
	
	function cargosArea(tipo){
		
		if(tipo == "TI"){
			document.getElementById("cargosTI").style.visibility 	= "visible";
			document.getElementById("cargosTI").style.display 		= "block";
			
			//document.getElementById("cargosTip").style.visibility 	= "visible";
			//document.getElementById("cargosTip").style.display 		= "block";
			
			document.getElementById("cargosOutras").style.visibility 	= "hidden";
			document.getElementById("cargosOutras").style.display 		= "none";
		}
		
		else{
			document.getElementById("cargosTI").style.visibility 	= "hidden";
			document.getElementById("cargosTI").style.display 		= "none";
			
			//document.getElementById("cargosTip").style.visibility 	= "hidden";
			//document.getElementById("cargosTip").style.display 		= "none";
			
			document.getElementById("cargosOutras").style.visibility 	= "visible";
			document.getElementById("cargosOutras").style.display 		= "block";
		}
	}
	
	function validaData(dia,mes,ano){
		
		if (isNaN(dia) || dia < 1 || dia > 31)
			return false; 

	    if (isNaN(mes) || mes < 1 || mes > 12)
			return false; 

	    if (isNaN(ano) || ano < 1)
			return false; 

		if ((mes == 1 || mes == 3 || mes == 5 || mes == 7 || mes == 8 || mes == 10 || mes == 12 ) && dia > 31)
			return false; 
		else if ((mes == 4 || mes == 6 || mes == 9 || mes == 11 ) && dia > 30) 
			return false; 
		else if (mes == 2) {
			if (ano % 4 != 0) {
				if (dia > 28)
					return false; 
			}
			else {
				if (dia > 29)
					return false; 
			}
		}
		return true;
	}
	
	function validaEmail(field) {
	
		var regEx = /^[a-zA-Z0-9]{1}([\._a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+){1,3}$/;
		
		if (!element(field).value.match (regEx)){
			return false;
		}
		else{
			return true;
		}
	}


	
	
	function element(id){
	
		return document.getElementById(id);
	}
	
	
	function trim(texto){

		while(texto.match(/^(\s)/)){
			texto = texto.replace(/^(\s)/,"");
		}
		
		while(texto.match(/(\s)$/)){
			texto = texto.replace(/(\s)$/,"");
		}
		
		while(texto.match(/(\w\s\s\w)/)){
			texto = texto.replace(/(\w\s\s\w)/," ");
		}
		
		return texto;
		
	}

