Determine card in relation to card prefixes
<pre><code>var cards = new Array();

 cards [0] = {name: "VISA", length: "13,16", prefixes: "4", checkdigit: true};
 cards [1] = {name: "VISA_DELTA/ELECTRON", length: "16", prefixes: "417500,4844,4508,4026,4917,4913", checkdigit: true};
 cards [2] = {name: "MC", length: "16", prefixes: "51,52,53,54,55", checkdigit: true};
</code></pre>

<p>then my functions:</p>

<pre><code>function CardTypes()
{
for (var i=0; i&lt;cards.length; i++) {
if cards.name.Validate(PaymentForm.CardNumber.value)&lt;!--pretty sure this is wrong--&gt;
cardname = cards[i].getCardType();
}
if (cardname.length &gt; 0) {
alert("This looks like a " + cardname + " .");
};
};
</code></pre>

<p>When the form is submitted it calls the Validate function which in turn calls all the other functions including CardTypes(). Id like to be able to determine the card type by the card prefixes i.e. 4 = visa. I'm pretty sure i have completely messed up the CardTypes() function. Any help would be appreciated. My form id is PaymentForm.</p>
