// HMC

function updateQty() {
  with (document.theuploadform) {

    str1 = product.options[product.selectedIndex].value
    str2 = frontback.options[frontback.selectedIndex].value
    if (str1.length > 8) {
      sstr1 = str1.substring(0, 14) // check for Business Cards
      sstr2 = str1.substring(0, 9)  // check for Postcards or Envelopes
      sstr3 = str1.substring(0, 16)  // check for Magnets (Indoor or Outdoor)
    } else {
      sstr1 = ""
      sstr2 = ""
      sstr3 = ""
    }
    if (str2.length > 14) {
      sstr2_opt = str2.substring(13, 15) // UV or Matte
    } else {
      sstr2_opt = ""
    }

    qty.options[0].value = ""
    if (str1 == "Business Cards, 14pt.") {
	if (sstr2_opt == "UV") {
          // Business Cards w/ UV coating only
          qty.length = 8
          qty.options[1].value = "100"
          qty.options[2].value = "250"
          qty.options[3].value = "500"
          qty.options[4].value = "1000"
          qty.options[5].value = "2500"
          qty.options[6].value = "5000"
          qty.options[7].value = "10,000"
        } else {
          qty.length = 5
          qty.options[1].value = "1000"
          qty.options[2].value = "2500"
          qty.options[3].value = "5000"
          qty.options[4].value = "10,000"
        }
    } else if (sstr3 == "Magnets (Indoor)") {
      // Magnets Only Options
        qty.length = 5
        qty.options[1].value = "1000"
        qty.options[2].value = "2000"
        qty.options[3].value = "5000"
        qty.options[4].value = "10,000"
    } else if (sstr3 == "Magnets (Outdoor") {
	qty.length = 1
	qty.options[0].value = "2"
    } else {
      // Letterheads, Envelopes, Flyers, Postcards, Brochures
      // Fold-Over Cards, Booklets, Presentation Folders, Greeting Cards
      // * Business Cards (Round Corner) *
        qty.length = 5
        qty.options[1].value = "1000"
        qty.options[2].value = "2500"
        qty.options[3].value = "5000"
        qty.options[4].value = "10,000"

    }
    for (i=0; i<qty.length; i++) {
      qty.options[i].text = qty.options[i].value
    }
    qty.selectedIndex = 0
  }
}

function updateOpt()
{
  with (document.theuploadform) {
    str1 = product.options[product.selectedIndex].value
    if (str1.length > 6) {
      sstr1 = str1.substring(0, 14) // check for Business Cards
      sstr2 = str1.substring(0, 9)  // check for Postcards or Envelopes
      sstr3 = str1.substring(0, 7)  // check for Magnets

    } else {
      sstr1 = ""
      sstr2 = ""
      sstr3 = ""
    }

    frontback.options[0].value = ""
    frontback.selectedIndex = 0
    qty.length = 1
    qty.selectedIndex = 0
    qty.options[0].value = ""
    qty.options[0].text = ""
    if (sstr1 == "Business Cards" || sstr2 == "Postcards") {
        frontback.length = 6
        frontback.options[1].value = "1-sided 4/0, UV Coated"
        frontback.options[2].value = "1-sided 4/0, Matte Finish"
        frontback.options[3].value = "2-sided 4/4, UV Coated Front/Matte Back"
        frontback.options[4].value = "2-sided 4/4, UV Coated Both Sides"
        frontback.options[5].value = "2-sided 4/4, Matte Finish Both Sides"
    } else if (sstr2 == "Envelopes" || sstr3 == "Magnets") {
	frontback.length = 1
	frontback.options[0].value = "n/a"
	updateQty()
    } else {
        frontback.length = 3
        frontback.options[1].value = "1-sided 4/0"
        frontback.options[2].value = "2-sided 4/4"

    }
    for (i=0; i<frontback.length; i++) {
      frontback.options[i].text = frontback.options[i].value
    }
    frontback.selectedIndex = 0
  }
}
