// JavaScript Document
window.onload = init;
var Total = 0.0 
var STotal = 0.0 
var Tax = 0.0 
dog = new Array();
dog["ade"] = new Array();
dog["adi"] = new Array();
dog["frs"] = new Array();
dog["frt"] = new Array();
dog["hew"] = new Array();
dog["inr"] = new Array();
dog["ren"] = new Array();
dog["sel"] = new Array();
dog["ade"]["green"] = new Array();
dog["ade"]["teal"] = new Array();
dog["ade"]["red"] = new Array();
dog["ade"]["blue"] = new Array();
dog["adi"]["green"] = new Array();
dog["adi"]["teal"] = new Array();
dog["adi"]["red"] = new Array();
dog["adi"]["blue"] = new Array();
dog["frs"]["yellow"] = new Array();
dog["frs"]["blue"] = new Array();
dog["frs"]["purple"] = new Array();
dog["frs"]["red"] = new Array();
dog["frt"]["yellow"] = new Array();
dog["frt"]["blue"] = new Array();
dog["frt"]["purple"] = new Array();
dog["frt"]["red"] = new Array();
dog["hew"]["blue"] = new Array();
dog["hew"]["green"] = new Array();
dog["hew"]["brown"] = new Array();
dog["inr"]["brown"] = new Array();
dog["inr"]["green"] = new Array();
dog["inr"]["yellow"] = new Array();
dog["inr"]["white"] = new Array();
dog["ren"]["pink"] = new Array();
dog["ren"]["purple"] = new Array();
dog["ren"]["brown"] = new Array();
dog["ren"]["red"] = new Array();
dog["ren"]["teal"] = new Array();
dog["ren"]["plum"] = new Array();
dog["sel"]["brown"] = new Array();
dog["sel"]["green"] = new Array();
dog["sel"]["yellow"] = new Array();
dog["sel"]["white"] = new Array();
dog["ade"]["green"]["4"] = 47.99
dog["ade"]["green"]["6"] = 65.99
dog["ade"]["teal"]["4"] = 48.99
dog["ade"]["teal"]["6"] = 67.99
dog["ade"]["red"]["4"] = 49.99
dog["ade"]["red"]["6"] = 69.99
dog["ade"]["blue"]["4"] = 50.99
dog["ade"]["blue"]["6"] = 70.99
dog["adi"]["green"]["6"] = 84.99
dog["adi"]["teal"]["6"] = 89.99
dog["adi"]["red"]["6"] = 94.99
dog["adi"]["blue"]["6"] = 99.99
dog["frs"]["yellow"]["3"] = 44.99
dog["frs"]["blue"]["3"] = 45.99
dog["frs"]["purple"]["3"] = 49.99
dog["frs"]["red"]["3"] = 50.99
dog["frs"]["yellow"]["6"] = 81.99
dog["frs"]["blue"]["6"] = 84.99
dog["frs"]["purple"]["6"] = 89.99
dog["frs"]["red"]["6"] = 91.99
dog["frt"]["yellow"]["3"] = 38.99
dog["frt"]["blue"]["3"] = 40.99
dog["frt"]["purple"]["3"] = 43.99
dog["frt"]["red"]["3"] = 45.99
dog["frt"]["yellow"]["6"] = 71.99
dog["frt"]["blue"]["6"] = 76.99
dog["frt"]["purple"]["6"] = 79.99
dog["frt"]["red"]["6"] = 81.99
dog["hew"]["blue"]["6"] = 25.99
dog["hew"]["green"]["6"] = 33.99
dog["hew"]["brown"]["6"] = 39.99
dog["hew"]["blue"]["12"] = "?"
dog["hew"]["green"]["12"] = "?"
dog["hew"]["brown"]["12"] = "?"
dog["inr"]["brown"]["6"] = 23.99
dog["inr"]["green"]["6"] = 25.99
dog["inr"]["yellow"]["6"] = 33.99
dog["inr"]["white"]["6"] = 43.99
dog["inr"]["brown"]["12"] = 44.99
dog["inr"]["green"]["12"] = 46.99
dog["inr"]["yellow"]["12"] = 61.99
dog["inr"]["white"]["12"] = 81.99
dog["ren"]["pink"]["3"] = 40.99
dog["ren"]["purple"]["3"] = 45.99
dog["ren"]["brown"]["3"] = 45.99
dog["ren"]["red"]["3"] = 48.99
dog["ren"]["teal"]["3"] = 50.99
dog["ren"]["plum"]["3"] = 63.99
dog["ren"]["purple"]["6"] = 80.99
dog["ren"]["brown"]["6"] = 81.99
dog["ren"]["red"]["6"] = 84.99
dog["ren"]["teal"]["6"] = 86.99
dog["ren"]["plum"]["6"] = 121.99
dog["sel"]["brown"]["6"] = 59.99
dog["sel"]["green"]["6"] = 63.99
dog["sel"]["yellow"]["6"] = 69.99
dog["sel"]["white"]["6"] = 84.99
dog["sel"]["brown"]["12"] = 112.98
dog["sel"]["green"]["12"] = 120.98
dog["sel"]["yellow"]["12"] = 132.98
dog["sel"]["white"]["12"] = 162.98
cat = new Array();
cat["ade"] = new Array();
cat["adi"] = new Array();
cat["frs"] = new Array();
cat["frt"] = new Array();
cat["hew"] = new Array();
cat["ren"] = new Array();
cat["ade"]["orange"] = new Array();
cat["ade"]["purple"] = new Array();
cat["adi"]["turquoise"] = new Array();
cat["adi"]["orange"] = new Array();
cat["adi"]["purple"] = new Array();
cat["frs"]["all weights"] = new Array();
cat["frt"]["all weights"] = new Array();
cat["hew"]["red"] = new Array();
cat["hew"]["purple"] = new Array();
cat["ren"]["pink"] = new Array();
cat["ren"]["blue"] = new Array();

cat["ade"]["orange"]["4"] = 48.99
cat["ade"]["orange"]["6"] = 67.99
cat["ade"]["purple"]["4"] = 49.99
cat["ade"]["purple"]["6"] = 68.99

cat["adi"]["turquoise"]["3"] = 44.99
cat["adi"]["orange"]["6"] = 84.99
cat["adi"]["purple"]["6"] = 84.99

cat["frs"]["all weights"]["3"] = 43.99
cat["frs"]["all weights"]["6"] = 81.99

cat["frt"]["all weights"]["3"] = 40.99
cat["frt"]["all weights"]["6"] = 76.99

cat["hew"]["red"]["6"] = 33.99
cat["hew"]["purple"]["6"] = 33.99

cat["ren"]["pink"]["3"] = 40.99
cat["ren"]["blue"]["3"] = 45.99
cat["ren"]["blue"]["6"] = 76.99

product = new Array();
product[1] = 'a'
product[2] = 'b'
product[3] = 'c'
product[4] = 'd'

function init(){
  clientornot.box.checked = false
  shipornot.box.checked = false
}
	
//dog.adv.green.6 = 65.99
function FillProduct(obj){
  formid = obj.id.substr(obj.id.length - 1);
  SelectStr = '<select onChange="FillWeight(this)" id="select2' + formid + '"><option> </option></select>'
//  window.status = "***" + getElementById("form2a").id + "***";
//  obj2fill = getElementById("form2a");
  if (obj.options[obj.selectedIndex].text == "Dog"){
    SelectStr = '<select onChange="FillWeight(this)" id="select2' + formid + '">'
    SelectStr += '<option>Product</option>'
    SelectStr += '<option>Advantage</option>'
    SelectStr += '<option>Advantage Multi</option>'
    SelectStr += '<option>Frontline Plus</option>'
    SelectStr += '<option>Frontline Top Spot</option>'
    SelectStr += '<option>Heartguard Plus Chew</option>'
    SelectStr += '<option>Interceptor</option>'
    SelectStr += '<option>Revolution</option>'
    SelectStr += '<option>Sentinel</option>'
    SelectStr += '</select>'
  }
  if (obj.options[obj.selectedIndex].text == "Cat"){
    SelectStr = '<select onChange="FillWeight(this)" id="select2' + formid + '">'
    SelectStr += '<option>Product</option>'
    SelectStr += '<option>Advantage</option>'
    SelectStr += '<option>Advantage Multi</option>'
    SelectStr += '<option>Frontline Plus</option>'
    SelectStr += '<option>Frontline Top Spot</option>'
    SelectStr += '<option>Revolution</option>'
    SelectStr += '</select>'
  }
  eval("form2" + formid + ".innerHTML = SelectStr")
}
function FillDogWeight(obj){
  formid = obj.id.substr(obj.id.length - 1);
//  formid = obj.parentNode.id.substr(obj.parentNode.id.length - 1);
  SelectStr = '<select onChange="FillDogPk(this)" id="sdogw' + formid + '"><option> </option></select>'
  Product = obj.options[obj.selectedIndex].text
//  obj2 = eval("form1" + formid + ".select1" + formid)
//  Species = obj2.options[obj2.selectedIndex].text
//  window.status = Product + "  " + Species;
  switch (Product){
    case "Advantage":
      SelectStr = '<select onChange="FillDogPk(this)" id="sdogw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "sgreen">up to 10 lbs (Green)</option>'
      SelectStr += '<option class = "steal">11 - 20 lbs (Teal)</option>'
      SelectStr += '<option class = "sred">21 - 55 lbs (Red)</option>'
      SelectStr += '<option class = "sblue">over 55 lbs (Blue)</option>'
      SelectStr += '</select>'
   break
   case "Advantage Multi":
      SelectStr = '<select onChange="FillDogPk(this)" id="sdogw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "sgreen">3 - 9 lbs (Green)</option>'
      SelectStr += '<option class = "steal">10 - 20 lbs (Teal)</option>'
      SelectStr += '<option class = "sred">21 - 55 lbs (Red)</option>'
      SelectStr += '<option class = "sblue">55 - 88 lbs (Blue)</option>'
      SelectStr += '</select>'
	  break
	case "Frontline Plus":
      SelectStr = '<select onChange="FillDogPk(this)" id="sdogw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "syellow">0 - 22 lbs (Yellow)</option>'
      SelectStr += '<option class = "sblue">23 - 44 lbs (Blue)</option>'
      SelectStr += '<option class = "spurple">45 - 88 lbs (Purple)</option>'
      SelectStr += '<option class = "sred">89 - 132 lbs (Red)</option>'
      SelectStr += '</select>'
	  break
	case "Frontline Top Spot":
      SelectStr = '<select onChange="FillDogPk(this)" id="sdogw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "syellow">0 - 22 lbs (Yellow)</option>'
      SelectStr += '<option class = "sblue">23 - 44 lbs (Blue)</option>'
      SelectStr += '<option class = "spurple">45 - 88 lbs (Purple)</option>'
      SelectStr += '<option class = "sred">89 - 132 lbs (Red)</option>'
      SelectStr += '</select>'
	  break
	case "Heartguard Plus Chew":
      SelectStr = '<select onChange="FillDogPk(this)" id="sdogw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "sblue">0 - 25 lbs (Blue)</option>'
      SelectStr += '<option class = "sbrown">26 - 50 lbs (Brown)</option>'
      SelectStr += '<option class = "sgreen">51 - 100 lbs (Green)</option>'
      SelectStr += '</select>'
	  break
	case "Interceptor":
      SelectStr = '<select onChange="FillDogPk(this)" id="sdogw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "sbrown">2 - 10 lbs (Brown)</option>'
      SelectStr += '<option class = "sgreen">11 - 25 lbs (Green)</option>'
      SelectStr += '<option class = "syellow">26 - 50 lbs (Yellow)</option>'
      SelectStr += '<option class = "swhite">51 - 100 lbs (White)</option>'
      SelectStr += '</select>'
	  break
	case "Revolution":
      SelectStr = '<select onChange="FillDogPk(this)" id="sdogw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "spink">0 - 5 lbs (Pink)</option>'
      SelectStr += '<option class = "sblue">5 - 10 lbs (Purple)</option>'
      SelectStr += '<option class = "sbrown">10 - 20 lbs (Brown)</option>'
      SelectStr += '<option class = "sred">20 - 40 lbs (Red)</option>'
      SelectStr += '<option class = "steal">40 - 85 lbs (Teal)</option>'
      SelectStr += '<option class = "splum">85 - 130 lbs (Plum)</option>'
      SelectStr += '</select>'
	  break
	case "Sentinel":
      SelectStr = '<select onChange="FillDogPk(this)" id="sdogw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "sbrown">2 - 10 lbs (Brown)</option>'
      SelectStr += '<option class = "sgreen">11 - 25 lbs (Green)</option>'
      SelectStr += '<option class = "syellow">26 - 50 lbs (Yellow)</option>'
      SelectStr += '<option class = "swhite">51 - 100 lbs (White)</option>'
      SelectStr += '</select>'
	  break
	default:
  }
//window.status = "fdogw" + formid + ".innerHTML = " + SelectStr
  eval("fdogw" + formid + ".innerHTML = SelectStr")
  SelectStr = '<select onChange="FillDogQty(this)" id="sdogpk' + formid + '">'
  SelectStr += '<option>Pkg Size</option>'
  SelectStr += '</select>'
  eval("fdogpk" + formid + ".innerHTML = SelectStr")
  eval("dp" + formid + ".innerHTML = ''")
  GetTotal()
}
function FillDogPk(obj){
  formid = obj.id.substr(obj.id.length - 1);
  SelectStr = '<select id="sdogpk' + formid + '"><option> </option></select>'
//  Product = obj.options[obj.selectedIndex].text
  obj2 = eval("fdogp" + formid + ".sdogp" + formid)
  Product = obj2.options[obj2.selectedIndex].text
//  window.status = formid;
  switch (Product){
    case "Advantage":
      SelectStr = '<select onChange="FillDogQty(this)" id="sdogpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 4</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '</select>'
   break
   case "Advantage Multi":
      SelectStr = '<select onChange="FillDogQty(this)" id="sdogpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '</select>'
	  break
	case "Frontline Plus":
      SelectStr = '<select onChange="FillDogQty(this)" id="sdogpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 3</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '</select>'
	  break
	case "Frontline Top Spot":
      SelectStr = '<select onChange="FillDogQty(this)" id="sdogpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 3</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '</select>'
	  break
	case "Heartguard Plus Chew":
      SelectStr = '<select onChange="FillDogQty(this)" id="sdogpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '<option>Pkg of 12</option>'
      SelectStr += '</select>'
	  break
	case "Interceptor":
      SelectStr = '<select onChange="FillDogQty(this)" id="sdogpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '<option>Pkg of 12</option>'
      SelectStr += '</select>'
	  break
	case "Revolution":
      SelectStr = '<select onChange="FillDogQty(this)" id="sdogpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 3</option>'
      if (GetWeightTLA(formid, "dog") != "pink"){
        SelectStr += '<option>Pkg of 6</option>'
	  }
      SelectStr += '</select>'
	  break
	case "Sentinel":
      SelectStr = '<select onChange="FillDogQty(this)" id="sdogpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '<option>Pkg of 12</option>'
      SelectStr += '</select>'
	  break
	default:
  }
//window.status = "fdogw" + formid + ".innerHTML = " + SelectStr
  eval("fdogpk" + formid + ".innerHTML = SelectStr")
  eval("dp" + formid + ".innerHTML = ''")
  GetTotal()
}

function FillDogQty(obj){
  formid = obj.id.substr(obj.id.length - 1);
//  window.status = "***" + eval("fdogqty" + formid + ".tdogqty" + formid + ".value");
  if (eval("fdogqty" + formid + ".tdogqty" + formid + ".value") == ""){
    eval("fdogqty" + formid + ".tdogqty" + formid + ".value = 1");
  }
//  window.status = formid
//  window.status = GetProdTLA(formid) 
//  window.status = GetProdTLA(formid) +  "   " + GetWeightTLA(formid) +  "   *" + GetPkgTLA(formid) + "*"
  species = "dog"
  eval("dp" + formid + ".innerHTML = '$' + dog[GetProdTLA(formid, species)][GetWeightTLA(formid, species)][GetPkgTLA(formid, species)]")
  GetTotal()
}

function GetTotal(){
  pat = 0
  pbt = 0
  pct = 0
  pdt = 0
  pet = 0
  pft = 0
  pgt = 0
  pht = 0
  if(eval("dpa.innerHTML.length") > 0){
    p1 = dog[GetProdTLA("a", "dog")][GetWeightTLA("a", "dog")][GetPkgTLA("a", "dog")]
	qty = parseFloat(fdogqtya.tdogqtya.value)
	pat = p1 * qty
	dpa.innerHTML = "$" + pat.toFixed(2).toString()
  }
  if(eval("dpb.innerHTML.length") > 0){
    p1 = dog[GetProdTLA("b", "dog")][GetWeightTLA("b", "dog")][GetPkgTLA("b", "dog")]
	qty = parseFloat(fdogqtyb.tdogqtyb.value)
	pbt = p1 * qty
	dpb.innerHTML = "$" + pbt.toFixed(2).toString()
  }
  if(eval("dpc.innerHTML.length") > 0){
    p1 = dog[GetProdTLA("c", "dog")][GetWeightTLA("c", "dog")][GetPkgTLA("c", "dog")]
	qty = parseFloat(fdogqtyc.tdogqtyc.value)
	pct = p1 * qty
	dpc.innerHTML = "$" + pct.toFixed(2).toString()
  }
  if(eval("dpd.innerHTML.length") > 0){
    p1 = dog[GetProdTLA("d", "dog")][GetWeightTLA("d", "dog")][GetPkgTLA("d", "dog")]
	qty = parseFloat(fdogqtyd.tdogqtyd.value)
	pdt = p1 * qty
	dpd.innerHTML = "$" + pdt.toFixed(2).toString()
  }
  if(eval("cpa.innerHTML.length") > 0){
    p1 = cat[GetProdTLA("a", "cat")][GetWeightTLA("a", "cat")][GetPkgTLA("a", "cat")]
	qty = parseFloat(fcatqtya.tcatqtya.value)
	pet = p1 * qty
	cpa.innerHTML = "$" + pet.toFixed(2).toString()
  }
  if(eval("cpb.innerHTML.length") > 0){
    p1 = cat[GetProdTLA("b", "cat")][GetWeightTLA("b", "cat")][GetPkgTLA("b", "cat")]
	qty = parseFloat(fcatqtyb.tcatqtyb.value)
	pft = p1 * qty
	cpb.innerHTML = "$" + pft.toFixed(2).toString()
  }
  if(eval("cpc.innerHTML.length") > 0){
    p1 = cat[GetProdTLA("c", "cat")][GetWeightTLA("c", "cat")][GetPkgTLA("c", "cat")]
	qty = parseFloat(fcatqtyc.tcatqtyc.value)
	pgt = p1 * qty
	cpc.innerHTML = "$" + pgt.toFixed(2).toString()
  }
  if(eval("cpd.innerHTML.length") > 0){
    p1 = cat[GetProdTLA("d", "cat")][GetWeightTLA("d", "cat")][GetPkgTLA("d", "cat")]
	qty = parseFloat(fcatqtyd.tcatqtyd.value)
	pht = p1 * qty
	cpd.innerHTML = "$" + pht.toFixed(2).toString()
  }
  STotal = pat + pbt + pct + pdt + pet + pft + pgt + pht;
  Tax = STotal * .0825
  Shipm = shipping.method.options[shipping.method.selectedIndex].text
  if (Shipm == 'USPS Priority $8.00'){
	Shipping = 8.00
  }
  else{
	Shipping = 18.98
  }
  Total = STotal + Tax + Shipping;
  STotal = STotal.toFixed(2);
  Shipping = Shipping.toFixed(2);
  Tax = Tax.toFixed(2);
  Total = Total.toFixed(2);
  fsubtotal.innerHTML =  "$" + STotal.toString()
  ftax.innerHTML = "$" + Tax.toString()
  fshipping.innerHTML = "$" + Shipping.toString()
  ftotal.innerHTML = "$" + Total.toString()
//  p2 = dog[GetProdTLA("b", "dog")][GetWeightTLA("b", "dog")][GetPkgTLA("b", "dog")]
//  p3 = dog[GetProdTLA("c", "dog")][GetWeightTLA("c", "dog")][GetPkgTLA("c", "dog")]
}
function GetProdTLA(formid, species){
  obj2 = eval("f" + species + "p" + formid + ".s" + species + "p" + formid)
  Product = obj2.options[obj2.selectedIndex].text
  Product = Product.toLowerCase()
  return Product.substr(0, 2) + Product.substr(Product.length - 1)
}
function GetWeightTLA(formid, species){
  obj2 = eval("f" + species + "w" + formid + ".s" + species + "w" + formid)
  Weight = obj2.options[obj2.selectedIndex].text
  Weight = Weight.toLowerCase()
  StrStart = Weight.indexOf("(") + 1
  StrEnd = Weight.indexOf(")") - 1
  StrLength = StrEnd - StrStart + 1
  return Weight.substr(StrStart, StrLength)
}
function GetPkgTLA(formid, species){
  obj2 = eval("f" + species + "pk" + formid + ".s" + species + "pk" + formid)
  Pkg = obj2.options[obj2.selectedIndex].text
  StrStart = Pkg.indexOf("of") + 3
  StrEnd = Pkg.length - 1
  StrLength = StrEnd - StrStart + 1
  return Pkg.substr(StrStart, StrLength)
}
//*****************************************************************************************************************
//   Cat starts here
//*****************************************************************************************************************
function FillCatWeight(obj){
  formid = obj.id.substr(obj.id.length - 1);
  window.status = obj.id
//  formid = obj.parentNode.id.substr(obj.parentNode.id.length - 1);
  SelectStr = '<select onChange="FillCatPk(this)" id="scatw' + formid + '"><option> </option></select>'
  Product = obj.options[obj.selectedIndex].text
//  obj2 = eval("form1" + formid + ".select1" + formid)
//  Species = obj2.options[obj2.selectedIndex].text
//  window.status = Product;
  switch (Product){
    case "Advantage":
      SelectStr = '<select onChange="FillCatPk(this)" id="scatw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "sorange">up to 9 lbs (Orange)</option>'
      SelectStr += '<option class = "spurple">over 9 lbs (Purple)</option>'
      SelectStr += '</select>'
   break
   case "Advantage Multi":
      SelectStr = '<select onChange="FillCatPk(this)" id="scatw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "sturquoise">2 - 5 lbs (Turquoise)</option>'
      SelectStr += '<option class = "sorange">5.1 - 9 lbs (Orange)</option>'
      SelectStr += '<option class = "spurple">9.1 - 18 lbs (Purple)</option>'
      SelectStr += '</select>'
	  break
	case "Frontline Plus":
      SelectStr = '<select onChange="FillCatPk(this)" id="scatw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option>(All Weights)</option>'
      SelectStr += '</select>'
	  break
	case "Frontline Top Spot":
      SelectStr = '<select onChange="FillCatPk(this)" id="scatw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option>(All Weights)</option>'
      SelectStr += '</select>'
	  break
	case "Heartguard Plus Chew":
      SelectStr = '<select onChange="FillCatPk(this)" id="scatw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "sred">0 - 5 lbs (Red)</option>'
      SelectStr += '<option class = "spurple">5 - 15 lbs (Purple)</option>'
      SelectStr += '</select>'
	  break
	case "Revolution":
      SelectStr = '<select onChange="FillCatPk(this)" id="scatw' + formid + '">'
      SelectStr += '<option>Choose Weight</option>'
      SelectStr += '<option class = "spink">0 - 5 lbs (Pink)</option>'
      SelectStr += '<option class = "sblue">5 - 10 lbs (Blue)</option>'
      SelectStr += '</select>'
	  break
	default:
  }
//window.status = "fcatw" + formid + ".innerHTML = " + SelectStr
  eval("fcatw" + formid + ".innerHTML = SelectStr")
  SelectStr = '<select onChange="FillCatQty(this)" id="scatpk' + formid + '">'
  SelectStr += '<option>Pkg Size</option>'
  SelectStr += '</select>'
  eval("fcatpk" + formid + ".innerHTML = SelectStr")
  eval("cp" + formid + ".innerHTML = ''")
  GetTotal()
}
function FillCatPk(obj){
  formid = obj.id.substr(obj.id.length - 1);
  SelectStr = '<select id="scatpk' + formid + '"><option> </option></select>'
//  Product = obj.options[obj.selectedIndex].text
  obj2 = eval("fcatp" + formid + ".scatp" + formid)
  Product = obj2.options[obj2.selectedIndex].text
//  window.status = formid;
  switch (Product){
    case "Advantage":
      SelectStr = '<select onChange="FillCatQty(this)" id="scatpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 4</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '</select>'
   break
   case "Advantage Multi":
      SelectStr = '<select onChange="FillCatQty(this)" id="scatpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      if (GetWeightTLA(formid, "cat") == "turquoise"){
        SelectStr += '<option>Pkg of 3</option>'
	  }
	  else{
        SelectStr += '<option>Pkg of 6</option>'
	  }
      SelectStr += '</select>'
	  break
	case "Frontline Plus":
      SelectStr = '<select onChange="FillCatQty(this)" id="scatpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 3</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '</select>'
	  break
	case "Frontline Top Spot":
      SelectStr = '<select onChange="FillCatQty(this)" id="scatpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 3</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '</select>'
	  break
	case "Heartguard Plus Chew":
      SelectStr = '<select onChange="FillCatQty(this)" id="scatpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 6</option>'
      SelectStr += '</select>'
	  break
	case "Revolution":
      SelectStr = '<select onChange="FillCatQty(this)" id="scatpk' + formid + '">'
      SelectStr += '<option>Pkg Size</option>'
      SelectStr += '<option>Pkg of 3</option>'
      if (GetWeightTLA(formid, "cat") != "pink"){
        SelectStr += '<option>Pkg of 6</option>'
	  }
      SelectStr += '</select>'
	  break
	default:
  }
//window.status = "fcatpk" + formid + ".innerHTML = " + SelectStr
  eval("fcatpk" + formid + ".innerHTML = SelectStr")
  eval("cp" + formid + ".innerHTML = ''")
  GetTotal()
}
function FillCatQty(obj){
  formid = obj.id.substr(obj.id.length - 1);
//  window.status = formid
//  window.status = "***" + eval("fdogqty" + formid + ".tdogqty" + formid + ".value");
  if (eval("fcatqty" + formid + ".tcatqty" + formid + ".value") == ""){
    eval("fcatqty" + formid + ".tcatqty" + formid + ".value = 1");
  }
//  window.status = formid
//  window.status = GetProdTLA(formid) 
  species = "cat"
//  window.status = GetProdTLA(formid, species) +  "   " + GetWeightTLA(formid, species) +  "   *" + GetPkgTLA(formid, species) + "*"
  eval("cp" + formid + ".innerHTML = '$' + cat[GetProdTLA(formid, species)][GetWeightTLA(formid, species)][GetPkgTLA(formid, species)]")
  GetTotal()
}
function HideShipping(){
  if (shipornot.box.checked == true){
	shippingdiv.style.visibility = "visible"
  }
  else{
	shippingdiv.style.visibility = "hidden"
  }
}
function HideBilling(){
  if (clientornot.box.checked == true){
	billingdiv.style.visibility = "visible"
	shipornotdiv.style.visibility = "visible"
	ccarddiv.style.visibility = "visible"
	submitorderdiv.style.visibility = "visible"
  }
  else{
	billingdiv.style.visibility = "hidden"
	shipornotdiv.style.visibility = "hidden"
	ccarddiv.style.visibility = "hidden"
	submitorderdiv.style.visibility = "hidden"
  }
}

function MailForm(){
//  str = 'Client Name: ' + client.firstname.value + ' ' + client.lastname.value
  cr = '<br>'
  clinicstr = 'Veterinarian Name: J. Todd Henry, DVM' + cr
  clinicstr += 'Clinic Name: Cypress Creek Animal Hospital&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Acct. Number: 700748' + cr
  clinicstr += 'Account:    Email: prxorders@cypresscreekanimalhospital.com' + cr
  clinicstr += 'Address:  15400 RR 12' + cr
  clinicstr += 'City: Wimberley&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State: TX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Zip: 78676&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
  clinicstr += 'Phone:512-847-5514&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fax:512-847-5294' + cr
  clinicstr += 'Shipping Method: ' + Shipm + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Order Placed by: xxxxxxx' + cr + cr
  
  ccstr = 'Credit Card: '
  ccstr += fccard.ccard.options[fccard.ccard.selectedIndex].text + cr
  ccstr += 'Name on Credit Card: ' + fccard.ccname.value + cr
  ccstr += 'Credit Card Number: ' + fccard.ccnum.value + cr
  ccstr += 'Credit Card Validation code: ' + fccard.ccval.value + cr 
  ccstr += 'Credit Card Expiration Date: ' + fccard.expmonth.options[fccard.expmonth.selectedIndex].text 
  ccstr += '/' + fccard.expyear.options[fccard.expyear.selectedIndex].text + cr + cr
  
  billtitlestr = 'BILLING INFO' + cr + cr
  shiptitlestr = 'SHIPPING INFO' + cr + cr
  billstr = 'Name: ' + client.firstname.value + " " + client.mi.value + " " + client.lastname.value + cr 
  billstr += 'Address: ' + client.address.value + cr 
  if (client.apt.value.length > 0){
	billstr += 'Apt: ' + client.apt.value + cr  
  }
  billstr += client.city.value + ",  " + client.state.value + "  " + client.zip.value + cr 
  billstr += 'Main phone: ' + client.mainphone.value + '  Alt. phone: ' + client.altphone.value + cr + cr
  if (shipornot.box.checked == true){
    shipstr = 'Name: ' + shippinginfo.firstname.value + " " + shippinginfo.mi.value + " " + shippinginfo.lastname.value + cr 
    shipstr += 'Address: ' + shippinginfo.address.value + cr 
    if (shippinginfo.apt.value.length > 0){
      shipstr += 'Apt: ' + shippinginfo.apt.value + cr  
    }
    shipstr += shippinginfo.city.value + ",  " + shippinginfo.state.value + "  " + shippinginfo.zip.value + cr 
    shipstr += 'Main phone: ' + shippinginfo.mainphone.value + '  Alt. phone: ' + shippinginfo.altphone.value + cr + cr
  }
  orderstr = ''
  NumOfProducts = 0
  MissingNames = 0
  for(i=1;i<9;++i){
    if (i < 5){
	  species = 'dog'
	  prefix = 'd'
	  j = i
	}
	else {
	  species = 'cat'
	  prefix = 'c'
	  j = i - 4
	}
    price = eval(prefix + 'p' + product[j] + '.innerHTML')
    if (price.length > 4) {
	  ++NumOfProducts
	  if (i < 5){ orderstr += 'DOG ORDER' + cr + cr}
	  if (i > 4){ orderstr += cr + 'CAT ORDER' + cr + cr}
      orderstr += eval('f' +species+'p'+product[j]+'.s'+species+'p'+ product[j]+'.options[f'+species+'p'+ product[j] +'.s' + species + 'p'+ product[j] +'.selectedIndex].text') + ' - '
	  orderstr += eval('f' +species+'w'+product[j]+'.s'+species+'w'+product[j]+'.options[f'+species+ 'w'+ product[j] +'.s' + species + 'w'+ product[j] +'.selectedIndex].text') + ' - '
	  orderstr += eval('f' +species+'pk'+product[j]+'.s'+species+'pk'+product[j]+'.options[f'+species+'pk'+ product[j]+'.s'+species+'pk'+ product[j] +'.selectedIndex].text') + ' - '
	  orderstr += ' Qty: ' + eval('f' + species + 'qty' + product[j] + '.t' + species + 'qty' + product[j] + '.value') + ' - '
	  orderstr += ' Pet Name: ' + eval('f' + species + 'qty' + product[j] + '.t' + species + 'name' + product[j] + '.value') + ' - '
	  if(eval('f' + species + 'qty' + product[j] + '.t' + species + 'name' + product[j] + '.value') == 'Pet Name'){++MissingNames}
	  if(eval('f' + species + 'qty' + product[j] + '.t' + species + 'name' + product[j] + '.value') == ''){++MissingNames}
	  orderstr += ' Price: ' + price + cr
	  orderstr += ' Directions: xxxxxxx' + cr
	  orderstr += ' Indications: xxxxxxx' + cr
	  orderstr += ' Refills: xxxxxxx' + cr + cr
	  signaturestr = ' Veterinarian Signature: J. Todd Henry&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date: xx-xx-xx' + cr
	  totalstr = 'Subtotal: $' + STotal.toString() + cr
	  totalstr += 'Tax: $' + Tax.toString() + cr
	  totalstr += 'Total: $' + Total.toString()
    }
  }
  if (shipornot.box.checked == true){
	emailstr = clinicstr + shiptitlestr + shipstr + orderstr + signaturestr
	formstr = ccstr + billtitlestr + billstr + shiptitlestr + shipstr + orderstr + totalstr
  }
  else{
	emailstr = clinicstr + shiptitlestr + billstr + orderstr + signaturestr
	formstr = ccstr + billtitlestr + billstr + shiptitlestr + billstr + orderstr + totalstr
  }
  if(FormValidate(NumOfProducts, MissingNames) == 'OK'){
    PHPForm.EmailData.value = emailstr
    PHPForm.FormData.value = formstr 
    PHPForm.ClientName.value = client.lastname.value + ',' + client.firstname.value
    PHPForm.submit()
//  alert(formstr)
  }
}
function FormValidate(NumOfProducts, MissingNames){
  str = ""
  if (fccard.ccard.selectedIndex == 0){ str += 'Please select Type of Credit Card\r\n'}
  if (fccard.ccname.value.length == 0){ str += 'Please enter Name on Credit Card\r\n'}
  if (fccard.ccnum.value.length < 16){ str += 'Please enter correct Credit Card Number\r\n'}
  if (fccard.ccval.value.length < 3){ str += 'Please enter a 3 digit Credit Card Validation Code\r\n'}
  if (client.firstname.value.length == 0){ str += 'Please fill in First Name under Billing Info\r\n'}
  if (client.lastname.value.length == 0){ str += 'Please fill in Last Name under Billing Info\r\n'}
  if (client.address.value.length == 0){ str += 'Please fill in the Address under Billing Info\r\n'}
  if (client.city.value.length == 0){ str += 'Please fill in the City under Billing Info\r\n'}
  if (client.state.value.length == 0){ str += 'Please fill in the State under Billing Info\r\n'}
  if (client.zip.value.length < 5){ str += 'Please fill in the Zip under Billing Info\r\n'}
  if (client.mainphone.value.length < 7){ str += 'Please fill in the Main Phone under Billing Info\r\n'}
  if (shipornot.box.checked == true){
    if (shippinginfo.firstname.value.length == 0){ str += 'Please fill in First Name under Shipping Info\r\n'}
    if (shippinginfo.lastname.value.length == 0){ str += 'Please fill in Last Name under Shipping Info\r\n'}
    if (shippinginfo.address.value.length == 0){ str += 'Please fill in the Address under Shipping Info\r\n'}
    if (shippinginfo.city.value.length == 0){ str += 'Please fill in the City under Shipping Info\r\n'}
    if (shippinginfo.state.value.length == 0){ str += 'Please fill in the State under Shipping Info\r\n'}
    if (shippinginfo.zip.value.length < 5){ str += 'Please fill in the Zip under Shipping Info\r\n'}
    if (shippinginfo.mainphone.value.length < 7){ str += 'Please fill in the Main Phone under Shipping Info\r\n'}
  }
  if (NumOfProducts == 0){str += 'Please select Product, Weight, and Package size'}
  if (MissingNames > 0){str += "Please fill in your Pet's name for each Product Ordered"}
  if (str.length > 0) {
	alert(str)
	valid = 'NotOK'
  }
  else{
	valid = 'OK'  
  }
  return valid
}