function check(input,simbol) {
  var ok = true;
  for (var i = 0; i < input.length; i++) {
    var chr = input.charAt(i);
    var found = false;
    for (var j = 0; j < simbol.length; j++) {
  
      if (chr == simbol[j]){
        found = true;
        break;
       }
    }
    if (!found) ok = false;
  }
  return ok;
}

var sdsimbol = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");

function isQty(text) {
  if (!(text.value == "")) {
		strCheck=text.value;
		if (!check(strCheck,sdsimbol)) {
			alert("Quantities must be between 1 and 999.");
			text.value = 1;
			text.focus();      
		}
   else {
		if (text.value < 1 || text.value > 9999) {
			alert("Quantities must be between 1 and 9999."); 
			text.value = 1;
			text.focus();
		}		
    }
  }
}