function valbutton(thisform) {
// place any other field validations that you require here

// name
if ((thisform.name.value.length == 0) ||
    (thisform.name.value == null)) {
		alert("Please enter your name.");
		thisform.name.focus();
		return false;
}

// phone
if (((thisform.phone_home.value.length == 0) || 
	 (thisform.phone_home.value == null)) &&
	((thisform.phone_work.value.length == 0) || 
	 (thisform.phone_work.value == null)) &&
	((thisform.phone_cell.value.length == 0) || 
	 (thisform.phone_cell.value == null))) {
		alert("Please provide us with at least one telephone number.");
		thisform.phoneh.focus();
		return false;
}
  
validformat=/^\(\d{3}\) \d{3}\-\d{4}$/;

if ((thisform.phone_home.value.length != 0) && 
	(!validformat.test(phone_home.value))) {
		alert("Invalid home phone number format. Please correct and submit again.")
		thisform.phone_home.focus();
    	return false;
}

if ((thisform.phone_work.value.length != 0) && 
	(!validformat.test(phone_work.value))) {
		alert("Invalid work phone number format. Please correct and submit again.")
		thisform.phone_work.focus();
    	return false;
}

if ((thisform.phone_cell.value.length != 0) && 
	(!validformat.test(phone_cell.value))) {
		alert("Invalid cell phone number format. Please correct and submit again.")
		thisform.phone_cell.focus();
    	return false;
}
  
// streetaddress
if ((thisform.streetaddress.value.length == 0) ||
  (thisform.streetaddress.value == null)) {
    alert("Please enter your street address.");
    thisform.streetaddress.focus();
    return false;
  }

// city
if ((thisform.city.value.length == 0) ||
  (thisform.city.value == null)) {
    alert("Please enter your city.");
    thisform.city.focus();
    return false;
  }

// state
if ((thisform.state.value.length == 0) ||
  (thisform.state.value == null)) {
    alert("Please enter your state.");
    thisform.state.focus();
    return false;
  }

// zip
if ((thisform.zip.value.length == 0) ||
    (thisform.zip.value == null)) {
    alert("Please enter your ZIP code.");
    thisform.zip.focus();
    return false;
  }
  
// services_sought
if ((thisform.services_sought_1.checked == false) &&
   (thisform.services_sought_2.checked == false) &&
   (thisform.services_sought_3.checked == false) &&
   (thisform.services_sought_4.checked == false) &&
   (thisform.services_sought_5.checked == false) &&
   (thisform.services_sought_6.checked == false) &&
   (thisform.services_sought_7.checked == false) &&
   (thisform.services_sought_8.checked == false) &&
   (thisform.services_sought_9.checked == false) &&
   (thisform.services_sought_10.checked == false)) {
    alert("Please indicate the service(s) being sought..");
    thisform.services_sought_1.focus();
    return false;
  }
  
// seeking_assessment_other
if ((thisform.services_sought_10.checked == true &&
	thisform.seeking_assessment_other.value.length == 0) ||
   (thisform.services_sought_10.checked == true &&
	thisform.seeking_assessment_other.value == null)) {
        alert("Please enter the kind of assessment you are seeking.");
        thisform.seeking_assessment_other.focus();
        return false;
}
 
// insurance_status
if ((thisform.insurance_status_1.checked == false) &&
  (thisform.insurance_status_2.checked == false) &&
  (thisform.insurance_status_3.checked == false) &&
  (thisform.insurance_status_4.checked == false) &&
  (thisform.insurance_status_5.checked == false)) {
    alert("Please enter your insurance status.");
    thisform.insurance_status_1.focus();
    return false;
  }

// combat_veteran
radiobutton_combat_veteran = -1;
for (i=0; i<thisform.combat_veteran.length; i++) {
if (thisform.combat_veteran[i].checked) {
	radiobutton_combat_veteran = i;
}}

if (radiobutton_combat_veteran == -1) {
	alert("Please tell us whether or not you are a combat veteran.");
	thisform.combat_veteran[0].focus();
	return false;
}

// militaryhistory
if ((thisform.militaryhistory_1.checked == false) &&
   (thisform.militaryhistory_2.checked == false) &&
   (thisform.militaryhistory_3.checked == false) &&
   (thisform.militaryhistory_4.checked == false) &&
   (thisform.militaryhistory_5.checked == false)) {
    alert("Please enter your military history.");
    thisform.militaryhistory_1.focus();
    return false;
  }

// branchofservice
if ((thisform.branchofservice_1.checked == false) &&
   (thisform.branchofservice_2.checked == false) &&
   (thisform.branchofservice_3.checked == false) &&
   (thisform.branchofservice_4.checked == false) &&
   (thisform.branchofservice_5.checked == false) &&
   (thisform.branchofservice_6.checked == false)) {
    alert("Please enter the branch of service.");
    thisform.branchofservice_1.focus();
    return false;
  }

// date_of_birth
if ((thisform.date_of_birth.value.length == 0) ||
  (thisform.date_of_birth.value == null)) {
    alert("Please enter your date of birth.");
    thisform.date_of_birth.focus();
    return false;
  }
  
validformat=/^\d{2}\/\d{2}\/\d{4}$/
if (!validformat.test(date_of_birth.value)) {
	alert("Invalid date format. Please correct and submit again.")
	thisform.date_of_birth.focus();
    return false;

}

// age
if ((thisform.age.value.length == 0) ||
  (thisform.age.value == null)) {
    alert("Please enter your age.");
    thisform.age.focus();
    return false;
  }

// gender
if ((thisform.gender.value.length == 0) ||
  (thisform.gender.value == null)) {
    alert("Please enter your gender.");
    thisform.gender.focus();
    return false;
  }

// sexual_orientation
if ((thisform.sexual_orientation.value.length == 0) ||
  (thisform.sexual_orientation.value == null)) {
    alert("Please enter your sexual orientation.");
    thisform.sexual_orientation.focus();
    return false;
  }

// ethnicity
if ((thisform.ethnicity.value.length == 0) ||
  (thisform.ethnicity.value == null)) {
    alert("Please enter your ethnicity.");
    thisform.ethnicity.focus();
    return false;
  }

// marital_status
if ((thisform.marital_status.value.length == 0) ||
  (thisform.marital_status.value == null)) {
    alert("Please enter your marital status.");
    thisform.marital_status.focus();
    return false;
  }
  
// with_whom_do_you_live
if ((thisform.with_whom_do_you_live.value.length == 0) ||
  (thisform.with_whom_do_you_live.value == null)) {
    alert("Please tell us whom you live with or indicate that you live alone.");
    thisform.with_whom_do_you_live.focus();
    return false;
  }

// work_status
radiobutton_work_status = -1;
for (i=0; i<thisform.work_status.length; i++) {
if (thisform.work_status[i].checked) {
	radiobutton_work_status = i;
}}

if (radiobutton_work_status == -1) {
	alert("Please indicate your work status.");
	thisform.work_status[0].focus();
	return false;
}

// work_status_other
if ((radiobutton_work_status == 5) &&
	(thisform.work_status_other.value.length == 0)) {
        alert("Please tell us what your work status is.");
        thisform.work_status_other.focus();
        return false;
}

// occupation
if ((thisform.occupation.value.length == 0) ||
  (thisform.occupation.value == null)) {
    alert("Please enter your occupation.");
    thisform.occupation.focus();
    return false;
  }
  
// income
if ((thisform.income.value.length == 0) ||
  (thisform.income.value == null)) {
    alert("Please enter your income.");
    thisform.income.focus();
    return false;
  }
  
validformat=/^\d+$/
if (!validformat.test(income.value)) {
	alert("Invalid income format. Please enter numbers only, with no commas or spaces.")
	thisform.income.focus();
    return false;

}

// medical_problems
radiobutton_medical_problems = -1;
for (i=0; i<thisform.medical_problems.length; i++) {
if (thisform.medical_problems[i].checked) {
	radiobutton_medical_problems = i;
}}

if (radiobutton_medical_problems == -1) {
	alert("Please tell us whether or not you have any medical or physical problems.");
	thisform.medical_problems[0].focus();
	return false;
}

// medical_problem_description
if (radiobutton_medical_problems == 0 &&
	(thisform.medical_problem_description.value.length == 0) ||
    (thisform.medical_problem_description.value == null)) {
    alert("Please describe your medical problem(s).");
    thisform.medical_problem_description.focus();
    return false;
  }

// medication
radiobutton_medication = -1;
for (i=0; i<thisform.medication.length; i++) {
if (thisform.medication[i].checked) {
	radiobutton_medication = i;
}}

if (radiobutton_medication == -1) {
	alert("Please indicate whether or not you are on any medication.");
	thisform.medication[0].focus();
	return false;
}

// medication_description
if (radiobutton_medication == 0 &&
	(thisform.medication_description.value.length == 0) ||
    (thisform.medication_description.value == null)) {
    alert("Please describe your medication types and dosages.");
    thisform.medication_description.focus();
    return false;
  }
  
// experience
if ((thisform.feelings_1.checked == false) &&
   (thisform.feelings_2.checked == false) &&
   (thisform.feelings_3.checked == false) &&
   (thisform.feelings_4.checked == false) &&
   (thisform.feelings_5.checked == false) &&
   (thisform.feelings_6.checked == false) &&
   (thisform.feelings_7.checked == false) &&
   (thisform.feelings_8.checked == false) &&
   (thisform.feelings_9.checked == false) &&
   (thisform.feelings_10.checked == false) &&
   (thisform.feelings_11.checked == false) &&
   (thisform.feelings_12.checked == false) &&
   (thisform.feelings_13.checked == false)) {
    alert("Please indicate the thoughts and feelings you are experiencing or check 'Not applicable'.");
    thisform.feelings_1.focus();
    return false;
  }

// experience_other
if ((thisform.feelings_12.checked == true) &&
	((thisform.feelings_other.value.length == 0) ||
	  (thisform.feelings_other.value == null))) {
        alert("Please describe the thoughts and or feelings you are experiencing.");
        thisform.feelings_other.focus();
        return false;
}

// feelings_length
if (((thisform.feelings_1.checked == true) ||
   (thisform.feelings_2.checked == true) ||
   (thisform.feelings_3.checked == true) ||
   (thisform.feelings_4.checked == true) ||
   (thisform.feelings_5.checked == true) ||
   (thisform.feelings_6.checked == true) ||
   (thisform.feelings_7.checked == true) ||
   (thisform.feelings_8.checked == true) ||
   (thisform.feelings_9.checked == true) ||
   (thisform.feelings_10.checked == true) ||
   (thisform.feelings_11.checked == true) ||
   (thisform.feelings_12.checked == true)) &&
	((thisform.feelings__length.value.length == 0) ||
	  (thisform.feelings__length.value == null))) {
        alert("Please tell us how long you have been feeling this way.");
        thisform.feelings__length.focus();
        return false;
}

// problem_description
if ((thisform.problem_description.value.length == 0) ||
    (thisform.problem_description.value == null)) {
    alert("Please describe the problem(s) you are experiencing.");
    thisform.problem_description.focus();
    return false;
  }
  
// felt_this_way_in_the_past
radiobutton_felt_this_way_in_the_past = -1;
for (i=0; i<thisform.felt_this_way_in_the_past.length; i++) {
if (thisform.felt_this_way_in_the_past[i].checked) {
	radiobutton_felt_this_way_in_the_past = i;
}}

if (radiobutton_felt_this_way_in_the_past == -1) {
	alert("Please tell us if you have felt this way in the past.");
	thisform.felt_this_way_in_the_past[0].focus();
	return false;
}

// felt_this_way_in_the_past_description
if (radiobutton_felt_this_way_in_the_past == 0 &&
	(thisform.felt_this_way_in_the_past_description.value.length == 0) ||
    (thisform.felt_this_way_in_the_past_description.value == null)) {
    alert("Please describe why you have felt this way in the past.");
    thisform.felt_this_way_in_the_past_description.focus();
    return false;
  }

// life_changes
if (((thisform.feelings_1.checked == true) ||
   (thisform.feelings_2.checked == true) ||
   (thisform.feelings_3.checked == true) ||
   (thisform.feelings_4.checked == true) ||
   (thisform.feelings_5.checked == true) ||
   (thisform.feelings_6.checked == true) ||
   (thisform.feelings_7.checked == true) ||
   (thisform.feelings_8.checked == true) ||
   (thisform.feelings_9.checked == true) ||
   (thisform.feelings_10.checked == true) ||
   (thisform.feelings_11.checked == true) ||
   (thisform.feelings_12.checked == true)) &&
	((thisform.life_changes_0.checked == false) && 
	 (thisform.life_changes_1.checked == false) && 
	 (thisform.life_changes_2.checked == false) && 
	 (thisform.life_changes_3.checked == false))) {
		alert ("Please indicate whether or not anything has happened recently or changed in your life that might be related to the way you are feeling.");
		thisform.life_changes_0.focus();
		return false;
}

// life_changes_other
if ((thisform.life_changes_3.checked == true) &&
	((thisform.life_changes_other.value.length == 0) ||
	  (thisform.life_changes_other.value == null))) {
        alert("Please describe what has changed in your life.");
        thisform.life_changes_other.focus();
        return false;
}

// sleep_changes
radiobutton_sleep_changes = -1;
for (i=0; i<thisform.sleep_changes.length; i++) {
if (thisform.sleep_changes[i].checked) {
	radiobutton_sleep_changes = i;
}}

if (radiobutton_sleep_changes == -1) {
	alert("Please indicate whether or not you have experienced any recent changes in the amount of time you sleep.");
	thisform.sleep_changes[0].focus();
	return false;
}

// eating_changes
radiobutton_eating_changes = -1;
for (i=0; i<thisform.eating_changes.length; i++) {
if (thisform.eating_changes[i].checked) {
	radiobutton_eating_changes = i;
}}

if (radiobutton_eating_changes == -1) {
	alert("Please indicate whether or not you have experienced any recent changes in the amount of food you eat.");
	thisform.eating_changes[0].focus();
	return false;
}

// treatmentprogram
radiobutton_treatmentprogram = -1;
for (i=0; i<thisform.treatmentprogram.length; i++) {
if (thisform.treatmentprogram[i].checked) {
	radiobutton_treatmentprogram = i;
}}

if (radiobutton_treatmentprogram == -1) {
	alert("Please indicate whether or not you have ever been in a treatment program.");
	thisform.treatmentprogram[0].focus();
	return false;
}

// treatmentprogram_description
if (radiobutton_treatmentprogram == 0 &&
	(thisform.treatmentprogram_description.value.length == 0) ||
    (thisform.treatmentprogram_description.value == null)) {
    alert("Please tell us when you were in the treatment program and what for.");
    thisform.treatmentprogram_description.focus();
    return false;
  }

// hospitalized
radiobutton_hospitalized = -1;
for (i=0; i<thisform.hospitalized.length; i++) {
if (thisform.hospitalized[i].checked) {
	radiobutton_hospitalized = i;
}}

if (radiobutton_hospitalized == -1) {
	alert("Please indicate whether or not you have ever been hospitalized for psychological reasons.");
	thisform.hospitalized[0].focus();
	return false;
}

// hospitalization_description
if (radiobutton_hospitalized == 0 &&
	(thisform.hospitalization_description.value.length == 0) ||
    (thisform.hospitalization_description.value == null)) {
    alert("Please tell us when and why you were hospitalized.");
    thisform.hospitalization_description.focus();
    return false;
  }

// medications_for_depression
radiobutton_medications_for_depression = -1;
for (i=0; i<thisform.medications_for_depression.length; i++) {
if (thisform.medications_for_depression[i].checked) {
	radiobutton_medications_for_depression = i;
}}

if (radiobutton_medications_for_depression == -1) {
	alert("Please indicate whether or not you are currently taking medications.");
	thisform.medications_for_depression[0].focus();
	return false;
}

// medications_for_depression_description
if (radiobutton_medications_for_depression == 0 &&
	(thisform.medications_for_depression_description.value.length == 0) ||
    (thisform.medications_for_depression_description.value == null)) {
    alert("Please list the current medications you are taking for anxiety, depression, ADHD, etc.");
    thisform.medications_for_depression_description.focus();
    return false;
  }

// crime
radiobutton_crime = -1;
for (i=0; i<thisform.crime.length; i++) {
if (thisform.crime[i].checked) {
	radiobutton_crime = i;
}}

if (radiobutton_crime == -1) {
	alert("Please specify whether or not you have ever been convicted of a crime.");
	thisform.crime[0].focus();
	return false;
}

// medications_for_depression_description
if (radiobutton_crime == 0 &&
	(thisform.crime_description.value.length == 0) ||
    (thisform.crime_description.value == null)) {
    alert("Please explain the conviction.");
    thisform.crime_description.focus();
    return false;
  }

// drinks
radiobutton_drinks_per_week = -1;
for (i=0; i<thisform.drinks_per_week.length; i++) {
if (thisform.drinks_per_week[i].checked) {
	radiobutton_drinks_per_week = i;
}}

if (radiobutton_drinks_per_week == -1) {
	alert("Please specify how many drinks you have per week.");
	thisform.drinks_per_week[0].focus();
	return false;
}

// streetdrugs
radiobutton_street_drugs = -1;
for (i=0; i<thisform.streetdrugs.length; i++) {
if (thisform.streetdrugs[i].checked) {
	radiobutton_streetdrugs = i;
}
}
if (radiobutton_street_drugs == -1) {
	alert("Please specify whether or not you use drugs.");
	thisform.streetdrugs[0].focus();
	return false;
}

// fights
radiobutton_fights = -1;
for (i=0; i<thisform.fights.length; i++) {
if (thisform.fights[i].checked) {
	radiobutton_fights = i;
}}

if (radiobutton_fights == -1) {
	alert("Please specify whether or not you are involved in physical fights.");
	thisform.fights[0].focus();
	return false;
}

// legalsystem
radiobutton_legal_system = -1;
for (i=0; i<thisform.legal_system.length; i++) {
if (thisform.legal_system[i].checked) {
	radiobutton_legal_system = i;
}}

if (radiobutton_legal_system == -1) {
	alert("Please specify whether or not you are involved in the legal system.");
	thisform.legal_system[0].focus();
	return false;
}

// childprotection
radiobutton_child_protection = -1;
for (i=0; i<thisform.child_protection.length; i++) {
if (thisform.child_protection[i].checked) {
	radiobutton_child_protection = i;
}}

if (radiobutton_child_protection == -1) {
	alert("Please specify whether or not you are involved with Child Protective Services.");
	thisform.childp_rotection[0].focus();
	return false;
}

// custody_loss
radiobutton_custody_loss = -1;
for (i=0; i<thisform.custody_loss.length; i++) {
if (thisform.custody_loss[i].checked) {
	radiobutton_custody_loss = i;
}}

if (radiobutton_custody_loss == -1) {
	alert("Please specify whether or not you have ever lost custody of your children.");
	thisform.custody_loss[0].focus();
	return false;
}

thisform.submit(); // this line submits the form after validation
}

