Modifying Luhn checker function to check for Laser cards
<p>I use the following script to validate the card details entered in a form. I would like to add a function to this so that a visitor using a Laser card is alerted that we don't accept them.</p>

<p>The start digits of the Laser are 6304, 6706, 6771 &amp; 6709</p>

<pre><code>function Calculate(Luhn)
{
var sum = 0;
for (i=0; i&lt;Luhn.length; i++ )
{
    sum += parseInt(Luhn.substring(i,i+1));
}
var delta = new Array (0,1,2,3,4,-4,-3,-2,-1,0);
for (i=Luhn.length-1; i&gt;=0; i-=2 )
{       
    var deltaIndex = parseInt(Luhn.substring(i,i+1));
    var deltaValue = delta[deltaIndex]; 
    sum += deltaValue;
}   
var mod10 = sum % 10;
mod10 = 10 - mod10; 
if (mod10==10)
{       
    mod10=0;
}
return mod10;
}

function Validate(Luhn)
{
var LuhnDigit = parseInt(Luhn.substring(Luhn.length-1,Luhn.length));
var LuhnLess = Luhn.substring(0,Luhn.length-1);
if (Calculate(LuhnLess)==parseInt(LuhnDigit))
{
    return true;
}
alert("\n\nError with your card number! \nPlease check and correct.\n\n")   
return false;
</code></pre>
