function changeButton(s)  {
// 	alert("Within JS file changeButton");
	s.value = "Please Wait";
	return true;
}

function waitButton(s)  {
// 	alert("Within JS file waitButton");
        if (condition==true){
           s.value="ClickToGo";
           s.disabled=false;
        }else{
           s.value="PleaseWait";
           s.disabled=true;
        }
}


function disableButton(theform) {
//	alert ("Within JS file disableButton"); 
	var i;

	if (document.all || document.getElementById) {
  	   for (i = 0; i < theform.length; i++) {
		var tempobj = theform.elements[i];
		if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
		tempobj.disabled = true;
           }
	   return true;
	}
        return false;
}

function FrontPage_Form1_Validator_old(theForm)
{
// alert ("Within JS file FrontPage_Form1_Validator"); 
  if (theForm.Shipment.value == "")
  {
    alert("Please enter a value for the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  if (theForm.Shipment.value.length < 8)
  {
    alert("Please enter at least 8 numbers in the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  if (theForm.Shipment.value.length > 8)
  {
    alert("Please enter at most 8 numbers in the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Shipment.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only numbers in the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  if (decPoints > 1)
  {
    alert("Please enter a valid number in the \"Shipment\" field.");
    theForm.Shipment.focus();
    return (false);
  }
  return (true);
}

function FrontPage_Form1_Validator(theForm)
{

  if (theForm.Pfx.value == "")
  {
    alert("Please enter a value for the \"Prefix\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  if (theForm.Pfx.value.length < 3)
  {
    alert("Please enter at least 3 numbers in the \"Prefix\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  if (theForm.Pfx.value.length > 3)
  {
    alert("Please enter at most 3 numbers in the \"Prefix\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Pfx.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit digits in the \"Prefix\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  if (decPoints > 1)
  {
    alert("Please enter a valid number in the \"Pfx\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  if (theForm.Shipment.value == "")
  {
    alert("Please enter a value for the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  if (theForm.Shipment.value.length < 8)
  {
    alert("Please enter at least 8 digits in the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  if (theForm.Shipment.value.length > 8)
  {
    alert("Please enter at most 8 digits in the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Shipment.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digits in the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  if (decPoints > 1)
  {
    alert("Please enter a valid number in the \"Shipment\" field.");
    theForm.Shipment.focus();
    return (false);
  }
  return (true);
}


function Validate_text_box(theForm)


{
alert ("Within JS file Validate_text_box"); 

  if (theForm.Pfx.value == "")
  {
    alert("Please enter a value for the \"Prefix\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  if (theForm.Pfx.value.length < 3)
  {
    alert("Please enter at least 3 numbers in the \"Prefix\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  if (theForm.Pfx.value.length > 3)
  {
    alert("Please enter at most 3 numbers in the \"Prefix\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Pfx.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit digits in the \"Prefix\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  if (decPoints > 1)
  {
    alert("Please enter a valid number in the \"Pfx\" field.");
    theForm.Pfx.focus();
    return (false);
  }

  if (theForm.Shipment.value == "")
  {
    alert("Please enter a value for the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  if (theForm.Shipment.value.length < 8)
  {
    alert("Please enter at least 8 digits in the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  if (theForm.Shipment.value.length > 8)
  {
    alert("Please enter at most 8 digits in the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Shipment.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digits in the \"AWB number\" field.");
    theForm.Shipment.focus();
    return (false);
  }

  if (decPoints > 1)
  {
    alert("Please enter a valid number in the \"Shipment\" field.");
    theForm.Shipment.focus();
    return (false);
  }
  return (true);
}
