// Validation script

function browserSensPart(cmdCode) {
  var brString = "";
  if (cmdCode == 1) {
    if (navigator.appVersion.indexOf('MSIE') > 0) { brString = ".all" };
  } else {
    if (navigator.appVersion.indexOf('MSIE') > 0) { brString = ".style" };
  }
  return brString;
}

function validate_field (field) {
    if ((field.value == "") || (field.value == " ")) {
        alert ("Поле необходимо заполнить");
        field.select();
        field.focus();
//        return false;
    } else {
      return true;
    } 
}

function validate_form(theForm) {
    // ContactPhone
    if ((theForm.ContactPhone.value == theForm.ContactPhone.defaultValue) ||
        theForm.ContactPhone.value == "")
    {
        alert ("Не введен контактный телефон");
        theForm.ContactPhone.select();
        theForm.ContactPhone.focus();
        return false;
    }
    // ContactPerson
    if (theForm.ContactPerson.value == "")
    {
        alert ("Не введено Имя контактного лица");
        theForm.ContactPerson.select();
        theForm.ContactPerson.focus();
        return false;
    }
    // ShipPerson
    if (theForm.ShipPerson.value == "")
    {
        alert ("Не введена фамилия лица, кому вручить");
        theForm.ShipPerson.select();
        theForm.ShipPerson.focus();
        return false;
    }
    // ShipAddress
    if (theForm.ShipAddress.value == "")
    {
        alert ("Не введен адрес доставки");
        theForm.ShipAddress.select();
        theForm.ShipAddress.focus();
        return false;
    }
    // ShipPhone
    if ((theForm.ShipPhone.value == theForm.ShipPhone.defaultValue) ||
        (theForm.ShipPhone.value == ""))
    {
//        alert ("Не введен телефон для доставки");
//        theForm.ShipPhone.select();
//        theForm.ShipPhone.focus();
//        return false;
    }
  return true;
}
