function validate()
{
	if(trim(document.getElementById('auth_net_account_name').value)=="")
	{
		alert("Please Enter Account Name.");
		document.getElementById('auth_net_account_name').focus();
		return false;
	} 
	if(trim(document.getElementById('auth_net_account_number').value)=="")
	{
		alert("Please Enter Account Number.");
		document.getElementById('auth_net_account_number').focus();
		return false;
	}
	
	if(document.getElementById("auth_net_first_name").value=='')
	{
		alert("Please Enter First Name.");
		document.getElementById("auth_net_first_name").focus();
		return false;
	}
	if(document.getElementById("auth_net_last_name").value=='')
	{
		alert("Please Enter Last Name.");
		document.getElementById("auth_net_last_name").focus();
		return false;
	}
		/*if(trim(document.getElementById('auth_net_last_name').value)=="")
	{
		alert("Please Enter Last Name.");
		document.getElementById('auth_net_last_name').focus();
		return false;
	} */
	if(trim(document.getElementById('auth_net_email').value)=="")
	{
		alert("Please Enter Email Address.");
		document.getElementById('auth_net_email').focus();
		return false;
	} 

	if(trim(document.getElementById('auth_net_email').value)!="")
	{
		var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
		var ans = document.getElementById('auth_net_email').value.match(emailExp);
		if(ans!=document.getElementById('auth_net_email').value)
		{
			alert("Please Enter Valid Email.");
			document.getElementById('auth_net_email').focus();
			return false;				
		}
	}
	if(trim(document.getElementById('auth_net_phone').value)=="")
	{
		alert("Please Enter Phone.");
		document.getElementById('auth_net_phone').focus();
		return false;
	} 
	/*if(isNaN(document.getElementById('auth_net_phone').value))
	{
		alert("Enter Phone number in digits");
		document.getElementById('auth_net_phone').focus();
		return false;
	}*/
	
	
	if(trim(document.getElementById('auth_net_amount').value)=="")
	{
		alert("Enter Amount");
		document.getElementById('auth_net_amount').focus();
		return false;
	}
	
	
	if(isNaN(document.getElementById('auth_net_amount').value))
	{
			alert("Amount should be numeric");
			document.getElementById("auth_net_amount").focus();
			return false;
			
	}

	if(trim(document.getElementById('auth_net_card_name').value)=="")
	{
		alert("Please Enter Full  Name.");
		document.getElementById('auth_net_card_name').focus();
		return false;
	} 
	if(trim(document.getElementById('auth_net_card_no').value)=="" || isNaN(document.getElementById('auth_net_card_no').value))
	{
		alert("Please Enter Valid Card No.");
		document.getElementById('auth_net_card_no').focus();
		return false;
	} 
	if(trim(document.getElementById('auth_net_card_mm').value)=="")
	{
		alert("Please Enter Card Expiry Month.");
		document.getElementById('auth_net_card_mm').focus();
		return false;
	} 
	if(trim(document.getElementById('auth_net_card_yy').value)=="")
	{
		alert("Please Enter Card Expiry Year.");
		document.getElementById('auth_net_card_yy').focus();
		return false;
	} 
	if(trim(document.getElementById('auth_net_card_cvv').value)=="")
	{
		alert("Please Enter Card CVV No.");
		document.getElementById('auth_net_card_cvv').focus();
		return false;
	} 
	return true;
}
function trim(stringToTrim)
{
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

