<!--
var err;

function checkBlank(form)
{
   err = true;  

   if (form == 1)
   {
      o = document.assay_request_form;

      if (o.sample_location[0].checked)
      {
         if (o.sample_pickup.value == '')
         {
            error('You must specify a location for your samples to be picked up.');
            o.sample_pickup.focus();
         }
      }  
      else if (o.sample_location[1].checked)
      {
         if (o.transport.value == '')
         {
            error('You must specify the transport company handling your samples.');
            o.transport.focus();
         }
         else if (o.con_note.value == '')
         {
            error('You must specify a consignment note number for your samples.');
            o.con_note.focus();
         }
      }

      if (!err) return err;

      if (o.textfield01f.value == '' && o.userfile.value == '')
      {
         error('You must either specify at least one range of sample number strings or upload a prepared file.');
         o.textfield01f.focus();
      }
      else if (o.textfield01t.value == '' && o.userfile.value == '')
      {
         tmperr = 'You must specify at least one range of sample number strings or upload a prepared file.\n'
                + '(If you are submitting only one sample, the start number and end number of the range\n'
                + '   will be the number of that sample.)';
         error(tmperr);
         o.textfield01t.focus();
      }

      if (!err) return err;

      if (o.Analysis.value == '')
      {
         error('You must give more information about the type of analysis required.');
         o.Analysis.focus();
      }

      else if (o.samplenumbers.value == '')
      {
         error('You must specify the number of samples.');
         o.samplenumbers.focus();
      }

      else if ((o.deternumber.value == '') || (+o.deternumber.value < +o.samplenumbers.value))
      {
         tmperr = 'You must specify the total number of determinations.\n'
                + '(For example, if you want two determinations done on each of one hundred samples,\n'
                + '   the total number of determinations is 200.)';
         error(tmperr);
         o.deternumber.focus();
      }

      else if (!((o.diamondsplit.checked) || (o.ironstone.checked) || (o.diamondspot.checked) || (o.gossan.checked) || (o.rcpercussion.checked) || (o.rockchip.checked) || (o.rab.checked) || (o.vegetation.checked) || (o.auger.checked) || (o.water.checked) || (o.typother.checked)))
      {
         error('Please indicate a sample type.');
         window.location.href = '#stype';
         o.diamondsplit.focus();
      }

      else if (  (o.typother.checked) && ((o.typspec.value.length) < 1)   )
      {
         error('You have selected \'other\' for the Sample Type.\nPlease specify the sample type in the text box.');
         window.location.href = '#stype';
         o.typspec.focus();
      }


      else if (!((o.finegold.checked) || (o.sulphide.checked) || (o.carbonate.checked) || (o.graphite.checked) || (o.iron.checked) || (o.oxide.checked) || (o.minother.checked)))
      {
         error('Please indicate a sample mineralogy.');
         window.location.href = '#smin';
         o.finegold.focus();
      }

      else if (  (o.minother.checked) && ((o.minspec.value.length) < 1)   )
      {
         error('You have selected \'other\' for the Sample Mineralogy.\nPlease specify the sample mineralogy in the text box.');
         window.location.href = '#smin';
         o.minspec.focus();
      }

/*
      else if (o.crushed == '')
      {
         error('Your sample preparation details are incomplete.');
         o.crushed.focus();
      }

      else if (o.pulverized == '')
      {
         error('Your sample preparation details are incomplete.');
         o.pulverized.focus();
      }
*/
      else if (o.company_name.value == '')
      {
         error('Your identification details are incomplete.');
         o.company_name.focus();
      }

      else if (o.company_address.value == '')
      {
         error('Your identification details are incomplete.');
         o.company_address.focus();
      }

      else if (o.company_number.value == '')
      {
         error('Your identification details are incomplete.');
         o.company_number.focus();
      }

      else if (o.purchase_order.value == '')
      {
         error('Your identification details are incomplete.');
         o.purchase_order.focus();
      }

      else if (o.company_officer.value == '')
      {
         error('Your identification details are incomplete.');
         o.company_officer.focus();
      }

      else if (o.return_to.value == '')
      {
         error('Your details are incomplete.');
         o.return_to.focus();
      }
      

      if (!err) return err;

      if (o.crushed.value != '')
      {
         if (o.store_crushed[0].checked)
         {
            if (o.period_crushed.value == '')
            {
               error('You must give further instructions regarding crushed rejects.');
               o.period_crushed.focus();
            }
         }
         else if (o.store_crushed[1].checked)
         {}
         else
         {
            error('You must give instructions regarding crushed rejects.');
            o.period_crushed.focus();
         }
      }

      if (!err) return err;

      if (o.pulverized.value != '')
      {
         if (o.store_pulverized[0].checked)
         {
            if (o.period_pulverized.value == '')
            {
               error('You must give further instructions regarding pulverized samples.');
               o.period_pulverized.focus();
            }
         }
         else if (o.store_pulverized[1].checked)
         {}
         else
         {
            error('You must give instructions regarding pulverized samples.');
            o.period_pulverized.focus();
         }
      }
      
      if (!(o.haz_fib.checked || o.haz_asb.checked || o.haz_oth.checked || o.haz_mer.checked))
      {
         err = confirm('You have indicated that these samples are non-hazardous.\nAre you sure these samples are not known or suspected\nto contain any hazardous materials?');
      }

      if ((o.haz_asb.checked && o.haz_asb_spec.value=='') || (o.haz_oth.checked && o.haz_oth_spec.value==''))
      {
         error('You have indicated that \'Asbestos\' or \'Other\' hazardous materials may be present.\nPlease specify further mineral information in the text box provided.');
         window.location.href = '#haz';
         if(o.haz_asb.checked && o.haz_asb_spec.value=='')
             o.haz_asb_spec.focus();
         else if(o.haz_oth.checked && o.haz_oth_spec.value=='')
             o.haz_oth_spec.focus();
      }

      if (!err) return err;

      o.validated.value = "true";

      err = (err && window.confirm('Are you sure you have entered all details correctly?'));

   }

   if(!o.typother.checked)
      o.typspec.value = '';
   if(!o.minother.checked)
      o.minspec.value = '';
   if(!o.haz_asb.checked)
      o.haz_asb_spec.value = '';
   if(!o.haz_oth.checked)
      o.haz_oth_spec.value = '';

   if (err)
	{
	   document.assay_request_form.submit();
		location.href = "assay_request.php";
   }
}

function error(txt)
{
   err = false;
   window.alert(txt);
}
//-->
