
function testaNumero(inputBox, texto) {
  str = inputBox.value;
  for (i = 0; i < str.length; i++) {
        var ch = str.charAt(i);
        if ((ch < "0" || ch > "9")) {
			alert ("O "+texto+" não é válido!");
			inputBox.focus();
			return false;
		}
  }
  return true;
}

function digitaNumero(num)
{
   if (navigator.appName.indexOf("Internet Explorer") > 0) {  
      var tecla = window.event.keyCode;      
		if ((tecla > 47 && tecla < 58) || (tecla == 13) || (tecla == 8) || (tecla == 9)) {
			return true;
      } else {
         event.keyCode = 0;
         return false;
      }
   } else {      
      var tecla = num.charCode;     
      if ((tecla > 47 && tecla < 58) || (tecla == 13) || (tecla == 8) || (tecla == 0)) {
			return true;
      } else {
         return false;
      }
   }
}

function testaMinimo(inputBox, minimo, texto){
  str = inputBox.value;
  if (str.length<minimo) {
	alert(texto + " deve possuir no mínimo " + minimo +" caracteres.");
	inputBox.focus();
	return false;
  }
  return true;
}

function digitaMoeda()
{
	var Tecla = window.event.keyCode;
	event.cancelBubble = true;
	if(Tecla==46 || Tecla==44){
        var texto = window.event.srcElement.value;
        if(texto.indexOf(",")>-1){
            event.returnValue = false;
        }else{
            window.event.keyCode=44;
            event.returnValue = true;        
        }
    }else{
        if((Tecla > 47 && Tecla < 58))
		    event.returnValue = true;
    	else
		    event.returnValue = false;
   }
}

