var offArray = ['registrant_howfound_through_an_ams_sales_representative',
                'registrant_howfound_through_ams_product_literature'];

var turnOffArray = ['registrant_referral','registrant_other'];

//'registrant_howfound_referral', 'registrant_howfound_other'

window.onload = function() {
    for (var i = 0; i < offArray.length; i++) {
        thisEl = document.getElementById(offArray[i]);
        if (thisEl) thisEl.onclick = turnOff;
    }

    var refRadio = document.getElementById('registrant_howfound_referral');
    var refInput = document.getElementById('registrant_referral');
    var otherRadio = document.getElementById('registrant_howfound_other');
    var otherInput = document.getElementById('registrant_other');

    if (refRadio) {
        refRadio.onclick = function() {
            refInput.disabled = false;
            refInput.focus();
            otherInput.disabled = true;
        }
    }

    if (otherRadio) {
        otherRadio.onclick = function() {
            otherInput.disabled = false;
            otherInput.focus();
            refInput.disabled = true;
        }
    }

}

function turnOff() {
    for (var i = 0; i < turnOffArray.length; i++) {
        thisEl = document.getElementById(turnOffArray[i]);
        thisEl.disabled = true;
    }
}

