function sendPmtInfo()
{
	if (CheckInputs()==false)
		{
		return false;
		}
	else
		{  
   		var expdatestring = document.forms.list.USER3.value + "/" + document.forms.list.USER4.value ;
    		document.forms.list.EXPDATE.value = expdatestring;
    		document.forms.list.USER7.value = document.forms.list.cardNum.value;
    		document.forms.list.submit();
		}
}

function CheckInputs()
{
	if (document.forms.list.USER2.selectedIndex==0)
		{
		alert("Please select a credit card type");
		return false; 
		}
	if (isEmpty(document.forms.list.cardNum.value,"Please enter your credit card number")==false)
		{
		return false; 
		}
	if (document.forms.list.USER3.selectedIndex==0)
		{
		alert("Please select an expiration month");
		return false; 
		}
	if (document.forms.list.USER4.selectedIndex==0)
		{
		alert("Please select an expiration year");
		return false; 
		}
	if (isEmpty(document.forms.list.USER5.value,"Please enter your credit security code (CSC)")==false)
		{
		return false;
		}
	if (isEmpty(document.forms.list.USER6.value,"Please enter the name exactly as it appears on your credit card")==false)
		{
		return false;
		}
	else 
		{
		return true;
		}
}

function isEmpty(s, msgTxt)
{
	if (s==null||s.length==0)
		{
		alert(msgTxt); return false; 
		}
	else
		{
		return true;
		}
}

function isWhitespace(s, msgTxt)
      {
           var i;

           // Search through string's characters one by one
           // until we find a whitespace character.
           // When we do, return false; if we don't, return true.

           for (i = 0; i < s.length; i++)
           {
                // Check that current character isn't whitespace.
                var c = s.charAt(i);

                if (c == " ") {
            alert(msgTxt); return true;}
           }
           return false;
      }

function ValidateText(textstring, msgTxt)
 {
  // Get the value of the UserName text box
  var strUserName = String(textstring);
  var strCurrentChar;
  
  // This variable will determine if our string is valid
  var bolValidUserName = true;
  
  // Step through the UserName one character at a time...
  for (var iLoop=0; iLoop < strUserName.length; iLoop++)
  {
   // Check to see if the current character is valid
   strCurrentChar = strUserName.substring(iLoop,iLoop+1);
   
   if (
    // if A-Z...
    //(strCurrentChar >= 'A' && strCurrentChar <= 'Z')
    // or if a-z...
     (strCurrentChar >= 'a' && strCurrentChar <= 'z')
    // or if 0-9...
    || (strCurrentChar >= '0' && strCurrentChar <= '9')
    // or if dash or underscore
    // strCurrentChar == '-' || strCurrentChar == '_'
      );
      
      // We have a valid string... do nothing.
     else
      // We have an invalid string, set the flag
      bolValidUserName = false;
  }
  
  // If we have an invalid UserName, alert the user
  if (!bolValidUserName)
  {
   var strError = "You have entered an invalid character for ";
   strError += msgTxt;
   strError += ". Please use only the following characters:";
   strError += "a-z and 0-9";
   
   alert(strError);
  }
  
  return bolValidUserName;
}
