You can modify this to suit your needs. "radioObject" is the radio button input. This script gets the value that's selected; so instead of proceeding to get the value, when it gets to the checked option you'd want to return i (try, value = i and change the return value line to read "return i".
function getRadioValue(radioObject){
var value = null;
for (var i=0; i<radioObject.length; i++){
if (radioObject.checked){
value = radioObject.value;
break}
}
return value;
}