// Verificamos browser, versão e sistema operacional 
var isNav = false, isIE = false, isWin = false, Versao="0";

AppName = navigator.appName
AppVersion = navigator.appVersion
if ( AppName.indexOf("Netscape") != -1 )
{
  isNav = true;
  Versao = AppVersion.substring(0, 4);
  AuxStr = AppVersion.substring(AppVersion.indexOf("W"), AppVersion.indexOf(";"));
  document.captureEvents(Event.KEYDOWN);
}
else if ( AppName.indexOf("Microsoft") != -1 )
{
   isIE = true;
   Versao = AppVersion.substring((AppVersion.indexOf("E")+1), (AppVersion.indexOf("E")+6));
   AuxStr = AppVersion.substring(AppVersion.indexOf("W"), (AppVersion.length-1));
}

if ( ( isNav && AuxStr.indexOf("16") != -1 ) ||
     ( isIE && AuxStr.indexOf("3.1") != -1 ) ||
     ( AuxStr.indexOf("95") != -1 ) || ( AuxStr.indexOf("98") != -1 ) || ( AuxStr.indexOf("NT") != -1 ) || ( AuxStr.indexOf("32") != -1 ) )
{
  isWin = true;
}

NUMVER = parseFloat(Versao);
if ( NUMVER >= 5) Versao = "5";
else if ( NUMVER >= 4 ) Versao = "4";
else if ( NUMVER >= 3 ) Versao = "3";
else Versao = "2";

function ValidaConteudo_OnKeyPress( el, event, tipo )
{
  var key;

  if (isNav)
    key = String.fromCharCode( event.which );
  else
    key = String.fromCharCode( event.keyCode );

  if ( el.value.indexOf( "," ) != -1 && key == "," )
    return false;

  if ( isNav && event.which == 8 )
    return true;

  if ( ( ( tipo != "decimal" ) || ( tipo == "decimal" && ( ( key != "," || el.value.indexOf( "," ) != -1 ) ) ) ) && !ValidaCaractere( key ) )
    return false;

  return true;
}

function ValidaCaractere( caractere )
{
  var strValidos = "0123456789,"
  if ( strValidos.indexOf( caractere ) == -1 )
  {
    return false
  }
  return true
}