/*	-------------------------------------------------
	FORMATA LETRAS
	-------------------------------------------------*/
	function formata(tipo,campo)
	{
		switch(tipo)
		{
			case 1: //CAIXA BAIXA - EVENTO: onBlur
			{
				campo.value = campo.value.toLowerCase();
				break;
			}
			case 2://CAIXA ALTA - EVENTO: onBlur
			{
				campo.value = campo.value.toUpperCase();
				break;
			}
		}
	}

/*	-------------------------------------------------
	DATA
	-------------------------------------------------*/
	function mascara_data(obj,tecla)
	{
		nomeObj = obj.name;
		valor = tecla.srcElement.value;
		tam = valor.length;

		//Testa se não foram digitados números
		if (tecla.keyCode < '48' || tecla.keyCode > '58')
		{
			alert('Por favor,\ndigite apenas números!'); 
			tecla.keyCode = '127';
			obj.focus();
		}
		else
		{
			if(tam==2)
			{
				tecla.srcElement.value = valor.substr(0,tam) + '/';
			}
			if(tam==5)
			{
				tecla.srcElement.value = valor.substr(0,tam) + '/';
			}
		}
	}

/*	-------------------------------------------------
	DDD
	-------------------------------------------------*/
	function mascara_ddd(obj,tecla)
	{
		nomeObj = obj.name;
		valor = tecla.srcElement.value;
		tam = valor.length;
		//Testa se não foram digitados números
		 if (tecla.keyCode < '48' || tecla.keyCode > '58')
		{
			alert('Por favor,\ndigite apenas números!'); 
			tecla.keyCode = '127';
			obj.focus();
		}
	}

/*	-------------------------------------------------
	TELEFONE
	-------------------------------------------------*/
	function mascara_tel(obj,tecla)
	{
		nomeObj = obj.name;
		valor = tecla.srcElement.value;
		tam = valor.length;

		//Testa se não foram digitados números
		if (tecla.keyCode < '48' || tecla.keyCode > '58')
		{
			alert('Por favor,\ndigite apenas números!'); 
			tecla.keyCode = '127';
			obj.focus();
		}
		else
		{
			if(tam==4)
			{
			  tecla.srcElement.value = valor.substr(0,tam) + '-';
			}
		}
	}
