﻿// JScript File
//-------------------------------------------------------------------------------
//Functions to dynamically show/hide sections based on the Profession selected
//Developed By: Prodata, Tom Haney (505)294-1530
//-------------------------------------------------------------------------------
function setupForm()
{
   document.getElementById("Engineer").className="areaOfInterest";
   document.getElementById("PlantManager").className="areaOfInterest";
   document.getElementById("CityOfficial").className="areaOfInterest";
   document.getElementById("Other").className="areaOfInterest";
   document.getElementById("PlantSize").style.height="0px";
   document.getElementById("CommunityIssues").style.height="0px";
   document.getElementById("PlantSize").style.visibility="hidden";
   document.getElementById("CommunityIssues").style.visibility="hidden";
}
//-------------------------------------------------------------------------------
function showSection(id) {
var el;
if (typeof document.getElementById != 'undefined') el = document.getElementById(id);
if (el && el.style) el.style.visibility = 'visible';
}
//-------------------------------------------------------------------------------
function hideSection(id) {
var el;
if (typeof document.getElementById != 'undefined') el = document.getElementById(id);
if (el && el.style) el.style.visibility = 'hidden';
}
//-------------------------------------------------------------------------------
function expandSection(id,height) {
         var el;
         if (typeof document.getElementById != 'undefined') el = document.getElementById(id);
         if (el && el.style) el.style.height = String(height)+"px";
         if (el && el.style) el.style.visibility = "visible";
}
//-------------------------------------------------------------------------------
function collapseSection(id) {
         var el;
         if (typeof document.getElementById != 'undefined') el = document.getElementById(id);
         if (el && el.style) el.style.height = '0px';
         if (el && el.style) el.style.visibility = "hidden";
}
//-------------------------------------------------------------------------------
function setEmailAddress(colorCode) {
    //"/cgi-bin/gen-form?[Email to]+success-url=thanks.html+Data+Sheet+Submission"
    switch(colorCode)
      {
        case "purple":
          document.myEmail.action="/cgi-bin/gen-form?sales@ifenton.com,ksummers@orbusinternational.com+success-url=thanks.htm+Data+Sheet+Submission";
          break
        case "green":
          document.myEmail.action="/cgi-bin/gen-form?sales@ifenton.com,info@orbusinternational.com+success-url=thanks.htm+Data+Sheet+Submission";
          break
        case "orange":
          document.myEmail.action="/cgi-bin/gen-form?sales@ifenton.com,ksummers@orbusinternational.com+success-url=thanks.htm+Data+Sheet+Submission";
          break
        case "red":
          document.myEmail.action="/cgi-bin/gen-form?evaporators@ifenton.com,sales@ifenton.com,asanchez@ifenton.com+success-url=thanks.htm+Data+Sheet+Submission";
          break
        default:
          document.myEmail.action="/cgi-bin/gen-form?sales@ifenton.com,ksummers@orbusinternational.com+success-url=thanks.htm+Data+Sheet+Submission";
      }
}
//-------------------------------------------------------------------------------
function setupProfession() {
	selectBox = document.getElementById("Profession");
	selectedProfession =  selectBox.options[selectBox.selectedIndex].value;
    collapseSection("PlantSize");
    collapseSection("CommunityIssues");
	switch(selectedProfession)
      {
        case "Engineer or Contractor":
          showSection("Engineer");
          hideSection("PlantManager");
          hideSection("CityOfficial");
          hideSection("Other");
          document.getElementById("areaOfInterestEngineer").selectedIndex=0;
          break    
        case "Plant Manager/Operator":
          hideSection("Engineer");
          showSection("PlantManager");
          hideSection("CityOfficial");
          hideSection("Other");
          document.getElementById("areaOfInterestPlantManager").selectedIndex=0;
          break
        case "City Official/Representative":
          hideSection("Engineer");
          hideSection("PlantManager");
          showSection("CityOfficial");
          hideSection("Other");
          document.getElementById("areaOfInterestCityOfficial").selectedIndex=0;
          break
        case "Other":
          hideSection("Engineer");
          hideSection("PlantManager");
          hideSection("CityOfficial");
          showSection("Other");
          document.getElementById("areaOfInterestOther").selectedIndex=0;
          break
        default:
          hideSection("Engineer");
          hideSection("PlantManager");
          hideSection("CityOfficial");
          hideSection("Other");
          hideSection("PlantSize");
          hideSection("CommunityIssues");
    }
}    
//-------------------------------------------------------------------------------
function setupEngineer() {
	selectBox = document.getElementById("areaOfInterestEngineer");
	selectedAreaOfInterest =  selectBox.options[selectBox.selectedIndex].value;
	switch(selectedAreaOfInterest)
      {
        case "Existing Project":
        case "Future Project":
          expandSection("PlantSize",250);
          expandSection("CommunityIssues",350);
          setEmailAddress("orange");
          break
        case "Researching Class A Methods":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("orange");
          break
        case "May want to add Fenix to our firm's design offerings":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
        case "General interest in technology":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("orange");
          break
        case "Industrial Dryer Application":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
        case "Industrial Evaporators":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("red");
          break
        case "Other":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
       default:
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("blank");
    }
}
//-------------------------------------------------------------------------------
function setupPlantManager() {
	selectBox = document.getElementById("areaOfInterestPlantManager");
	selectedAreaOfInterest =  selectBox.options[selectBox.selectedIndex].value;
	switch(selectedAreaOfInterest)
      {
        case "Looking at several Class A options for our facility":
        case "Interested in adding a dryer to existing plant":
        case "Interested in including a dryer in major plant construction project":
        case "Researching system selected by engineers":
          expandSection("PlantSize",250);
          expandSection("CommunityIssues",350);
          setEmailAddress("green");
          break
        case "Industrial Dryer Application":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
        case "Industrial Evaporators":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("red");
          break
        case "Other":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
       default:
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
    }
}
//-------------------------------------------------------------------------------
function setupCityOfficial() {
	selectBox = document.getElementById("areaOfInterestCityOfficial");
	selectedAreaOfInterest =  selectBox.options[selectBox.selectedIndex].value;
	switch(selectedAreaOfInterest)
      {
        case "Part of a selections committee for wastewater system upgrades":
        case "Looking at several Class A methods for my community":
        case "Interested in adding a dryer to existing plant without major construction":
        case "Interested in including a dryer in major plant construction project":
        case "Interested in including a dryer in a new plant":
          expandSection("PlantSize",250);
          expandSection("CommunityIssues",350);
          setEmailAddress("green");
          break
        case "Responding to public inquiries about biosolids":
          collapseSection("PlantSize");
          expandSection("CommunityIssues",350);
          setEmailAddress("green");
          break
        case "Involved in regulatory standards and compliance":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("orange");
          break
        case "Other":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
       default:
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("blank");
    }
}
//-------------------------------------------------------------------------------
function setupOther() {
	selectBox = document.getElementById("areaOfInterestOther");
	selectedAreaOfInterest =  selectBox.options[selectBox.selectedIndex].value;
	switch(selectedAreaOfInterest)
      {
        case "Member of the public concenred about sludge problems":
          collapseSection("PlantSize",250);
          expandSection("CommunityIssues",350);
          setEmailAddress("green");
          break
        case "Farmer or other land steward interested in biosolids use":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
        case "Regulatory official interested in compliance issues":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("orange");
          break
        case "Interested in custom fabrication":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("purple");
          break
        case "Interested in evaporators":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("red");
          break 
        case "Member of media":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
        case "Involved in manufacturer's rep opportunities":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
        case "Manufacturer interested in partnership/sourcing":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("red");
          break
        case "Other":
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("green");
          break
       default:
          collapseSection("PlantSize");
          collapseSection("CommunityIssues");
          setEmailAddress("blank");
    }
}

