title: Identify card type from card number
body: <p>i have an array of card types that looks something like this</p>
  
  <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,4917,4913",     checkdigit: true};
  </code></pre>
  
  <p>however id like to be able to find the card type depending on the card number entered. e.g if they select their card type from a drop down list i.e visa, then the credit card number should start with 4 otherwise when they submit the form a message of some sort should be display saying this is (whatever card it is, please change card type). Any help would be appreciated.</p>
  
  <p>the id for the card number text field is CardNumber. Im not sure what other info may be needed, i have a function called Validate which validates the rest of the form and a function call Calculate which does the luhn check.</p>