<!-- hide
var win;
var msie3=false;

browserVer=parseInt( navigator.appVersion );
if( browserVer == 2 && navigator.appName == "Microsoft Internet Explorer" ) {
  browserVer++;
  msie3=true;
}

function checkForm(form)
{
  
  awb=strip( form.awb_no.value );
  var awbs=new Array;
  var tmp="";
  var curr=0;
  for(i=0;i<awb.length;i++) {
    c=awb.charAt( i );
    d=parseInt( c );
    if( ( msie3==true && !( d==0 && c != "0" ) ) || ( msie3==false && !isNaN( d ) ) ) {
      tmp+=c;
    }
    else {
      if( tmp != "" ) {
        awbs[curr]=tmp;
        curr++;
        tmp="";
      }
    }
  }
  if( tmp != "" )
    awbs[curr]=tmp;

  num=awbs.length;

  if( num == 0 )
  {
     alert( "The Airwaybill No. is missing", "Please enter a 10-digit Airwaybill No." );
     return false;
  }


  errors="";
  off=0;
  for( i=0 ; i< num ; i++ )
  {
    awbs[i]=strip( awbs[i] );
    if( awbs[i].length == 3 && awbs[i+1] && awbs[i+1].length == 4 && awbs[i+2] && awbs[i+2].length == 3 )
    {
      if( errors == "" )
        errors=""+(i+1);
      else
        errors+=(  ", " + (i+1-off) );
      off+=2;
    }
  }

  if( errors != "" ) {
    if( msie3 == false )
      numbad=errors.split( ", " );
    else
      numbad=new Array(2);
  if( numbad.length == 1 )
      alert( "Invalid Airwaybill No.", "Airwaybill No. " + numbad[0] + " has been split into 3 groups of digits.<BR>Airwaybill No. should be an unbroken string of 10-digits.<P>Please correct or remove this Airwaybill No." );
    else
      alert( "Invalid Airwaybill numbers", "Airwaybill numbers " + errors + " have all been split into 3 groups of digits.<BR>Airwaybill numbers should be an unbroken string of 10-digits.<P>Please correct or remove these Airwaybill numbers." );

    return false;
  }

  if( num > 30  ) {
     alert( "More than 10 shipments are input", "Please enter a maximum of 10 shipments." );
     return false;
  }

  errors="";
  for( i=0 ; i< num ; i++ ) {
    awbs[i]=strip( awbs[i] );
    if( awbs[i].length != 10 && !isNaN( awbs[i] ) ) {
      if( errors == "" )
        errors=""+(i+1);
      else
        errors+=(  ", " + (i+1) );
    }
  }
  if( errors != "" ) {
    if( msie3 == false )
      numbad=errors.split( ", " );
    else
      numbad=new Array(2);

    if( numbad.length == 1 )
      alert( "Invalid Airwaybill No.", "The Airwaybill No. on row " + numbad[0] + " is not a 10-digit No.<P>Please enter a 10-digit Airwaybill No." );
    else
      alert( "Invalid Airwaybill numbers", "The Airwaybill numbers on rows " + errors + " are not 10-digit numbers.<P>Please enter 10-digit Airwaybill numbers." );

    return false;
  }

  errors="";
  for( i=0 ; i< num ; i++ ) {
    awbs[i]=strip( awbs[i] );
    check1=awbs[i].substring(9,10);
    tocheck=awbs[i].substring(0,9);
    check2=tocheck % 7;
    if( check1 != check2  && awbs[i] != "" ) {
      if( errors == "" )
        errors=""+(i+1);
      else
        errors+=(  ", " + (i+1) );
    }
  }
  if( errors != "" ) {
    if( msie3 == false )
      numbad=errors.split( ", " );
    else
      numbad=new Array(2);

    if( numbad.length == 1 )
      alert( "Invalid Airwaybill No.", "The Airwaybill No. on row " + numbad[0] + " is not a valid Airwaybill No.<P>Please correct or remove this Airwaybill No." );
    else
      alert( "Invalid Airwaybill numbers", "The Airwaybill numbers on rows " + errors + " are not valid airwaybill numbers.<P>Please correct or remove these Airwaybill numbers." );

    return false;
  }

  form.awb.value=awbs[0];

  for( i=1 ; i< num ; i++ )
    form.awb.value+="|"+awbs[i];

  return true;
}



// -->
