<!-- Hide from older browsers

function AddZipCodeDash() {
  var thisForm = document.application;
  var lastFour = thisForm.zipLastFour.value;
  if(lastFour.length == 4) {
	lastFour = "-" + lastFour;
	thisForm.zipLastFour.value = lastFour;
  }
  else {
	thisForm.zipLastFour.value = "";
  }
}

function OwnHome(own) {
  var thisForm = document.application;
  if(own) {
    for (i=0;i<thisForm.landlordAgreeable.length;i++) {
	thisForm.landlordAgreeable[i].disabled=true;
	}
    for (i=0;i<thisForm.supplyRentersPolicy.length;i++) {
	thisForm.supplyRentersPolicy[i].disabled=true;
	}
  }
  else {
    for (i=0;i<thisForm.landlordAgreeable.length;i++) {
	thisForm.landlordAgreeable[i].disabled=false;
	}
    for (i=0;i<thisForm.supplyRentersPolicy.length;i++) {
	thisForm.supplyRentersPolicy[i].disabled=false;
	}
  }
}

function HasFence(fence) {
  var thisForm = document.application;
  if(fence) {
    for (i=0;i<thisForm.padlockGates.length;i++) {
	thisForm.padlockGates[i].disabled=false;
	}
    thisForm.fenceType.disabled=false;
  }
  else {
    for (i=0;i<thisForm.padlockGates.length;i++) {
	thisForm.padlockGates[i].disabled=true;
	}
    thisForm.fenceType.disabled=true;
  }
}

function NumberOfAdults() {
  var thisForm = document.application;
  var noa = thisForm.numberOfAdults;
  var names = [thisForm.nameAdult2, thisForm.nameAdult3, thisForm.nameAdult4];
  var ages = [thisForm.ageAdult2, thisForm.ageAdult3, thisForm.ageAdult4];
  var occupations = [thisForm.occupationAdult2, thisForm.occupationAdult3, thisForm.occupationAdult4];
  var employmentTimes = [thisForm.employmentTimeAdult2, thisForm.employmentTimeAdult3, thisForm.employmentTimeAdult4];
  // Reset all fields in case this is the users second pass through
  for (i = 0;i < 3;i++) {
	names[i].disabled=false;
	ages[i].disabled=false;
	occupations[i].disabled=false;
	employmentTimes[i].disabled=false;
  }
  if (noa.selectedIndex > 0 && noa.selectedIndex < 4) { //check for between 1 and 3 number of adults selected
	// Disable input boxes for adults above number selected
    for (i=(noa.selectedIndex + 1);i<noa.length;i++) {
	  names[i-2].disabled=true;
	  ages[i-2].disabled=true;
	  occupations[i-2].disabled=true;
	  employmentTimes[i-2].disabled=true;
	}
  }
}

function AnyChildren(child) {
  var thisForm = document.application;
  if(child) {
	thisForm.numberOfChildren.disabled=false;
	thisForm.agesOfChildren.disabled=false;
  }
  else {
	thisForm.numberOfChildren.disabled=true;
	thisForm.agesOfChildren.disabled=true;
  }
}

function AnyOthers(other) {
  var thisForm = document.application;
  if(other) {
	thisForm.interactionsWithOthers.disabled=false;
  }
  else {
	thisForm.interactionsWithOthers.disabled=true;
  }
}

function PreviousDogs() {
  var thisForm = document.application;
  var ownedDog = thisForm.ownedDog;
  var dogName = [thisForm.dogName1, thisForm.dogName2, thisForm.dogName3, thisForm.dogName4];
  var dogBreed = [thisForm.dogBreed1, thisForm.dogBreed2, thisForm.dogBreed3, thisForm.dogBreed4];
  var dogOwnLength = [thisForm.dogOwnLength1, thisForm.dogOwnLength2, thisForm.dogOwnLength3, thisForm.dogOwnLength4];
  var dogWhatHappened = [thisForm.dogWhatHappened1, thisForm.dogWhatHappened2, thisForm.dogWhatHappened3, thisForm.dogWhatHappened4];
  if (ownedDog.selectedIndex == 1 ) { //If no dogs previously owned disable dog fields.
    for (i = 0; i < 4; i++) {
	  dogName[i].disabled=true;
	  dogBreed[i].disabled=true;
	  dogOwnLength[i].disabled=true;
	  dogWhatHappened[i].disabled=true;
	}
    thisForm.dogActivities.disabled=true;
	thisForm.trainingMethod.disabled=true;
	for (i = 0; i < 2; i++) {
	  thisForm.heartwormPrevention[i].disabled=true;
      thisForm.contactVet[i].disabled=true;
	}
    thisForm.contactVet.disabled=true;
    thisForm.vetName.disabled=true;
    thisForm.vetAddress.disabled=true;
    thisForm.vetCityStateZip.disabled=true;
    thisForm.vetPhone.disabled=true;
  }
  else {
  // Reset form fields if this is users second pass through
    for (i = 0; i < 4; i++) {
	  dogName[i].disabled=false;
	  dogBreed[i].disabled=false;
	  dogOwnLength[i].disabled=false;
	  dogWhatHappened[i].disabled=false;
    }
    thisForm.dogActivities.disabled=false;
	thisForm.trainingMethod.disabled=false;
	for (i = 0; i < 2; i++) {
	  thisForm.heartwormPrevention[i].disabled=false;
      thisForm.contactVet[i].disabled=false;
	}
    thisForm.contactVet.disabled=false;
    thisForm.vetName.disabled=false;
    thisForm.vetAddress.disabled=false;
    thisForm.vetCityStateZip.disabled=false;
    thisForm.vetPhone.disabled=false;
  }
}

function GenderPreference(preference) {
  var thisForm = document.application;
  if (preference) {
    thisForm.genderPreferenceReason.disabled=false;
  }
  else {
    thisForm.genderPreferenceReason.disabled=true;
  }
}

function PreferredAge(prefer) {
  var thisForm = document.application;
  if (prefer || (!prefer && !thisForm.preferredAge[0].status)) {
    thisForm.ageReason.disabled=false;
  }
  else {
    thisForm.ageReason.disabled=true;
  }
}

function PreviousAdopt(previous) {
  var thisForm = document.application;
  if (previous) {
    thisForm.previousRescueGroup.disabled=false;
  }
  else {
    thisForm.previousRescueGroup.disabled=true;
  }
}

function HouseBreak(will) {
  var thisForm = document.application;
  if (will) {
    thisForm.houseBreakMethod.disabled=false;
  }
  else {
    thisForm.houseBreakMethod.disabled=true;
  }
}

function DateToday() {
  var Today=new Date();
  var ThisDay=Today.getDate();
  var ThisMonth=Today.getMonth()+1;
  var ThisYear=Today.getFullYear();
  return ThisMonth+"/"+ThisDay+"/"+ThisYear;
}

function StartForm() {
  var thisForm = document.application;
  thisForm.Date.value=DateToday();
  thisForm.required_FirstName.focus();
}

function SelectEmailAddress() {
  var thisForm = document.application;
  var question = thisForm.questionType.options[thisForm.questionType.selectedIndex].value;
  switch(question) {
	  case "Adoption":
	  	thisForm.recipient.value = "Adoptions@FLSamoyedRescue.org";
		break;
	  case "Fostering":
	  	thisForm.recipient.value = "FosterHomes@FLSamoyedRescue.org";
		break;
	  case "Surrendering":
	  	thisForm.recipient.value = "Coordinator@FLSamoyedRescue.org";
	    thisForm.alt_recipient.value = "FosterHomes@FLSamoyedRescue.org";
		break;
	  case "Dog in Shelter":
	  	thisForm.recipient.value = "Coordinator@FLSamoyedRescue.org";
	    thisForm.alt_recipient.value = "FosterHomes@FLSamoyedRescue.org";
		break;
	  case "Lost or Found Samoyed":
	  	thisForm.recipient.value = "Coordinator@FLSamoyedRescue.org";
	    thisForm.alt_recipient.value = "FosterHomes@FLSamoyedRescue.org";
		break;
	  case "Volunteering":
	  	thisForm.recipient.value = "Secretary@FLSamoyedRescue.org";
	    thisForm.alt_recipient.value = "FosterHomes@FLSamoyedRescue.org";
		break;
	  case "Website":
	  	thisForm.recipient.value = "support@FLSamoyedRescue.org";
		break;
	  default:
	  	thisForm.recipient.value = "support@FLSamoyedRescue.org";
  }
}

function SendMeACopy() {
  var thisForm = document.application;
  var thisQuestion = thisForm.sendMeACopy.checked;
  if (thisQuestion) {
	  thisForm.copyMe.value = thisForm.required_Email.value;
  }
  else {
	  thisForm.copyMe.value = "";
  }
}

function FillInEmailAddress(type) {
  var thisForm = document.application;
  var formType = type;
  switch (formType) {
	  case "adoption":
	    thisForm.recipient.value = "adoptions@FLSamoyedRescue.org";
		thisForm.alt_recipient.value = "DBAdmin@FLSamoyedRescue.org";
		break;
	  case "foster":
	    thisForm.recipient.value = "FosterHomes@FLSamoyedRescue.org";
		thisForm.alt_recipient.value = "DBAdmin@FLSamoyedRescue.org";
		break;
	  case "volunteer":
	    thisForm.recipient.value = "Secretary@FLSamoyedRescue.org";
	    thisForm.alt_recipient.value = "DBAdmin@FLSamoyedRescue.org";
		break;
	  default:
	    thisForm.recipient.value = "Coordinator@FLSamoyedRescue.org";
	    thisForm.alt_recipient.value = "support@FLSamoyedRescue.org";
  }
}
		
//Stop hiding -->

