function verifyCreditCard() {
  credit_card_element = document.getElementById( 'credit_card_number' );

  good_card = isCreditCard( credit_card_element.value );

  if( good_card ) {
    //showImage();
	credit_card_element.form.submit_button.disabled=true;
	credit_card_element.form.submit_button.value='Processing...';
	return true;
  }
  else {
    alert( "Please enter a valid credit card number.");
    credit_card_element.focus();
    return false;
  }
}

function showImage(){
    div_element = document.getElementById('animation');
    div_element.style.display = 'block';
    div_element.style.visibility = 'visible';
    return true;
}

//--------------------------------------------------------------------------------
//    Function: isCreditCard(strInput)
// Description: Checks to see that the number passes the Luhn Mod-10 test
//       Input: strInput - the credit card number to be checked
//     Returns: true  - if field only contains proper characters
//              false - if credit card failed test
//  Disclaimer:	Skipjack Financial Services grants you a nonexclusive copyright license to use
//		this sample code from which you can generate similar function tailored to your own
//		specific needs.
//
//		This sample is provided by Skipjack Financial Services for illustrative purposes
//		only. It has not been thoroughly tested under all conditions. Skipjack, therefore,
//		cannot guarantee or imply reliability, serviceability, or function.
//
//		The sample code contained herein is provided to you "AS IS" without any	warranties 
//		of any kind. The implied warranties of non-infringement, merchantability and 
//		fitness for a particular purpose are expressly disclaimed.
//--------------------------------------------------------------------------------
function isCreditCard(strInput)
{
	// Encoding only works on cards with less than 19 digits	
	if (strInput.length > 19) return (false);  
	
	var sum = 0; 
	var mul = 1; 
	var l = strInput.length;
	
	for (i = 0; i < l; i++)
	{
		var digit    = strInput.substring(l-i-1,l-i);
    		var tproduct = parseInt(digit ,10) * mul;

	    	if (tproduct >= 10) 
		{ sum += (tproduct % 10) + 1; }
    		else
		{ sum += tproduct; }

    		if (mul == 1)       
		{ mul++; }
	    	else
		{ mul--; }
  	}	

  	if ((sum % 10) == 0)  return (true);
  	else                  return (false);
}

/***********************************************
* Disable "Enter" key in Form script- By Nurul Fadilah(nurul@REMOVETHISvolmedia.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
                
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	} 



