Hello,
I 'm working on Euro banknote validation, where I'm using authentication of the serial number of Euro banknotes by the calculation of the "checksum". Basically what this algorithm does is to replace the first letter of the serial number by a number (each letter represents where the banknote is originally from), then it calculates the sum of all digits. If the remaining of the division of that sum by 9 is 0 then your note is valid.

More info:http://en.wikipedia.org/wiki/Euro_banknotes#Checksum.

Some test data
EURO Serial Number
V44671133335
T27620110932
A00000000007

The last serial number "A00000000007" works properly. but the first two for some reason don't work properly.

Those are my javascript codes:
Code:
<html>
<body>
<script type="text/javascript">
		
var EBNSArray = new Array ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90");

function validation() 
{ 
    var i; 
	var EBNS = document.forms["ebnsform"]["EBNS"].value; 

	if (EBNS.length != 11 && EBNS.length != 12)
	{
	     alert ("Incorrect EBNS, please enter the correct EBNS"); 
	     return false; 
	}

	if (EBNS.length == 11)
	{
		var letter_real = EBNS.charAt(0); 
	}	
	
	if (EBNS.length == 12)
	{
		var letter_real = EBNS.charAt(1); 
	}	
	
    var letter_enter = EBNS.substring(1,11); 
    
	var checkLetter = letter_enter % 9
	
    if (letter_real == EBNSArray[checkLetter]) 
    {  
	alert ("Correct EBNS");
        return true; 		 
    } 
    else 
    { 
	alert ("Incorrect EBNS, please enter the correct EBNS");			
        return false; 
    }          
} 
</script>
<form id="ebnsform">
<P>Euro Banknote Number: <input type="text" id="EBNS" /><br /></form></center>
<input type="button" onclick="validation()" value="Validation"/></p>
</body>
</html>