////
//
// $Id: MaskKeyPress.js,v 1.2 2008/08/20 14:29:08 ms00959 Exp $
//
// $Log: MaskKeyPress.js,v $
// Revision 1.2  2008/08/20 14:29:08  ms00959
// Atualizando este CetelemResources com a versão de produção (Portal Cetelem versão 5.1) do dia 20Ago2008. (Marcelo Miashiro)
//
// Revision 1.3  2005/11/21 18:22:33  ms00959
// *** empty log message ***
//
// Revision 1.2  2005/03/14 13:26:31  as00755
// Alterado a mascara de email para nao aceitar espacos.
//
// Revision 1.1  2004/12/06 14:06:22  as00755
// Criacao
//
////

// Permite a digitacao somente de caracteres Alfabeticos
function maskKeyPressAlpha(objEvent)
{
	var iKeyCode;

	if (navigator.appName.toUpperCase().match(/MICROSOFT INTERNET EXPLORER/) != null)
	{
		iKeyCode = objEvent.keyCode;
	}
	else
	{
		iKeyCode = objEvent.which; 
	}

	if (iKeyCode>=97 && iKeyCode<=122 || iKeyCode>=65 && iKeyCode<=90 || iKeyCode==127 || iKeyCode==32 || iKeyCode==8 || iKeyCode == 0)
	{
		return true;
	}

	return false;
}

// Permite a digitacao somente de caracteres Numericos e vírgula
// Utilizar a funcão maskKeyPressOnlyNumbers() se quiser garantir que somente números sejam digitados, sem vírgula
function maskKeyPressInt(objEvent)
{
	var iKeyCode;

	if (navigator.appName.toUpperCase().match(/MICROSOFT INTERNET EXPLORER/) != null)
	{
		iKeyCode = objEvent.keyCode;
	}
	else
	{
		iKeyCode = objEvent.which;
	}
	if (iKeyCode>=48 && iKeyCode<=57 || iKeyCode==127 || iKeyCode==44 || iKeyCode==8 || iKeyCode==0)
	{
		return true;
	}

	return false;
}

// Permite a digitacao somente de caracteres Numericos
function maskKeyPressOnlyNumbers(objEvent)
{
	var iKeyCode;

	if (navigator.appName.toUpperCase().match(/MICROSOFT INTERNET EXPLORER/) != null)
		iKeyCode = objEvent.keyCode;
	else
		iKeyCode = objEvent.which;

	return (iKeyCode>=48 && iKeyCode<=57 || iKeyCode==127 || iKeyCode==8 || iKeyCode==0)

}

// Permite a digitacao somente de caracteres AlfaNumericos
function maskKeyPressAlphaInt(objEvent)
{
	if (maskKeyPressAlpha(objEvent) || maskKeyPressInt(objEvent))
	{
		return true;
	}

	return false;
}

// Permite a digitacao somente de caracteres permitidos para composicao de nomes de email
function maskKeyPressEmail(objEvent)
{
	var iKeyCode;

	if (navigator.appName.toUpperCase().match(/MICROSOFT INTERNET EXPLORER/) != null)
	{
		iKeyCode = objEvent.keyCode;
	}
	else
	{
		iKeyCode = objEvent.which;
	}
	if ((maskKeyPressAlphaInt(objEvent) && iKeyCode!=32) || iKeyCode==45 || iKeyCode==46 || iKeyCode==64 || iKeyCode==95)
	{
		return true;
	}

	return false;
}

function maskKeyPressPassword(objEvent) 
{
	return false;
}

