function checksum(s) { // thanks to daniel_amor@hp.com for AMEX specs
	var p=0, e=8, t=0, c=[], r=0, l=0, i;
	if (s.length != 16) {
		t = 1;
		e = s.length == 13 && 6 || s.length == 15 && 7;
	}
	for (i=p; i<e; i++)
		r += (c[i] = s.charAt(i*2+t) * 2) > 9
			? Math.floor(c[i]/10 + c[i]%10)
			: c[i];
		for (i=p; i<e+t; i++) l += s.charAt(i*2+1-t)-0;
	l += r;
	return e && l%10 == 0;
}
