function IsDecimal(sText)
{
   var ValidChars = ".0123456789";
   var IsDecimal=true;
   var Char;
   for (i = 0; i < sText.length && IsDecimal == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsDecimal = false;
         }
      }
   return IsDecimal;
}



function validateKeySearch(form) 
{
  // alert('Checking form...');
  var errorMsg = '';
  
  if (form.keyword.value == "" || form.keyword.value == "Order Code & Keyword search")
  {
    errorMsg += 'Please enter something to search for.\n';
  	form.keyword.focus();
	form.keyword.select();
  }
	
  if (errorMsg) 
	alert(errorMsg);
		
  document.returnValue = (errorMsg == '');
}



function validateTorqueSearch(form) 
{
  // alert('Checking form...');
  var errorMsg = '';
  
  if (form.maxtorque.value == "" || form.maxtorque.value == "Maximum torque in N.m")
  {
    errorMsg += 'Please enter a Torque value (in N.m) \n';
  	form.maxtorque.focus();
	form.maxtorque.select();
  }
  
  if (!IsDecimal(form.maxtorque.value))
  {
    errorMsg += 'Use positive decimal numbers only for the Torque value\n';
  	form.maxtorque.focus();
	form.maxtorque.select();
  }
	
  if (errorMsg) 
	alert(errorMsg);
		
  document.returnValue = (errorMsg == '');
}