<!-- Begin
function checkCC(cc_num){
	
	if ( /^4[0-9]{12}([0-9]{3})?$/.test(cc_num) ) //Visa
	   var cc_type = 'Visa';
   else if (/^5[1-5][0-9]{14}$/.test(cc_num) ) //Master Card
	   var cc_type = 'Master Card';
	else if (/^3[47][0-9]{13}$/.test(cc_num) ) //American Express
	   var cc_type = 'American Express';
	else if (/^6011[0-9]{12}$/.test(cc_num) ) //Discover
	   var cc_type = 'Discover';	
   else return false;
/*	else if (/^3(0[0-5]|[68][0-9])[0-9]{11}$/.test(cc_num) ) //Diners Club
	   var cc_type = 'Diners Club';
	else if (/^(3[0-9]{4}|2131|1800)[0-9]{11}$/.test(cc_num) ) //JSB
	   var cc_type = 'JSB';
	else if (/^5610[0-9]{12}$/.test(cc_num) ) //Australian BankCard
	   var cc_type = 'Australian BankCard';*/
	
   
	return luhnCheck(cc_num);
	
}

function luhnCheck(CardNumber) {
	
	var no_digit = CardNumber.length;
	var oddoeven = no_digit & 1;
	var sum = 0;
	
	for (var count = 0; count < no_digit; count++) {
		var digit = parseInt(CardNumber.charAt(count));
		if (!((count & 1) ^ oddoeven)) {
			digit *= 2;
			if (digit > 9)
				digit -= 9;
		}
	sum += digit;
	}
	if (sum % 10 == 0)
		return true;
	else
		return false;
}

function checkExpDate(ExpMonth, ExpYear){
   if (ExpMonth.length!=2)
	   return false;
   if (ExpMonth.substring(0,1)==0) ExpMonth = ExpMonth.substring(1,2);
	
	if (ExpMonth<1 || ExpMonth>12)
		return false;
	if (ExpYear.length!=2)
		return false;
	ExpYear = '20' + ExpYear;
	ExpYear = ExpYear*1; //makes the string a number

   today = new Date(); 
	expiry = new Date(ExpYear, ExpMonth);

   if (today.getTime() > expiry.getTime())
		return false;
	return true;
}
//  End -->