Validate CreditCard Number and checked radio button javascript
<p>I have radio buttons radioVisa, and radioMaster. If either one is checked, I need to first check to see which one is selected and then validate that the card number entered is valid. I also need to make sure that only numbers are entered.... I am not allowed to use any regular expression techniques.... If the radioVisa is checked, it seems to work but when I added the code for the radioMaster, if it is checked it does't work.... Can someone tell me what I am doing wrong please....</p>

<pre><code>function isValidCardNumber(num, isVisa, isMaster){
var card = new Array();

    if (document.getElementById('radioVisa').checked){
        card  = isVisa;
        }
         if (num[0] != '4' ||  num.length != 16 ){

                return false;
            } else {
                return true;

            } else if (document.getElementById('radioMaster').checked){
        card = isMaster;
        }

         if (num[0] != '51' || num[0] != '52' ||  num[0] != '53' ||
 num[0] != '54' || num[0] != '55' || num.length != 16 ){
            return false;
        } else {
            return true;
        }    
</code></pre>
