function onSubmitButton()
{
  var boardValue = document.getElementById("board").value;
  if (boardValue)
  {
    var dayElement = document.createElement("input");
    var todaysDay = getThisDay().toString();
    dayElement.setAttribute("type", "hidden");
    dayElement.setAttribute("name", "day");
    dayElement.setAttribute("id", "day");
    dayElement.setAttribute("value", todaysDay);
    document.complaint_form.appendChild(dayElement);
    
    var monthElement = document.createElement("input");
    var todaysMonth = getThisMonth().toString();
    monthElement.setAttribute("type", "hidden");
    monthElement.setAttribute("name", "month");
    monthElement.setAttribute("id", "month");
    monthElement.setAttribute("value", todaysMonth);
    document.complaint_form.appendChild(monthElement);

    var yearElement = document.createElement("input");
    var todaysYear = getThisYear().toString();
    yearElement.setAttribute("type", "hidden");
    yearElement.setAttribute("name", "year");
    yearElement.setAttribute("id", "year");
    yearElement.setAttribute("value", todaysYear);
    document.complaint_form.appendChild(yearElement);

    var emailOLRElement = document.createElement("input");
    emailOLRElement.setAttribute("type", "hidden");
    emailOLRElement.setAttribute("name", "emailOLR");
    emailOLRElement.setAttribute("id", "emailOLR");

    switch (boardValue.toString())
    {
      case "Manufactured Housing Professionals" :
      {
        document.complaint_form.action = "https://www.maine.gov/cgi-bin/formproc-v2/mcozart/olr_complaint_mh";
        emailOLRElement.setAttribute("value", "Robert.V.LeClair@maine.gov");
        break;    
      }
      case "Pharmacists" :
      {
        document.complaint_form.action = "https://www.maine.gov/cgi-bin/formproc-v2/mcozart/olr_complaints_ph";
        emailOLRElement.setAttribute("value", "Kelly.L.Mclaughlin@maine.gov");
        break;
      }
      case "Pharmacy Technicians" :
      {
        document.complaint_form.action = "https://www.maine.gov/cgi-bin/formproc-v2/mcozart/olr_complaints_ph";
        emailOLRElement.setAttribute("value", "Kelly.L.Mclaughlin@maine.gov");
        break;    
      }
      case "Real Estate Commission" :
      {
        document.complaint_form.action = "https://www.maine.gov/cgi-bin/formproc-v2/mcozart/olr_complaints";
        emailOLRElement.setAttribute("value", "Karen.L.Bivins@maine.gov");
        break;
      }
      case "Board Unknown" :
      { // This form is for users who aren't sure which board the person they are complaining about belongs
      // to.  This form pushes out their data to all OLR complaint recipients.
       document.complaint_form.action = "https://www.maine.gov/cgi-bin/formproc-v2/mcozart/olr_complaints";
        emailOLRElement.setAttribute("value", "Kelly.L.Mclaughlin@maine.gov, Kaidena.L.Neumann@maine.gov, Karen.L.Bivins@maine.gov, Robert.V.LeClair@maine.gov");
         // add code here to set email to all
        break;
      }
      default:
      {
        document.complaint_form.action = "https://www.maine.gov/cgi-bin/formproc-v2/mcozart/olr_complaints";
        emailOLRElement.setAttribute("value", "Kaidena.L.Neumann@maine.gov");
        break;
      }
    }
    document.complaint_form.appendChild(emailOLRElement);
    document.complaint_form.submit();
  }     
  return true;
}

// This function shows or hides the element sent in.
function showHide()
{
  element = document.getElementById('CREDIT_REPORT');
	if (element.value.checked == true)
	{
		document.getElementById('CREDIT_REPORT').style.display = "block";
	}
	else
	{
		document.getElementById('CREDIT_REPORT').style.display = "none";
	}
  return document;
}


// This function shows or hides the element sent in.
function show_form()
{
  var boardValue = document.getElementById("board").value;
  if (boardValue !== null && boardValue !== "")
  {
	  switch (boardValue.toString())
	  {
			case "Manufactured Housing Professionals" :
			{
				document.getElementById('general_complaint').style.display="none";
				document.getElementById('manufactured_housing_complaint').style.display="block";
				document.getElementById('pharmacy_complaint').style.display="none";
				break;
			}
			case "Pharmacists":
			{
				document.getElementById('general_complaint').style.display="none";
				document.getElementById('manufactured_housing_complaint').style.display="none";
				document.getElementById('pharmacy_complaint').style.display="block";
				break;
			}
			case "Pharmacy Technicians" :
			{
				document.getElementById('general_complaint').style.display="none";
				document.getElementById('manufactured_housing_complaint').style.display="none";
				document.getElementById('pharmacy_complaint').style.display="block";
				break;
			}
			default:
			{
				document.getElementById('general_complaint').style.display="block";
				document.getElementById('manufactured_housing_complaint').style.display="none";
				document.getElementById('pharmacy_complaint').style.display="none";
				break;
			}
	  }
	  return document;
	}
}
