Problem with js code on a form

So the following code hides/shows fields in a form when radio buttons are clicked, the problem is on the same form I have a checkbox and when said check box is selected the showing and hiding of the fields doesn’t work, any ideas? Thank you very much!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <style type="text/css">
            .showHideDivs {
                display: none
            }
        </style>
        <script type="text/javascript">
            function showHideDivs(){
                var job = '';
                for(i=0; i < oRadBtns.length; i++){
                    if(oRadBtns[i].checked){
                        job = oRadBtns[i].value;
                    }
                }
                switch (job){
                    case 'yes':
                        document.getElementById("nombre").style.display = "none";
                        document.getElementById("apellido").style.display = "none";
                        document.getElementById("empresa").style.display = "block";
                        document.getElementById("contacto").style.display = "block";
                        break;
                    case 'no':
                        document.getElementById("nombre").style.display = "block";
                        document.getElementById("apellido").style.display = "block";
                        document.getElementById("empresa").style.display = "none";
                        document.getElementById("contacto").style.display = "none";
                }
            }
            window.onload=function(){
                oRadBtns = document.getElementById('radBtnCont').getElementsByTagName('input');
                for(i=0; i < oRadBtns.length; i++){
                    oRadBtns[i].onclick = showHideDivs;
                }
                showHideDivs();
            }
        </script>
    </head>
    <body>
        <div id="radBtnCont">
            <input type="radio" value="yes" name="job" checked="checked" />Yes
            <br />
            <input type="radio" value="no" name="job" />No
        </div>
        <div id="nombre" class="showHideDivs">This is nombre div</div>
        <div id="apellido" class="showHideDivs">This is apellido div</div>
        <div id="empresa" class="showHideDivs">This is empresa div</div>
        <div id="contacto" class="showHideDivs">This is contacto div</div>
    </body>
</html>

sorry it’s not included in the code, but the form does have one, any ideas?

no, the checkbox should be independent and not be affected by the radio buttons, it’s just a checkbox to say I accept the conditions.

here is the checkbox code:

<div class="form_element">

    <input type="checkbox" class="checkbox" name="<?php echo HTMLForm::FORM_ACCEPT_FIELD ?>" id="acceptance" <?php echo ($form->isAccepted()) ? 'checked="checked"' : '' ?> value="<?php echo HTMLForm::FORM_ACCEPT_VALUE ?>" />

    <label for="acceptance" class="checkbox_label dselabel <?php echo ($form->isSubmitted() && !$form->isAccepted()) ? 'error':'' ?>">Doy mi conformidad con la declaraci&oacute;n de&nbsp;</label>

    <a onclick="window.open('?open=privacy','privacy','scrollbars=yes,width=520,height=350');" class="dse">protecci&oacute;n de datos</a>

    <label for="acceptance" class="checkbox_label dselabel <?php echo ($form->isSubmitted() && !$form->isAccepted()) ? 'error':'' ?>">&nbsp;. <?php echo $page['star'];?></label>

</div>