Validating Multiple Button Sets

Oops … I should have mentioned in title these are RADIO button sets …

I have 3 sets of radio buttons all in one form. (I am working with paypal.) I have found a script that can check to make sure that the first group (paypal.os0) is checked - but then when I try to add code for the other 3 sets
(paypal.os1 and paypal.os2) the code breaks.

I have pulled out my attempts to add the next two sets - here is the code with only one. Can someone steer me in the right direction of how I would add the next two groups? Thanks much.

<script language="JavaScript1.2" type="text/javascript">


function valbutton(paypal) {
// place any other field validations that you require here
// validate myradiobuttons
myOption = -1;



for (i=paypal.os0.length-1; i > -1; i--) {
if (paypal.os0[i].checked) {
myOption = i; i = -1;
}
}


if (myOption == -1) {
alert("You have not finished chosing your options");
return false;
}


// place any other field validations that you require here
thisform.submit(); // this line submits the form after validation
}

</script>

Do you have an example of the markup you are using and what you are actually passing into the JS function?