//checks for required values in the support forms
function checkValues(myForm){
	//check email for proper format
	re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

	if(!re.test(myForm.email.value)){
		alert("you must supply a valid email address");
		myForm.email.focus();
		myForm.email.select();
		return false;
	}
}

// only checking if email is there
function checkEmail (strng) {
	var error="";
	var emailFilter=/^.+@.+\..{2,3}$/;
	var illegalChars= "/[\(\)\<\>\,\;\:\\\"\[\]]/";
	if (strng !== "") { 
		if (!(emailFilter.test(strng))) { 
			 error = "Please enter a valid Email address.\n";
		}
		else if (strng.match(illegalChars)){
			//test email for illegal characters
			error = "The Email address contains unprocessable characters.\n";
		 }
		}
	return error;    
}

function checkOneofTwo (strng1, strng2 ){
	var error="";
	if(strng1=="" && strng2==""){
		 error = "Either your Account Number or Birthdate must be filled in.\n";	
	}
	return error;    
}
function checkPaymentAmount(strng){
		var error="";
		if(strng =="" ){
			error = "Please enter your Payment Amount.\n";		
		}
	return error;    
}
function checkFirstName(strng){
		var error="";
		if(strng =="" ){
			error = "Please enter your First Name.\n";		
		}
	return error;    
}
function checkLastName(strng){
		var error="";
		if(strng =="" ){
			error = "Please enter your Last Name.\n";		
		}
	return error;    
}

function checkBillpayForm(theForm) {
    var why = "";
	why += checkPaymentAmount(theForm.payment_amount.value);
	why += checkFirstName(theForm.first_name.value);
  	why += checkLastName(theForm.last_name.value); 
	why += checkOneofTwo(theForm.client_account_number.value, theForm.client_birthdate_year.value);
	why += checkEmail(theForm.email.value);
   
   if (why != "") {
       alert(why);
       return false;
    }
return true;
}


