Your biggest issue here is that the javascript is going to execute prior to the radio buttons being created. Therefore document.getElementById(...)
is not going to find the element, as it doesn't exist. Try adding your code to a function and having that function run onload of the body.