function validateCreditCard(workStr)
{
	workStr = workStr.replace(/\.|\-| /g, '');
	
	// if the string is not 13..16 digits exactly it is not valid
	if (!workStr.match(/^[0-9]{13,16}$/)) { return false; }

	// Split the string into parts for analysis...
	var chars = new Array();
	var len = workStr.length;
	for (var i=len-1; i>=0; i--) { chars[(len - 1) - i] = workStr.charAt(i); }
	
	var checkVal = 0;
	for (var i=0; i<len; i++)
	{
		// If this is an odd position in the string then I simply add the value
		// at <that> position to the total... if it is an even position then I 
		// multiply it * 2 and add it to the total - if the amount is > 10 then
		// I add the 2 digits together for example: 2*7 is 14, but the final
		// value is 5 because it's 1 + 4. Also, this is not zero indexed - I count
		// the first digit to be, literally the oneth, so even though it's index
		// is zero I consider it to be an odd position. Also, as you may have
		// noticed from the previous little routine this all takes place against
		// the input value backward. Jeebers!
		if ((i + 1) % 2) { checkVal += (chars[i] - 0); } 
		else {
			// the answer is false, aka zero, so this is an even number
			var thisVal = chars[i] * 2;
			if (thisVal <= 9) { checkVal += (thisVal - 0); }
			if (thisVal >= 10) { checkVal += (thisVal - 9); }
		}
	}
	
	// So: if the resulting value I just created mod 10 is not zero, it's not a valid CC...
	if (checkVal % 10) { return false; }
	
	var chars1 = workStr.charAt(0);
	var chars2 = workStr.substr(0, 2);
	var chars3 = workStr.substr(0, 3);
	var chars4 = workStr.substr(0, 4);
	
	if ( (chars1 == '4') && ((len == 16) || (len == 13)) ) { return 'VI'; } // Visa
	if ( (len == 16) && (chars2 >= '51') && (chars2 <= '55')) { return 'MC'; } // MasterCard
	if ( (len == 15) && ((chars2 == '34') || (chars2 == '37')) ) { return 'AX'; } // AmEx
	if ( (chars4 == '6011') && (len == 16) ) { return 'DI'; } // Discover
	if ( (((chars3 >= '300') && (chars3 <= 305)) || (chars2 == '36')) && (len == 14) ) { return 'DC'; } // Diners Club
	if ( (chars2 == '38') && (len == 14) ) { return 'CB'; } // Carte Blanche
	if ( ((chars4 == '2014') || (chars4 == '2149')) && (len == 15) ) { return 'ER'; } // En Route
	if ( ((chars4 == '2131') || (chars4 == '1800')) && (len == 15) ) { return 'JC'; } // JCB
	if ( (chars1 == '3') && (len == 16) ) { return 'JC'; } // JCB Also
	return false;
}