function check_email(e) {
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
for(i=0; i < e.length ;i++){
	if(ok.indexOf(e.charAt(i))<0){ 
		return (false);
	} } 
if (document.images) {
	re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
	re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
	if (!e.match(re) && e.match(re_two)) {
		return (-1);		
	} }
}
function IsNumeric(sText) {
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}

function onSubmitForm() {
	if (document.getElementById("sjname").value=='') {
		alert("Please enter your name as it apears on your credit card");
		document.getElementById("sjname").focus();
		return false;
	}
	if (document.getElementById("email").value=='') {
		alert("Please enter a valid EMAIL ADDRESS.");
		document.getElementById("email").focus();
		return false;
	}
	if (!check_email(document.getElementById("email").value)) {
		alert("You have entered an INVALID EMAIL ADDRESS. Please use the format email@somewhere.com.");
		document.getElementById("email").focus();
		return false;
	}	
	if (document.getElementById("streetaddress").value=='') {
		alert("Please enter your billing address.");
		document.getElementById("streetaddress").focus();
		return false;
	}
	if (document.getElementById("city").value=='') {
		alert("Please enter your billing city.");
		document.getElementById("city").focus();
		return false;
	}
	if (document.getElementById("state").value=='') {
		alert("Please enter your billing state.");
		document.getElementById("state").focus();
		return false;
	}
	if (document.getElementById("zipcode").value=='') {
		alert("Please enter your billing  ZIP CODE.");
		document.getElementById("zipcode").focus();
		return false;
	}
	if (document.getElementById("shiptophone").value=='') {
		alert("Please enter a valid PHONE NUMBER.");
		document.getElementById("shiptophone").focus();
		return false;
	}
	
	if (document.getElementById("accountnumber").value=='') {
		alert("Please enter an card number.");
		document.getElementById("accountnumber").focus();
		return false;
	}
	if (document.getElementById("transactionamount").value=='') {
		alert("Please enter a price.");
		document.getElementById("transactionamount").focus();
		return false;
	}
}
