// JavaScript Document
function highlight(obj,cor)
{
	obj.style.background = cor;
}

var teste;

function mascara(e, src, mask) 
{
	//alert(e);
	if(window.event) 
	{
		_TXT = e.keyCode;
	} 
	else if(e.which) 
	{
		_TXT = e.which;
	}
	
	//alert(_TXT);
	
	if(_TXT > 47 && _TXT < 58) 
	{
		var i = src.value.length; 
		var saida = mask.substring(0,1);
		var texto = mask.substring(i);
		if (texto.substring(0,1) != saida) 
		{
		  	src.value += texto.substring(0,1);
		}
		return true;
	} 
	else 
	{
		if (_TXT != 8) 
		{
		  	return false;
		}
		else 
		{
			return true;
		}
	}
}

function PulaCampo(campo_atual,proximo_campo,num_digitos) {
  if (campo_atual.value.length == num_digitos){
    proximo_campo.focus();
  }
}
