function hide(e) {
    document.getElementById(e).style.display = "none"
    document.getElementById(e).style.visibility = "hidden"
}
function show(e) {
    document.getElementById(e).style.display = ""
    document.getElementById(e).style.visibility = ""
}


// Estimate Form
// function: display other text field
function selectReferralDropdown(e) {
    var val = e.value
    if (val == "Other") {
        show('othertxt')
    } else {
        hide('othertxt')
        document.getElementById('txtOther').value = ""
    }
}
// function: to clear text fields (generic)
function setZipCode(e, loc) {
    var val = e.value
    if (loc == "from") {
        //document.getElementById('txtFromZip2').value = val
    } else if (loc == "to") {
        //document.getElementById('txtToZip2').value = val
    }
}

// Application Form
// function: display other referral text field
function selectReferralRadio(e) {
    var val = e.value
    if (val == "Current or Former Employee") {
        show('otherReferral')
        show('spanName')
        hide('spanIndicate')
    } else if (val == "Customer") {
        show('otherReferral')
        show('spanName')
        hide('spanIndicate')
    } else if (val == "Online Publication") {
        show('otherReferral')
        show('spanName')
        hide('spanIndicate')
    } else if (val == "Other") {
        show('otherReferral')
        show('spanIndicate')
        hide('spanName')
    } else {
        hide('otherReferral')
        hide('spanName')
        hide('spanIndicate')
        document.getElementById('txtOtherReferral').value = ""
    }
}
// function: display yes text field
function selectConvictedDropdown(e) {
    var val = e.value
    if (val == "Yes") {
        show('otherConvicted')
    } else {
        hide('otherConvicted')
        document.getElementById('txtConvicted').value = ""
    }
}
// function: display other status text field
function selectStatusRadio(e) {
    var val = e.value
    if (val == "Other") {
        show('otherStatus')
    } else {
        hide('otherStatus')
        document.getElementById('txtOtherStatus').value = ""
    }
}

// Survey Form
// function: display other referral text field
function selectSurveyReferralRadio(e) {
    var val = e.value
    if (val == "Chambers of Commerce") {
        show('otherReferral')
        show('spanCommerce')
        hide('spanAward')
        hide('spanOther')
    } else if (val == "Award") {
        show('otherReferral')
        show('spanAward')
        hide('spanCommerce')
        hide('spanOther')
    } else if (val == "Other") {
        show('otherReferral')
        show('spanOther')
        hide('spanCommerce')
        hide('spanAward')
    } else {
        hide('otherReferral')
        hide('spanCommerce')
        hide('spanAward')
        hide('spanOther')
        document.getElementById('txtOtherReferral').value = ""
    }
}
