var nullValue = '';

function SubmitForm(f) {

for(i=0; i<f.length; i++) {
   if(f[i].className == 'reqinput' && f[i].value =='') {
      alert('One or more required fields are missing, please check your form.');
      f[i].focus();
      return false;
   }
}
paystartmonth()
//alert('Works');
      return true;
}


///// Makes sure contribution values are integers /////
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;
			alert("An invalid character has been entered into the contribution amount, please recheck your values.");
         }
      }
   return IsNumber;
	   
   }
// End IsNumeric



// Begin Individual Functions //

function paybycheck(val){
document.contribution.Issue2.value = nullValue;
document.contribution.Issue2.value = ('I will pay by check in the amount of $' + val);

document.contribution.PerPayPeriodAmount.value = nullValue;
//document.contribution.PerPayPeriodPercentage.value = amt;
document.contribution.OneTimeAmount.value = nullValue;
}
function paystartmonth(){
var pyear
var pmonth
pyear = document.contribution.payyear.value;
pmonth = document.contribution.paymonth.value;
//document.contribution.Issue2.value = nullValue; //Pay by check option
document.contribution.Issue1.value = nullValue;
document.contribution.Issue1.value = ('Pay for the month of or beginning: ' + pyear + ' ' + pmonth);
}

function manualperpayperiodpercentage(amt){
IsNumeric(amt)
document.contribution.PerPayPeriodAmount.value = nullValue;
//document.contribution.PerPayPeriodPercentage.value = amt;
document.contribution.OneTimeAmount.value = nullValue;

}


function manualperpayperiod(amt){
IsNumeric(amt)
document.contribution.Issue2.value = nullValue; //Pay by check option
document.contribution.Issue2Check.value = nullValue; //Pay by check option
//document.contribution.PerPayPeriodAmount.value = nullValue;
//document.contribution.PerPayPeriodPercentage.value = nullValue;
document.contribution.OneTimeAmount.value = nullValue;

}


function manualonetimeamount(amt){
IsNumeric(amt)
document.contribution.PerPayPeriodAmount.value = nullValue;
document.contribution.Issue2.value = nullValue; //Pay by check option
document.contribution.Issue2Check.value = nullValue; //Pay by check option
//document.contribution.PerPayPeriodPercentage.value = nullValue;
//document.contribution.OneTimeAmount.value = nullValue;
//If (amt > 4000){document.contribution.OneTimeAmount.value == 4000;}

}
// -- Not In Use //
function perpayperiodpercentage(amt){
document.contribution.PerPayPeriodAmount.value = nullValue;
document.contribution.PerPayPeriodPercentage.value = amt;
document.contribution.OneTimeAmount.value = nullValue;
document.contribution.PerPayPeriodPercentage.focus();
}

function perpayperiod(amt){
document.contribution.PerPayPeriodAmount.value = amt;
document.contribution.PerPayPeriodPercentage.value = nullValue;
document.contribution.OneTimeAmount.value = nullValue;
document.contribution.PerPayPeriodAmount.focus();

}


function onetimeamount(amt){
document.contribution.PerPayPeriodAmount.value = nullValue;
document.contribution.PerPayPeriodPercentage.value = nullValue;
document.contribution.OneTimeAmount.value = amt;
document.contribution.OneTimeAmount.focus();

}

