// JavaScript Document

function teclaData(e, obj)
{
	if(navigator.appName=='Netscape')
		var tecla = e.charCode;
	if(navigator.appName=='Microsoft Internet Explorer')
		var tecla = e.keyCode;

	if ((tecla > 47 && tecla < 58))
	{ 
		if((obj.value.length == 2))
		   obj.value = obj.value + '/';
		else if((obj.value.length == 5))
		   obj.value = obj.value + '/';

		return true;
	}
	else
	{
		if (tecla != 8)
		{
			if(navigator.appName=='Netscape')
				e.charCode = 0;
			if(navigator.appName=='Microsoft Internet Explorer')
				e.keyCode = 0;
		}
		else return true;
	}
}

function teclaHora(e, obj)
{
	if(navigator.appName=='Netscape')
		var tecla = e.charCode;
	if(navigator.appName=='Microsoft Internet Explorer')
		var tecla = e.keyCode;

	if ((tecla > 47 && tecla < 58))
	{ 
		if((obj.value.length == 2))
		   obj.value = obj.value + ':';
		return true;
	}
	else
	{
		if (tecla != 8)
		{
			if(navigator.appName=='Netscape')
				e.charCode = 0;
			if(navigator.appName=='Microsoft Internet Explorer')
				e.keyCode = 0;
		}
		else return true;
	}
}

function teclaFone(e, obj)
{
	if(navigator.appName=='Netscape')
		var tecla = e.charCode;
	if(navigator.appName=='Microsoft Internet Explorer')
		var tecla = e.keyCode;
	

	if ((tecla > 47 && tecla < 58))
	{ 
		if((obj.value.length == 4))
		   obj.value = obj.value + '-';
		return true;
	}
	else
	{
		if (tecla != 8)
		{
			if(navigator.appName=='Netscape')
				return false;
			if(navigator.appName=='Microsoft Internet Explorer')
				e.keyCode = 0;
		}
		else return true;
	}
}

function teclaCEP(e, obj)
{
	if(navigator.appName=='Netscape')
		var tecla = e.charCode;
	if(navigator.appName=='Microsoft Internet Explorer')
		var tecla = e.keyCode;
	

	if ((tecla > 47 && tecla < 58))
	{ 
		if((obj.value.length == 5))
		   obj.value = obj.value + '-';
		return true;
	}
	else
	{
		if (tecla != 8)
		{
			if(navigator.appName=='Netscape')
				return false;
			if(navigator.appName=='Microsoft Internet Explorer')
				e.keyCode = 0;
		}
		else return true;
	}
}

function teclaCPF(e, obj)
{
	if(navigator.appName=='Netscape')
		var tecla = e.charCode;
	if(navigator.appName=='Microsoft Internet Explorer')
		var tecla = e.keyCode;

	if ((tecla > 47 && tecla < 58))
	{ 
		if(obj.value.length == 3)
		   obj.value = obj.value + '.';
		else
			if(obj.value.length == 7)
				obj.value = obj.value + '.';
		else
			if(obj.value.length == 11)
				obj.value = obj.value + '-';
		return true;
	}
	else
	{
		if (tecla != 8)
		{
			if(navigator.appName=='Netscape')
				e.charCode = 0;
			if(navigator.appName=='Microsoft Internet Explorer')
				e.keyCode = 0;
		}
		else return true;
	}
}

function teclaCNPJ(e, obj)
{
	if(navigator.appName=='Netscape')
		var tecla = e.charCode;
	if(navigator.appName=='Microsoft Internet Explorer')
		var tecla = e.keyCode;

	if ((tecla > 47 && tecla < 58))
	{ 
		if(obj.value.length == 2)
		   obj.value = obj.value + '.';
		else
			if(obj.value.length == 6)
				obj.value = obj.value + '.';
		else
			if(obj.value.length == 10)
				obj.value = obj.value + '/';
		else
			if(obj.value.length == 15)
				obj.value = obj.value + '-';
				
		return true;
	}
	else
	{
		if (tecla != 8)
		{
			if(navigator.appName=='Netscape')
				e.charCode = 0;
			if(navigator.appName=='Microsoft Internet Explorer')
				e.keyCode = 0;
		}
		else return true;
	}
}
