
  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; } // end if

    } // end for

    return IsNumber;

  } // end

  function catering_total(form_id) {

    var total = 0;

    var temp  = MochiKit.DOM.getElement(form_id).delivery_fee;
    if (temp[0].checked) { total += 15; }
    if (temp[1].checked) { total += 25; }
    if (temp[2].checked) { total += 0;  }

    temp = MochiKit.DOM.getElement(form_id).num_classico_salade;
    if (IsNumeric(temp.value)) {
      total += (temp.value * 3);
    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_riserva_salade;
    if (IsNumeric(temp.value)) {
      total += (temp.value * 3);
    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_antipasti_salad;
    if (IsNumeric(temp.value)) {

      if (MochiKit.DOM.getElement(form_id).antipasti_salad_type[0].checked) {

        total += (temp.value * 35);

      } else if (MochiKit.DOM.getElement(form_id).antipasti_salad_type[1].checked) {

        total += (temp.value * 70);

      } // end if

    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_three_cheese_lasagna;
    if (IsNumeric(temp.value)) {

      if (MochiKit.DOM.getElement(form_id).three_cheese_lasagna_type[0].checked) {

        total += (temp.value * 35);

      } else if (MochiKit.DOM.getElement(form_id).three_cheese_lasagna_type[1].checked) {

        total += (temp.value * 70);

      } // end if

    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_meat_lasagna;
    if (IsNumeric(temp.value)) {

      if (MochiKit.DOM.getElement(form_id).meat_lasagna_type[0].checked) {

        total += (temp.value * 45);

      } else if (MochiKit.DOM.getElement(form_id).meat_lasagna_type[1].checked) {

        total += (temp.value * 90);

      } // end if

    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_chicken;
    if (IsNumeric(temp.value)) {
/*
      if (MochiKit.DOM.getElement(form_id).chicken_type[0].checked) {

        total += (temp.value * 45);

      } else if (MochiKit.DOM.getElement(form_id).chicken_type[1].checked) {

        total += (temp.value * 90);

      } // end if
*/
      total += (temp.value * 3);

    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_z_pasta1;
    if (IsNumeric(temp.value)) {

      if (MochiKit.DOM.getElement(form_id).z_pasta1_type[0].checked) {

        if (MochiKit.DOM.getElement(form_id).add_grilled_chicken_z_pasta.checked) {

          total += (temp.value * 50);

        } else {

          total += (temp.value * 35);

        } // end if

      } else if (MochiKit.DOM.getElement(form_id).z_pasta1_type[1].checked) {

        if (MochiKit.DOM.getElement(form_id).add_grilled_chicken_z_pasta.checked) {

          total += (temp.value * 90);

        } else {

          total += (temp.value * 70);

        } // end if

      } // end if

    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_z_pasta2;
    if (IsNumeric(temp.value)) {

      if (MochiKit.DOM.getElement(form_id).z_pasta2_type[0].checked) {

        if (MochiKit.DOM.getElement(form_id).add_grilled_chicken_z_pasta.checked) {

          total += (temp.value * 50);

        } else {

          total += (temp.value * 35);

        } // end if

      } else if (MochiKit.DOM.getElement(form_id).z_pasta2_type[1].checked) {

        if (MochiKit.DOM.getElement(form_id).add_grilled_chicken_z_pasta.checked) {

          total += (temp.value * 90);

        } else {

          total += (temp.value * 70);

        } // end if

      } // end if

    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_grilled_chicken_salad_sandwich;
    if (IsNumeric(temp.value)) {
      total += (temp.value * 4.5);
    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_the_italian_sandwich;
    if (IsNumeric(temp.value)) {
      total += (temp.value * 4.5);
    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_caprese_sandwich;
    if (IsNumeric(temp.value)) {
      total += (temp.value * 4);
    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_flatbread_sandwich;
    if (IsNumeric(temp.value)) {
      total += (temp.value * 4);
    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_cookies;
    if (IsNumeric(temp.value)) {
      total += (temp.value * 1);
    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_tiramisu;
    if (IsNumeric(temp.value)) {
      total += (temp.value * 45);
    } // end if

    temp = MochiKit.DOM.getElement(form_id).num_canned_soda;
    if (IsNumeric(temp.value)) {
      total += (temp.value * 1);
    } // end if

    MochiKit.DOM.getElement(form_id).total.value = ("$"+total.toFixed(2));

  } // end catering_total()

  function prep_form() {

    for (var form in misc_vars["prep_form"]) {

      misc_vars["prep_form"][form]();

    } // end for

  } // end prep_form()
