var updateTimer = 0, maxK = 10; function form_onSubmit() { for (k = 0; k < maxK; k++) { counter = eval("parseInt(productForm.input" + k + "count.value)"); if (counter > 0) { return true; } } alert("Please select quantity for products to add."); return false; } function formUpdate() { var freeK = -1; for (k = 0; k < maxK; k++) { counter = eval("parseInt(productForm.input" + k + "count.value)"); if ((freeK == -1) && !(counter > 0)) { freeK = k; } } for (k = 0; k < maxK; k++) { if (k != freeK) { counter = eval("parseInt(productForm.input" + k + "count.value)"); if (eval("optionRow" + k + ".style.display") != (counter > 0 ? "block" : "none")) { eval("optionRow" + k + '.style.display = "' + (counter > 0 ? "block" : "none") + '";'); } } } if (freeK != -1) { if (eval("optionRow" + freeK + ".style.display") != "block") { eval("optionRow" + freeK + '.style.display = "block";'); } } updateTimer = 0; } function optionCount_onkeypress() { if (updateTimer != 0) { window.clearTimeout(updateTimer); } updateTimer = window.setTimeout("formUpdate()", 500) } if (options.length < 1) { maxK = 1; } for (k = 0; k < maxK; k++) { document.write(" 0 ? ' style="display:none"' : "") + ">"); for (i = 0; i < options.length; i++) { option = options[i]; if (i > 0) { document.write(""); } document.write(""); } document.write(""); document.write("
  " + option[0] + ":  "); if (option[1] == 2) { for (j = 0; j < option[2].length; j++) { optionValue = option[2][j]; document.write("
"); } } else { document.write(""); } document.write("
  Special Instructions:  
  Quantity:
"); }