

    function validateAndSubmit(form) {


       if (! testRadio(form,'question1_answerId1')){
            if (! testRadio(form,'question1_answerId3')){
              if (! testRadio(form,'question1_answerId4')){
                 if (! testRadio(form,'question1_answerId5')){
                    if (! testRadio(form,'question1_answerId6')){
                      if (! testRadio(form,'question1_answerId8')){
                         if (! testRadio(form,'question1_answerId9')){
                             if (! testRadio(form,'question1_topicals')){
                                if (! testRadio(form,'question1_sulf')){
                                  if (! testRadio(form,'question1_humira')){
                                     if (! testRadio(form,'question1_trexall')){
                                        alert("Are you taking medication(s) on a regular basis for your psoriatic arthritis is a required field");
                                        focus(form,'question1_answerId1');
                                        return false;
                                     }
                                  }
                                }
                             }
                         }
                      }
                    }
                 }
              }
            }
        }

        if(!testQuestion1(form)){
           return false;

        }
        //end medications check

        if (! testRadio(form,'question2_answerId')){
            alert("Are you getting the relief you want from your medication is a required field");
            focus(form,'question2_answerId');
            return false;
        }

        if (! testRadio(form,'question3_answerId')){
            alert("Even with your current medication, are you still experiencing painful, stiff, and swollen joints is a required field");
            focus(form,'question3_answerId');
            return false;
        }

        if (! testRadio(form,'increasedSeverity_answerId')){
            alert("Has your joint pain increased in severity since you began your current treatment is a required field");
            focus(form,'increasedSeverity_answerId');
            return false;
        }

        if (! testRadio(form,'increasedNumberOfJoints_answerId')){
            alert("Has the number of joints affected by arthritis pain increased since you began your current treatment is a required field");
            focus(form,'increasedNumberOfJoints_answerId');
            return false;
        }

        if (! testRadio(form,'sausageFingers_answerId')){
            alert('In spite of current therapy, are you experiencing swollen, "sausage" fingers and toes is a required field');
            focus(form,'sausageFingers_answerId');
            return false;
        }

        if (! testRadio(form,'achilles_answerId')){
            alert("Even with your current medication, are you still experiencing painful Achilles tendon is a required field");
            focus(form,'achilles_answerId');
            return false;
        }
        if (! testRadio(form,'question4_answerId')){
            alert("Even with your current medication, are you still experiencing skin lesions with scaly flakes is a required field");
            focus(form,'question4_answerId');
            return false;
        }

        if (! testRadio(form,'question6_answerId')){
            alert("Do your skin and joint symptoms make you feel embarrassed or depressed is a required field");
            focus(form,'question6_answerId');
            return false;
        }

        if (! testRadio(form,'dressing_answerId')){
            alert("Describe the level of pain in dressing yourself is a required field");
            focus(form,'dressing_answerId');
            return false;
        }

        if (! testRadio(form,'cup_answerId')){
            alert("Describe the level of pain in gripping a cup is a required field");
            focus(form,'cup_answerId');
            return false;
        }

        if (! testRadio(form,'shampoo_answerId')){
            alert("Describe the level of pain in shampooing your hair is a required field");
            focus(form,'shampoo_answerId');
            return false;
        }

        if (! testRadio(form,'climbing_answerId')){
            alert("Describe the level of pain in climbing a few stairs is a required field");
            focus(form,'climbing_answerId');
            return false;
        }

        if (! testRadio(form,'bed_answerId')){
            alert("Describe the level of pain in getting in and out of bed is a required field");
            focus(form,'bed_answerId');
            return false;
        }
        return true;
    }

    function testRadio(form, fieldName) {
     isChecked=false;
     for (loop=0;loop < form.length;loop++) {
        var field = form[loop];
        if (field.name == fieldName){
           if (field.checked){
              isChecked=true;
           }
        }
      }
      return isChecked;
  }

  function testQuestion1(form){
       //if none checked then no others should be
        if ( testRadio(form,'question1_answerId1')){
              if ( testRadio(form,'question1_answerId3')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;
              }
              if ( testRadio(form,'question1_answerId4')){
                        alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                        focus(form,'question1_answerId1');
                        return false;
              }
              if ( testRadio(form,'question1_answerId5')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;

              }

              if ( testRadio(form,'question1_answerId6')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;

              }

              if ( testRadio(form,'question1_answerId8')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;

              }

              if ( testRadio(form,'question1_answerId9')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;

              }

              if ( testRadio(form,'question1_answerId4')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;

              }

              if ( testRadio(form,'question1_topicals')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;

              }

              if ( testRadio(form,'question1_sulf')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;

              }

              if ( testRadio(form,'question1_trexall')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;

              }

              if ( testRadio(form,'question1_humira')){
                    alert("Please indicate not taking medication now or select appropriate medication(s). Please correct your answer. ");
                    focus(form,'question1_answerId1');
                    return false;

              }
        }

        return true;
  }


  function testRadio(form, fieldName) {
     isChecked=false;
     for (loop=0;loop < form.length;loop++) {
        var field = form[loop];
        if (field.name == fieldName){
           if (field.checked){
              isChecked=true;
           }
        }
      }
      return isChecked;
  }

  function getValueRadio(form, fieldName) {
     for (loop=0;loop < form.length;loop++) {
        var field = form[loop];
        if (field.name == fieldName){
          if (field.checked){
            return field.value;
          }
        }
      }

  }

  function getValue(form, fieldName) {
     for (loop=0;loop < form.length;loop++) {
        var field = form[loop];
        if (field.name == fieldName){
           return field.value;
        }
      }

  }

  function focus(form, fieldName) {
     for (loop=0;loop < form.length;loop++) {
        var field = form[loop];
        if (field.name == fieldName){
          field.focus();
          return;
        }
      }
      return;
  }

