Need to convert a asp.net validation code into a jQuery validation

Need to convert a asp.net validation code into a jQuery validation

 //this function multiplies digits 1,4,7 by 3, digits 2,5,8 by 7, and 3,6,9 by 1, and
            //adds the results together. If the total is evenly divisible by 10, then the check digit is ok
            //otherwise, it is not.  example "good" trn = 263181368

if (sTrn.Length < 9) return false;
 int[] multipliers = new int[3] { 3, 7, 1 };  //multiply each digit by one of these numbers
            int s = 0;
            int m = 0;

            for (int i = 0; i < 9; i++)
            {
                s += int.Parse(sTrn.Substring(i, 1)) * multipliers[m];
                m = ++m < 3 ? m : 0;  //reset to first multiplier
            }

            return (s != 0 && s % 10 == 0) ? true : false;