function Init() {
	if (DOMFL.GetElm("form")) DOMFL.SetEvent(DOMFL.GetElm("form"), "submit", ValidateFields);
}

function ValidateFields(e) {

  var form = document.createElement("div");

  var quantity = DOMFL.GetElm("quantity");
	
	if (quantity.value.length == 0) {
    DOMFL.StopEvent(e);
	  form.appendChild(CustomMessage("You must specify how many sets of cards you would like to purchase."));
	  form.appendChild(CustomTextField(quantity));
    DOMFL.ShowModalWindow(CustomForm(form, false, SetTextField));
    return;
  } else if (isNaN((quantity.value).replace("$", ""))) {
    DOMFL.StopEvent(e);
	  form.appendChild(CustomMessage("You must specify a valid number greater than zero."));
	  form.appendChild(CustomTextField(quantity));
    DOMFL.ShowModalWindow(CustomForm(form, false, SetTextField));
    return;
  } else if (parseInt((quantity.value).replace("$", ""), 10) <= 0) {
    DOMFL.StopEvent(e);
	  form.appendChild(CustomMessage("You must specify a valid number greater than zero."));
	  form.appendChild(CustomTextField(quantity));
    DOMFL.ShowModalWindow(CustomForm(form, false, SetTextField));
    return;
  }

}

DOMFL.RunWhenReady(Init);