// ===================================================================
// GlobalParameters
// ===================================================================
var requestedFormAction = null; // variable holds the pressed submit button value
var selectedButtonId = null; // variable holds the ID of the button pressed in a form

// ===================================================================
// Generic validate form. It is called by the onSubmit() event
// within each form that requires validation.
// ===================================================================
function validateForm(theForm) {
  switch (theForm.id) {  	     
		case "SubscriptionList" :	
      return validateList(theForm, 'checkall', 'Subscription');
		  break; 
    case "CreditCardList" :	
      return validateList(theForm, 'checkall', 'Credit Card');
		  break;  
    case "PayPalList" :	
      return validateList(theForm, 'checkall', 'PayPal Account');
		  break;    
    case "ShippingAddressList" :	
      return validateList(theForm, 'checkall', 'Shipping Address');
		  break; 
    case "deleteAccountForm" :
      return displayConfirmWindow('Are you sure you want to delete your account?\n\nClick "OK" to proceed, or "Cancel" to abort.');
      break;
    case "emptyShoppingList" :
      return displayConfirmWindow('Are you sure you want to clear the entire shopping list?\n\nClick "OK" to proceed, or "Cancel" to abort.');
      break;
    case "reviewPaymentForm" :
      disableFormButtons(theForm);
      addSingleFormField(theForm, "hidden", "submitButton", "Submit Payment");
      return true;
      break;
    default:
    	return true;
    	break;
  }
}