<!--

// File:     xferPilot.js
// Function: The script portion of the xfer pilot application
//
// Author:   Bryan J Opalka
// Created:  16-Jan-2000
//
// Copyright (c) 2000
// This script is the property of the Bryan Opalka and cannot be copied or used without
// the permission of the author.


var is_zeroes = "0000000000000000000000000000000000000000000000000000000000000000" ;



function of_upIt( fe )
{
    fe.value = fe.value.toUpperCase() ;
    return( true ) ;
}


function of_formatNumber( fe, maxlen )
{
   var s = fe.value ;
   
   s = is_zeroes.substr( 0, (maxlen - s.length )) + s ;
   fe.value = s ;
      
   return( fe ) ;
}


function of_formatYear( fe )
{
   var y = fe.value ;
   
   if ( y.length == 2 )
      y = "19" + y ;
   else
      if ( y.length < 4 )
         y = "1900".substr( 0, 4 - y.length ) + y ;

   fe.value = y ;
   return( fe ) ;
   
}


function checkIt( theForm )
{
   var lb_return = true;

   if ( theForm.certs.value == "" )
      {
      alert( "You must enter your current aircraft certifications!" );
      theForm.certs.focus();
      lb_return = false;
      }

   if ( theForm.hours.value == "" )
      {
      alert( "You must enter your flight hours!" );
      theForm.hours.focus();
      lb_return = false;
      }
   else
      if ( isNaN( parseFloat( theForm.hours.value )) )
         {
         alert( "The flight hours must be numeric!" );
         theForm.hours.focus();
         lb_return = false;
         }
 
   if ( theForm.boption[0].checked ||
        theForm.boption[1].checked )
      {}
   else
      {
      alert( "You must enter your desired bid option!" );
      theForm.boption[0].focus();
      lb_return = false;
      }

   if ( theForm.foption[0].checked ||
        theForm.foption[1].checked ||
        theForm.foption[2].checked )
      {}
   else
      {
      alert( "You must enter your desired flight option!" );
      theForm.foption[0].focus;
      lb_return = false;
      }
 
   if ( theForm.byear.value == "" )
      {
      alert( "You must enter your birth year!" );
      theForm.byear.focus();
      lb_return = false;
      }
   else
      if ( isNaN( parseInt( theForm.byear.value, 10 )) )
         {
         alert( "The birth year must be numeric!" );
         theForm.byear.focus();
         lb_return = false;
         }

   if ( theForm.bmonth.value == "" )
      {
      alert( "You must enter your birth month!" );
      theForm.bmonth.focus();
      lb_return = false;
      }
   else
      if ( isNaN( parseInt( theForm.bmonth.value, 10 )) )
         {
         alert( "The birth month must be numeric!" );
         theForm.bmonth.focus();
         lb_return = false;
         }
      else
         if ( (( parseInt( theForm.bmonth.value, 10 )) > 0 ) &&
              (( parseInt( theForm.bmonth.value, 10 )) < 13 ))
            {}
         else
            {
            alert( "The birth month must be a number between 1 and 12!!" );
            theForm.bmonth.focus();
            lb_return = false;
            }

   if ( theForm.state.value == "" )
      {
      alert( "You must enter your home state!" );
      theForm.state.focus();
      lb_return = false;
      }

   if ( theForm.country.value == "" )
      {
      alert( "You must enter your home country!" );
      theForm.country.focus();
      lb_return = false;
      }
   else
      if ( theForm.country.value == "usa" )
         {
         if ( theForm.state.value == "xx" || 
              theForm.state.value == "ab" ||
              theForm.state.value == "bc" ||
              theForm.state.value == "sk" ||
              theForm.state.value == "mb" ||
              theForm.state.value == "nb" ||
              theForm.state.value == "ns" ||
              theForm.state.value == "pe" ||
              theForm.state.value == "nf" ||
              theForm.state.value == "on" ||
              theForm.state.value == "pq" )
            {
            alert( "You selected a state not in the USA!" );
            theForm.state.focus();
            lb_return = false;
            }
         }
      else
         if ( theForm.country.value == "can" )
            if ( theForm.state.value != "ab" &&
                 theForm.state.value != "bc" &&
                 theForm.state.value != "sk" &&
                 theForm.state.value != "mb" &&
                 theForm.state.value != "nb" &&
                 theForm.state.value != "ns" &&
                 theForm.state.value != "pe" &&
                 theForm.state.value != "nf" &&
                 theForm.state.value != "on" &&
                 theForm.state.value != "pq" )
               {
               alert( "You entered a province which is not is Canada!" );
               theForm.state.focus();
               lb_return = false;
                }

   if ( theForm.email.value == "" )
      {
      alert( "You must enter your email address!" );
      theForm.email.focus();
      lb_return = false;
      }

   if ( theForm.fname.value == "" )
      {
      alert( "You must enter your first name!" );
      theForm.fname.focus();
      lb_return = false;
      }

   if ( theForm.lname.value == "" )
      {
      alert( "You must enter your last name!" );
      theForm.lname.focus();
      lb_return = false;
      }

   if ( theForm.currenthub.value == "999" )
      {
      alert( "You must select your current hub!" );
      theForm.currenthub.focus();
      lb_return = false;
      }

   if ( theForm.pilotid.value == "" )
      {
      alert( "You must enter your pilot id!" );
      theForm.pilotid.focus();
      lb_return = false;
      }
   else
      if ( isNaN( parseInt( theForm.pilotid.value, 10 )) )
         {
         alert( "Your pilot id must be numeric!" );
         theForm.pilotid.focus();
         lb_return = false;
         }

   return lb_return;   
}

// -->
