function validate_job_entry(entryform)
{
   var tmpstr = '';

   with (entryform.col_date)
      if (value == "")
         {
             alert("You've not entered a collection date.");
             focus();
             return false;
         }
      else
         {
             res = validate_coll_date(value);
             if (res == -1)
                 {
                     alert("The collection date you've entered is in the past.");
                     focus();
                     return false;
                 }
             if (res == -2)
                 {
                     alert("The collection date you've entered is more than two weeks in the future.");
                     focus();
                     return false;
                 }
             if (res == -3)
                 {
                     alert("The collection date you've entered is a weekend. We only collect on weekdays, excluding bank holidays.");
                     focus();
                     return false;
                 }
         }


   with (entryform.del_name)
      if (value == "")
         {
             alert("You've not entered a delivery name.");
             focus();
             return false;
         }

   with (entryform.del_addr1)
      if (value == "")
         {
            alert("You've not entered anything for the first line of the address.");
            focus();
            return false;
         }

   with (entryform.del_addr2)
      if (value == "")
         {
            alert("You've not entered anything for the second line of the address.");
            focus();
            return false;
         }

   with (entryform.del_postcode)
      if (value == "")
         {
            alert("You've not entered a postcode.");
            focus();
            return false;
         }
      else
         {
            switch(postcode_validation(value, entryform.allow_uk_postcodes.value))
               {
               case(-10):
                  alert('The postcode must be in the range BT1 - BT97 for Northern Ireland.\n\nERROR CODE -10');
                  focus();
                  return false;
               break

               case(-20):
                  alert('The postcode must be in the range X1 - X26 for Southern Ireland.\n\nERROR CODE -20');
                  focus();
                  return false;
               break

               case(-30):
                  alert('The postcode must either be in the range BT1 - BT97 for Northern Ireland, X1 - X26 for Southern Ireland or be in the following UK postcode areas\n'
                  + '\n' +
                  'AL\t\tSt Albans\n' +
                  'B\t\tBirmingham\n' +
                  'CV\t\tCoventry\n' +
                  'DE\t\tDerby\n' +
                  'DY\t\tDudley\n' +
                  'HP\t\tHemel Hempstead\n' +
                  'LE\t\tLeicester\n' +
                  'LU\t\tLuton\n' +
                  'MK\t\tMilton Keynes\n' +
                  'NG\t\tNottinghamshire\n' +
                  'NN\t\tNorthamptonshire\n' +
                  'OX\t\tOxfordshire\n' +
                  'SG\t\tStevenage\n' +
                  'ST\t\tStaffordshire\n' +
                  'TF\t\tTelford\n' +
                  'WR\t\tWorcestershire\n' +
                  'WS\t\tWalsall\n' +
                  'WV\t\tWolverhampton\n' +
                  '\n\nERROR CODE -30');

                  focus();
                  return false;
               break

               case(-99):
                  alert('The postcode must either be in the range BT1 - BT97 for Northern Ireland or in the range X1 - X26 for Southern Ireland.\n\nERROR CODE -99');
                  focus();
                  return false;
               break


               default:
                  //alert('Valid postcode');
               break
               }
         }

   with (entryform.col_type_of_item)
      if (value == "-1")
         {
            alert("You've not chosen a consignment type.");
            focus();
            return false;
         }

   with (entryform.col_No_of_items)
      if (value == "")
         {
            alert("You've not entered a quantity.");
            focus();
            return false;
         }
         else if (IsNumeric(value) == false)
                 {
                     alert("The quantity should be a whole number.");
                     focus();
                     return false;
                 }

   with (entryform.col_total_weight)
      if (value == "")
         {
            alert("You've not entered a total weight.");
            focus();
            return false;
         }
         else if (IsNumeric(value) == false)
                 {
                     alert("The total weight should be a whole number.");
                     focus();
                     return false;
                 }

   with (entryform.col_service)
      if (value == "-1")
         {
            alert("You've not chosen a service type.");
            focus();
            return false;
         }

   //if consignment type (col_type_of_item) is 'other', goods description needs to be populated.
   if ((entryform.col_type_of_item.value  == 'other') && (entryform.col_goods_desc.value == ''))
      {
         alert("You've chosen a consignment type of other, but have not entered a goods description.");
         focus();
         return false;
      }

   var UKPostcodeRegxp = /^(TF|ST|DE|NG|WV|WS|WR|LE|DY|B|CV|NN|OX|MK|HP|LU|AL|SG)([0-9]{1,2})([\s]{0,1})([0-9]{0,1})([A-Za-z]{0,2})$/

   //next day service is only available to the X1 postcode
   tmpstr = entryform.del_postcode.value.toLowerCase();
   if ((entryform.col_service.value  == 'A') && (tmpstr.indexOf('bt') == -1) && (tmpstr != 'x1') && !UKPostcodeRegxp.test(tmpstr.toUpperCase()))
      {
         answer = confirm('We cannot normally provide a Next Day service for Southern Ireland for postcodes other than X1 (Dublin area). Please either change the service to Economy or phone Parcels to Ireland on 01788 542 500 to see if we can accommodate your Next Day request.\n\nThen either click OK to continue with the Next Day service, or Cancel to go back and change your selection.');
         if (answer == false)
            {
               entryform.col_service.focus();
               return false;
            }
      }


   disable_button(job_entry_form.button_confirm)
   //disable_button(job_entry_form.button_reset)

   //alert('Details validated');
   return true;
}

function validate_cab_entry(entryform)
{
   with (entryform.cab_name)
      if (value == "")
         {
            alert("You've not entered a delivery name.");
            focus();
            return false;
         }

   with (entryform.cab_addr1)
      if (value == "")
         {
            alert("You've not entered an address line No. 1");
            focus();
            return false;
         }

   with (entryform.cab_addr2)
      if (value == "")
         {
            alert("You've not entered an address line No. 2");
            focus();
            return false;
         }

   with (entryform.cab_postcode)
      if (value == "")
         {
            alert("You've not entered a postcode");
            focus();
            return false;
         }

   //alert('Details validated');
   return true;
}

function validate_news_entry(entryform)
{
   with (entryform.post_subject)
      if (value == "")
         {
            alert("You've not entered a news subject.");
            focus();
            return false;
         }

   with (entryform.post_message)
      if (value == "")
         {
            alert("You've not entered a news message.");
            focus();
            return false;
         }

   with (entryform.post_by)
      if (value == "")
         {
            alert("You've not entered your name.");
            focus();
            return false;
         }

   alert('Details validated');
   return true;
}

function validate_collection(entryform)
  {
    var tmpstr = '';

    with (entryform.bookcollection_date)
      if (value == "")
        {
             alert("You've not entered a collection date.");
             focus();
             return false;
         }
      else
         {
             var res = validate_bookcollection_date(value);
             if (res == -1)
                 {
                     alert("The collection date you've entered is in the past.");
                     focus();
                     return false;
                 }
             if (res == -2)
                 {
                     alert("The collection date you've entered is more than a week in the future.");
                     focus();
                     return false;
                 }
             if (res == -3)
                 {
                     alert("The collection date you've entered is a weekend. We only collect on weekdays, excluding bank holidays.");
                     focus();
                     return false;
                 }
             if (res == -4)
                 {
                     alert("Due to the short notice please call Parcels to Ireland on 01788 542 500 to arrange collection.");
                     focus();
                     return false;
                 }
         }


   with (entryform.bookcollection_time)
      if (value == -1)
         {
             alert("Please choose AM or PM for the collection time.");
             focus();
             return false;
         }

   with (entryform.bookcollection_addr1)
      if (value == "")
         {
            alert("You've not entered anything for the first line of the address.");
            focus();
            return false;
         }

   with (entryform.bookcollection_addr2)
      if (value == "")
         {
            alert("You've not entered anything for the second line of the address.");
            focus();
            return false;
         }

   with (entryform.bookcollection_postcode)
      if (value == "")
         {
            alert("You've not entered a postcode.");
            focus();
            return false;
         }

   with (entryform.bookcollection_hazardous)
      if (value == "-1")
         {
            alert("Please indicate if the goods to collect are hazardous or not.");
            focus();
            return false;
         }
      else if (value == "y")
        {
          alert("Please fax your DGN's to 01788 550 896.");
        }

    if ((entryform.bookcollection_pallet_qty.value == "") && (entryform.bookcollection_carton_qty.value == "") && (entryform.bookcollection_others_qty.value == ""))
      {
        alert("You've not entered any quantities for pallets, cartons or others. You must enter a quantity for at least one of them.");
        return false;
      }
    else
      {
        if (IsNumeric(entryform.bookcollection_pallet_qty.value) == false)
          {
            alert("The information you've entered in the pallet quantity field is not numeric");
            return false;
          }

        if (IsNumeric(entryform.bookcollection_carton_qty.value) == false)
          {
            alert("The information you've entered in the carton quantity field is not numeric");
            return false;
          }

        if (IsNumeric(entryform.bookcollection_others_qty.value) == false)
          {
            alert("The information you've entered in the others quantity field is not numeric");
            return false;
          }
      }

    if ((entryform.bookcollection_others_qty.value  != "") && (entryform.bookcollection_goods_desc.value == ""))
      {
        alert("You've entered a quantity for Others but have not entered a goods description.");
        return false;
      }

    with (entryform.bookcollection_contact_name)
      if (value == "")
        {
             alert("You've not entered a contact name. In the event there is a problem with your collection request we will need your name and telephone number to get in contact with you.");
             focus();
             return false;
         }

    with (entryform.bookcollection_contact_tel)
      if (value == "")
        {
             alert("You've not entered a contact telephone number. In the event there is a problem with your collection request we will need your name and telephone number to get in contact with you.");
             focus();
             return false;
         }

    return true;
  }