
var totalNecPrice6;
var totalBraPrice6;
var totalNecPrice4;
var totalBraPrice4;
var totalAnkPrice4;
var totalEarPrice6;
var necLen6;
var braLen6;
var necLen4;
var braLen4;
var ankLen4;
var lengthAdjust = "0.25";
var priceAdjust = "0.5";
 
function getTotal() {
	var pick1 = getGemPrice[stone1];
	var pick2 = getGemPrice[stone2];
	var pick3 = getGemPrice[stone3];

// WHEN  SELECTION HAS NOT BEEN MADE YET
	if ((pick1 == 0) || (pick2 == 0) || (pick3 == 0)) {
		totalNecPrice6 = 0;
		totalBraPrice6 = 0;
    totalNecPrice4 = 0;
    totalBraPrice4 = 0;
    totalAnkPrice4 = 0;
    necLen6 = 0;
    braLen6 = 0;
    necLen4 = 0;
    braLen4 = 0;
    ankLen4 = 0;
	}
	 
// "G" COMBINATIONS
	else if ((pick1 == "G") && (pick2 == "G") && (pick3 == "G")) {
		totalNecPrice6 = price_GGG_nec6mm;
		totalBraPrice6 = price_GGG_bra6mm;
    totalNecPrice4 = price_GGG_nec4mm;
    totalBraPrice4 = price_GGG_bra4mm;
    totalAnkPrice4 = price_GGG_ank4mm;
	}
	else if ((pick1 == "G") && (pick2 == "G") && (pick3 == "R")) {
		totalNecPrice6 = price_GGR_nec6mm;
		totalBraPrice6 = price_GGR_bra6mm;
    totalNecPrice4 = price_GGR_nec4mm;
    totalBraPrice4 = price_GGR_bra4mm;
    totalAnkPrice4 = price_GGR_ank4mm;
	}
	else if ((pick1 == "G") && (pick2 == "G") && (pick3 == "B")) {
		totalNecPrice6 = price_GGB_nec6mm;
		totalBraPrice6 = price_GGB_bra6mm;
    totalNecPrice4 = price_GGB_nec4mm;
    totalBraPrice4 = price_GGB_bra4mm;
    totalAnkPrice4 = price_GGB_ank4mm;
	}
	else if ((pick1 == "G") && (pick2 == "B") && (pick3 == "G")) {
		totalNecPrice6 = price_GBG_nec6mm;
		totalBraPrice6 = price_GBG_bra6mm;
    totalNecPrice4 = price_GBG_nec4mm;
    totalBraPrice4 = price_GBG_bra4mm;
    totalAnkPrice4 = price_GBG_ank4mm;
	}
	else if ((pick1 == "G") && (pick2 == "B") && (pick3 == "R")) {
		totalNecPrice6 = price_GBR_nec6mm;
		totalBraPrice6 = price_GBR_bra6mm;
    totalNecPrice4 = price_GBR_nec4mm;
    totalBraPrice4 = price_GBR_bra4mm;
    totalAnkPrice4 = price_GBR_ank4mm;
	}
	else if ((pick1 == "G") && (pick2 == "B") && (pick3 == "B")) {
		totalNecPrice6 = price_GBB_nec6mm;
		totalBraPrice6 = price_GBB_bra6mm;
    totalNecPrice4 = price_GBB_nec4mm;
    totalBraPrice4 = price_GBB_bra4mm;
    totalAnkPrice4 = price_GBB_ank4mm;
	}
	else if ((pick1 == "G") && (pick2 == "R") && (pick3 == "G")) {
		totalNecPrice6 = price_GRG_nec6mm;
		totalBraPrice6 = price_GRG_bra6mm;
    totalNecPrice4 = price_GRG_nec4mm;
    totalBraPrice4 = price_GRG_bra4mm;
    totalAnkPrice4 = price_GRG_ank4mm;
	}
	else if ((pick1 == "G") && (pick2 == "R") && (pick3 == "R")) {
		totalNecPrice6 = price_GRR_nec6mm;
		totalBraPrice6 = price_GRR_bra6mm;
    totalNecPrice4 = price_GRR_nec4mm;
    totalBraPrice4 = price_GRR_bra4mm;
    totalAnkPrice4 = price_GRR_ank4mm;
	}
	else if ((pick1 == "G") && (pick2 == "R") && (pick3 == "B")) {
		totalNecPrice6 = price_GRB_nec6mm;
		totalBraPrice6 = price_GRB_bra6mm;
    totalNecPrice4 = price_GRB_nec4mm;
    totalBraPrice4 = price_GRB_bra4mm;
    totalAnkPrice4 = price_GRB_ank4mm;
	}

// "B" COMBINATIONS
	else if ((pick1 == "B") && (pick2 == "B") && (pick3 == "B")) {
		totalNecPrice6 = price_BBB_nec6mm;
		totalBraPrice6 = price_BBB_bra6mm;
    totalNecPrice4 = price_BBB_nec4mm;
    totalBraPrice4 = price_BBB_bra4mm;
    totalAnkPrice4 = price_BBB_ank4mm;
	}
	else if ((pick1 == "B") && (pick2 == "B") && (pick3 == "R")) {
		totalNecPrice6 = price_BBR_nec6mm;
		totalBraPrice6 = price_BBR_bra6mm;
    totalNecPrice4 = price_BBR_nec4mm;
    totalBraPrice4 = price_BBR_bra4mm;
    totalAnkPrice4 = price_BBR_ank4mm;
	}
	else if ((pick1 == "B") && (pick2 == "B") && (pick3 == "G")) {
		totalNecPrice6 = price_BBG_nec6mm;
		totalBraPrice6 = price_BBG_bra6mm;
    totalNecPrice4 = price_BBG_nec4mm;
    totalBraPrice4 = price_BBG_bra4mm;
    totalAnkPrice4 = price_BBG_ank4mm;
	}
	else if ((pick1 == "B") && (pick2 == "R") && (pick3 == "B")) {
		totalNecPrice6 = price_BRB_nec6mm;
		totalBraPrice6 = price_BRB_bra6mm;
    totalNecPrice4 = price_BRB_nec4mm;
    totalBraPrice4 = price_BRB_bra4mm;
    totalAnkPrice4 = price_BRB_ank4mm;
	}
	else if ((pick1 == "B") && (pick2 == "R") && (pick3 == "R")) {
		totalNecPrice6 = price_BRR_nec6mm;
		totalBraPrice6 = price_BRR_bra6mm;
    totalNecPrice4 = price_BRR_nec4mm;
    totalBraPrice4 = price_BRR_bra4mm;
    totalAnkPrice4 = price_BRR_ank4mm;
	}
	else if ((pick1 == "B") && (pick2 == "R") && (pick3 == "G")) {
		totalNecPrice6 = price_BRG_nec6mm;
		totalBraPrice6 = price_BRG_bra6mm;
    totalNecPrice4 = price_BRG_nec4mm;
    totalBraPrice4 = price_BRG_bra4mm;
    totalAnkPrice4 = price_BRG_ank4mm;
	}
	else if ((pick1 == "B") && (pick2 == "G") && (pick3 == "B")) {
		totalNecPrice6 = price_BBG_nec6mm;
		totalBraPrice6 = price_BBG_bra6mm;
    totalNecPrice4 = price_BBG_nec4mm;
    totalBraPrice4 = price_BBG_bra4mm;
    totalAnkPrice4 = price_BBG_ank4mm;
	}
	else if ((pick1 == "B") && (pick2 == "G") && (pick3 == "R")) {
		totalNecPrice6 = price_BGR_nec6mm;
		totalBraPrice6 = price_BGR_bra6mm;
    totalNecPrice4 = price_BGR_nec4mm;
    totalBraPrice4 = price_BGR_bra4mm;
    totalAnkPrice4 = price_BGR_ank4mm;
	}
	else if ((pick1 == "B") && (pick2 == "G") && (pick3 == "G")) {
		totalNecPrice6 = price_BGG_nec6mm;
		totalBraPrice6 = price_BGG_bra6mm;
    totalNecPrice4 = price_BGG_nec4mm;
    totalBraPrice4 = price_BGG_bra4mm;
    totalAnkPrice4 = price_BGG_ank4mm;
	}

// "R" COMBINATIONS
	else if ((pick1 == "R") && (pick2 == "R") && (pick3 == "R")) {
		totalNecPrice6 = price_RRR_nec6mm;
		totalBraPrice6 = price_RRR_bra6mm;
    totalNecPrice4 = price_RRR_nec4mm;
    totalBraPrice4 = price_RRR_bra4mm;
    totalAnkPrice4 = price_RRR_ank4mm;
	}
	else if ((pick1 == "R") && (pick2 == "R") && (pick3 == "B")) {
		totalNecPrice6 = price_RRB_nec6mm;
		totalBraPrice6 = price_RRB_bra6mm;
    totalNecPrice4 = price_RRB_nec4mm;
    totalBraPrice4 = price_RRB_bra4mm;
    totalAnkPrice4 = price_RRB_ank4mm;
	}
	else if ((pick1 == "R") && (pick2 == "R") && (pick3 == "G")) {
		totalNecPrice6 = price_RRG_nec6mm;
		totalBraPrice6 = price_RRG_bra6mm;
    totalNecPrice4 = price_RRG_nec4mm;
    totalBraPrice4 = price_RRG_bra4mm;
    totalAnkPrice4 = price_RRG_ank4mm;
	}
	else if ((pick1 == "R") && (pick2 == "B") && (pick3 == "R")) {
		totalNecPrice6 = price_RBR_nec6mm;
		totalBraPrice6 = price_RBR_bra6mm;
    totalNecPrice4 = price_RBR_nec4mm;
    totalBraPrice4 = price_RBR_bra4mm;
    totalAnkPrice4 = price_RBR_ank4mm;
	}
	else if ((pick1 == "R") && (pick2 == "B") && (pick3 == "B")) {
		totalNecPrice6 = price_RBB_nec6mm;
		totalBraPrice6 = price_RBB_bra6mm;
    totalNecPrice4 = price_RBB_nec4mm;
    totalBraPrice4 = price_RBB_bra4mm;
    totalAnkPrice4 = price_RBB_ank4mm;
	}
	else if ((pick1 == "R") && (pick2 == "B") && (pick3 == "G")) {
		totalNecPrice6 = price_RBG_nec6mm;
		totalBraPrice6 = price_RBG_bra6mm;
    totalNecPrice4 = price_RBG_nec4mm;
    totalBraPrice4 = price_RBG_bra4mm;
    totalAnkPrice4 = price_RBG_ank4mm;
	}
	else if ((pick1 == "R") && (pick2 == "G") && (pick3 == "R")) {
		totalNecPrice6 = price_GRR_nec6mm;
		totalBraPrice6 = price_GRR_bra6mm;
    totalNecPrice4 = price_GRR_nec4mm;
    totalBraPrice4 = price_GRR_bra4mm;
    totalAnkPrice4 = price_GRR_ank4mm;
	}	
	else if ((pick1 == "R") && (pick2 == "G") && (pick3 == "B")) {
		totalNecPrice6 = price_GBR_nec6mm;
		totalBraPrice6 = price_GBR_bra6mm;
    totalNecPrice4 = price_GBR_nec4mm;
    totalBraPrice4 = price_GBR_bra4mm;
    totalAnkPrice4 = price_GBR_ank4mm;
	}
	else if ((pick1 == "R") && (pick2 == "G") && (pick3 == "G")) {
		totalNecPrice6 = price_RGG_nec6mm;
		totalBraPrice6 = price_RGG_bra6mm;
    totalNecPrice4 = price_RGG_nec4mm;
    totalBraPrice4 = price_RGG_bra4mm;
    totalAnkPrice4 = price_RGG_ank4mm;
	}
	
	window.document.nec6.necPrice6.value = totalNecPrice6;
  document.getElementById("necPrice6").innerHTML = totalNecPrice6;
	window.document.bra6.braPrice6.value = totalBraPrice6;
  document.getElementById("braPrice6").innerHTML = totalBraPrice6;
	window.document.nec4.necPrice4.value = totalNecPrice4;
  document.getElementById("necPrice4").innerHTML = totalNecPrice4;
	window.document.bra4.braPrice4.value = totalBraPrice4;
  document.getElementById("braPrice4").innerHTML = totalBraPrice4;
  window.document.ank4.ankPrice4.value = totalAnkPrice4;
  document.getElementById("ankPrice4").innerHTML = totalAnkPrice4;
  window.document.nec6.necLen6.value = 16;
  document.getElementById("necLen6").innerHTML = 16;
  window.document.bra6.braLen6.value = 7;
  document.getElementById("braLen6").innerHTML = 7;
  window.document.nec4.necLen4.value = 16;
  document.getElementById("necLen4").innerHTML = 16;
  window.document.bra4.braLen4.value = 7;
  document.getElementById("braLen4").innerHTML = 7;
  window.document.ank4.ankLen4.value = 9;
  document.getElementById("ankLen4").innerHTML = 9;

  if (pick1 != 0 && pick2 != 0 && pick3 != 0) {
    updateNec6PaymentButton();
    updateNec4PaymentButton();
    updateBra6PaymentButton();
    updateBra4PaymentButton();
    updateAnk4PaymentButton();
  }
}

function getTotalEar() {
	var pick4 = getGemPrice[stone4];

// WHEN  SELECTION HAS NOT BEEN MADE YET
	if (pick4 == 0) {
    totalEarPrice6 = 0;
	}	else if (pick4 == "G") {
    totalEarPrice6 = price_G_ear6mm;
	} else if (pick4 == "B") {
    totalEarPrice6 = price_B_ear6mm;
  } else if (pick4 == "R") {
    totalEarPrice6 = price_R_ear6mm;
  }
  window.document.ear6.earPrice6.value = totalEarPrice6;
  document.getElementById("earPrice6").innerHTML = totalEarPrice6;
  if (pick4 != 0) {
    updateEar6PaymentButton();
  }
}

function defExampleGem1() {
	var def1 = "images/select1.jpg";
  document.stone1.src = def1;
  document.gemForm.gem1.options.value = 0;
  document.gemForm.gem2.options.value = 0;
  document.gemForm.gem3.options.value = 0;
  document.nec6.spacer.checked = false;
  document.nec4.spacer.checked = false;
  document.ank4.spacer.checked = false;
  document.bra6.spacer.checked = false;
  document.bra6.spacer.checked = false;
  document.nec6.necPrice6.value = 0;
  document.nec4.necPrice4.value = 0;
  document.ank4.ankPrice4.value = 0;
  document.bra6.braPrice6.value = 0;
  document.bra4.braPrice4.value = 0;
  document.nec6.necLen6.value = 16;
  document.nec4.necLen4.value = 16;
  document.ank4.ankLen4.value = 9;
  document.bra6.braLen6.value = 7;
  document.bra4.braLen4.value = 7;
}

function showExampleGem1(imageNum) {
  var gemLoc = "stones/" + gemName[imageNum] + ".jpg";
  var smallLoc = "stones/" + gemName[imageNum] + "_sm.jpg";
  document.stone1.src = gemLoc;
  document.sstone1.src = smallLoc;
  document.sstone4.src = smallLoc;
  document.sstone7.src = smallLoc;
  document.sstone10.src = smallLoc;
  document.sstone13.src = smallLoc;
  document.sstone16.src = smallLoc;
  document.sstone19.src = smallLoc;
  document.sstone22.src = smallLoc;
  document.sstone25.src = smallLoc;
  document.sstone28.src = smallLoc;
  document.sstone31.src = smallLoc;
  document.sstone34.src = smallLoc;
  document.sstone37.src = smallLoc;
  document.sstone40.src = smallLoc;
  document.sstone43.src = smallLoc;
}

function defExampleGem2() {
	var def2 = "images/select2.jpg";
  document.stone2.src = def2;
  document.gemForm.gem1.options.value = 0;
  document.gemForm.gem2.options.value = 0;
  document.gemForm.gem3.options.value = 0;
  document.nec6.spacer.checked = false;
  document.nec4.spacer.checked = false;
  document.ank4.spacer.checked = false;
  document.bra6.spacer.checked = false;
  document.bra6.spacer.checked = false;
  document.nec6.necPrice6.value = 0;
  document.nec4.necPrice4.value = 0;
  document.ank4.ankPrice4.value = 0;
  document.bra6.braPrice6.value = 0;
  document.bra4.braPrice4.value = 0;
  document.nec6.necLen6.value = 16;
  document.nec4.necLen4.value = 16;
  document.ank4.ankLen4.value = 9;
  document.bra6.braLen6.value = 7;
  document.bra4.braLen4.value = 7;
}

function showExampleGem2(imageNum) {
  var gemLoc = "stones/" + gemName[imageNum] + ".jpg";
  var smallLoc = "stones/" + gemName[imageNum] + "_sm.jpg";
  document.stone2.src = gemLoc;
  document.sstone2.src = smallLoc;
  document.sstone5.src = smallLoc;
  document.sstone8.src = smallLoc;
  document.sstone11.src = smallLoc;
  document.sstone14.src = smallLoc;
  document.sstone17.src = smallLoc;
  document.sstone20.src = smallLoc;
  document.sstone23.src = smallLoc;
  document.sstone26.src = smallLoc;
  document.sstone29.src = smallLoc;
  document.sstone32.src = smallLoc;
  document.sstone35.src = smallLoc;
  document.sstone38.src = smallLoc;
  document.sstone41.src = smallLoc;
  document.sstone44.src = smallLoc;
}

function defExampleGem3() {
	var def3 = "images/select3.jpg";
  document.stone3.src = def3;
  document.gemForm.gem1.options.value = 0;
  document.gemForm.gem2.options.value = 0;
  document.gemForm.gem3.options.value = 0;
  document.nec6.spacer.checked = false;
  document.nec4.spacer.checked = false;
  document.ank4.spacer.checked = false;
  document.bra6.spacer.checked = false;
  document.bra6.spacer.checked = false;
  document.nec6.necPrice6.value = 0;
  document.nec4.necPrice4.value = 0;
  document.ank4.ankPrice4.value = 0;
  document.bra6.braPrice6.value = 0;
  document.bra4.braPrice4.value = 0;
  document.nec6.necLen6.value = 16;
  document.nec4.necLen4.value = 16;
  document.ank4.ankLen4.value = 9;
  document.bra6.braLen6.value = 7;
  document.bra4.braLen4.value = 7;
}

function showExampleGem3(imageNum) {
  var gemLoc = "stones/" + gemName[imageNum] + ".jpg";
  var smallLoc = "stones/" + gemName[imageNum] + "_sm.jpg";
  document.stone3.src = gemLoc;
  document.sstone3.src = smallLoc;
  document.sstone6.src = smallLoc;
  document.sstone9.src = smallLoc;
  document.sstone12.src = smallLoc;
  document.sstone15.src = smallLoc;
  document.sstone18.src = smallLoc;
  document.sstone21.src = smallLoc;
  document.sstone24.src = smallLoc;
  document.sstone27.src = smallLoc;
  document.sstone30.src = smallLoc;
  document.sstone33.src = smallLoc;
  document.sstone36.src = smallLoc;
  document.sstone39.src = smallLoc;
  document.sstone42.src = smallLoc;
  document.sstone45.src = smallLoc;
}

function defExampleGem4() {
	var def4 = "images/select4.jpg";
  document.stone4.src = def4;
  document.gemForm.gem4.options.value = 0;
  document.ear6.earPrice6.value = 0;
}

function showExampleGem4(imageNum) {
  var gemLoc = "stones/" + gemName[imageNum] + ".jpg";
  var smallLoc = "stones/" + gemName[imageNum] + "_sm.jpg";
  document.stone4.src = gemLoc;
  document.sstone46.src = smallLoc;
}

function adjNec6(len,pri,op) {
  var nLen = len;
  var nPri = pri;
  var oper = op;
  var nec6min = 13;
  var nec6max = 30;
  if (document.nec6.necPrice6.value == 0) {
    alert("Please select your stones before adjusting the length of the strand.");
  } else {
    if (oper == "sub" && document.nec6.necLen6.value > nec6min) {
      nLen = eval(nLen) - eval(lengthAdjust);
      nPri = eval(nPri) - eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }
    if (oper == "add" && document.nec6.necLen6.value < nec6max) {
      nLen = eval(nLen) + eval(lengthAdjust);
      nPri = eval(nPri) + eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }      
    document.nec6.necLen6.value = nLen;
    document.getElementById("necLen6").innerHTML = nLen;
    document.nec6.necPrice6.value = nPri;
    document.getElementById("necPrice6").innerHTML = nPri;
  }
  updateNec6PaymentButton();
}

function adjNec4(len,pri,op) {
  var nLen = len;
  var nPri = pri;
  var oper = op;
  var nec4min = 13;
  var nec4max = 30;
  if (document.nec4.necPrice4.value == 0) {
    alert("Please select your stones before adjusting the length of the strand.");
  } else {
    if (oper == "sub" && document.nec4.necLen4.value > nec4min) {
      nLen = eval(nLen) - eval(lengthAdjust);
      nPri = eval(nPri) - eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }
    if (oper == "add" && document.nec4.necLen4.value < nec4max) {
      nLen = eval(nLen) + eval(lengthAdjust);
      nPri = eval(nPri) + eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }      
    document.nec4.necLen4.value = nLen;
    document.getElementById("necLen4").innerHTML = nLen;
    document.nec4.necPrice4.value = nPri;
    document.getElementById("necPrice4").innerHTML = nPri;
  }
  updateNec4PaymentButton();
}

function adjBra6(len,pri,op) {
  var nLen = len;
  var nPri = pri;
  var oper = op;
  var bra6min = 5;
  var bra6max = 9;
  if (document.bra6.braPrice6.value == 0) {
    alert("Please select your stones before adjusting the length of the strand.");
  } else {
    if (oper == "sub" && document.bra6.braLen6.value > bra6min) {
      nLen = eval(nLen) - eval(lengthAdjust);
      nPri = eval(nPri) - eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }
    if (oper == "add" && document.bra6.braLen6.value < bra6max) {
      nLen = eval(nLen) + eval(lengthAdjust);
      nPri = eval(nPri) + eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }      
    document.bra6.braLen6.value = nLen;
    document.getElementById("braLen6").innerHTML = nLen;
    document.bra6.braPrice6.value = nPri;
    document.getElementById("braPrice6").innerHTML = nPri;
  }
  updateBra6PaymentButton();
}

function adjBra4(len,pri,op) {
  var nLen = len;
  var nPri = pri;
  var oper = op;
  var bra4min = 5;
  var bra4max = 9;
  if (document.bra4.braPrice4.value == 0) {
    alert("Please select your stones before adjusting the length of the strand.");
  } else {
    if (oper == "sub" && document.bra4.braLen4.value > bra4min) {
      nLen = eval(nLen) - eval(lengthAdjust);
      nPri = eval(nPri) - eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }
    if (oper == "add" && document.bra4.braLen4.value < bra4max) {
      nLen = eval(nLen) + eval(lengthAdjust);
      nPri = eval(nPri) + eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }      
    document.bra4.braLen4.value = nLen;
    document.getElementById("braLen4").innerHTML = nLen;
    document.bra4.braPrice4.value = nPri;
    document.getElementById("braPrice4").innerHTML = nPri;
  }
  updateBra4PaymentButton();
}

function adjAnk4(len,pri,op) {
  var nLen = len;
  var nPri = pri;
  var oper = op;
  var ank4min = 7;
  var ank4max = 13;
  if (document.ank4.ankPrice4.value == 0) {
    alert("Please select your stones before adjusting the length of the strand.");
  } else {
    if (oper == "sub" && document.ank4.ankLen4.value > ank4min) {
      nLen = eval(nLen) - eval(lengthAdjust);
      nPri = eval(nPri) - eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }
    if (oper == "add" && document.ank4.ankLen4.value < ank4max) {
      nLen = eval(nLen) + eval(lengthAdjust);
      nPri = eval(nPri) + eval(priceAdjust);
      nPri += '';
      if (nPri.length == 4) {
        nPri = nPri + "0";
      }
    }      
    document.ank4.ankLen4.value = nLen;
    document.getElementById("ankLen4").innerHTML = nLen;
    document.ank4.ankPrice4.value = nPri;
    document.getElementById("ankPrice4").innerHTML = nPri;
  }
  updateAnk4PaymentButton();
}

function updateNec6PaymentButton() {
  getVars();
  var name1 = gemName[stone1];
  var name2 = gemName[stone2];
  var name3 = gemName[stone3];
  var spacer = "";

  var amount_nec6 = window.document.nec6.necPrice6.value;
  var length_nec6 = window.document.nec6.necLen6.value + "in.";
  var itemType_nec6 = "Necklace";
  var itemSize_nec6 = "6mm";
  if (window.document.nec6.spacer.checked) {
    var finalDesign_nec6 = name1+", "+name2+", "+name3 + " w/spacer";
  } else {
    var finalDesign_nec6 = name1+", "+name2+", "+name3;
  }
  if (amount_nec6 == 0) {
    alert("Before clicking the 'Add to Cart' button you must:\n\n1. Select your gemstones.\n2. Adjust length if necessary.\n3. Select spacer if desired.\n\nOnce you've completed a design, then click the 'Add to Cart' button.");
  } else {
    document.getElementById("purchaseButton_nec6").innerHTML = "<a href=\"javascript:void(0)\" onclick=\"window.open('https://www.paypal.com/cart/add=1&amp;business=blackmtn%40xmission.com&amp;item_name=Custom%20Design:%20+"+length_nec6+"+"+itemType_nec6+"+"+itemSize_nec6+"+"+finalDesign_nec6+"&amp;amount="+amount_nec6+"&amp;return=http%3A//www.blackmountainbead.com&amp;cancel_return=http%3A//www.blackmountainbead.com','cartwin','width=750,height=560')\"><img src=\"https://www.paypal.com//en_US/i/btn/x-click-but22.gif\" border=\"0\" width=\"87\" height=\"23\" alt=\"PayPal\"></a>";
  }
}

function updateNec4PaymentButton() {
  getVars();
  var name1 = gemName[stone1];
  var name2 = gemName[stone2];
  var name3 = gemName[stone3];
  var spacer = "";

  var amount_nec4 = window.document.nec4.necPrice4.value;
  var length_nec4 = window.document.nec4.necLen4.value + "in.";
  var itemType_nec4 = "Necklace";
  var itemSize_nec4 = "4mm";
  if (window.document.nec4.spacer.checked) {
    var finalDesign_nec4 = name1 + " w/spacer";
  } else {
    var finalDesign_nec4 = name1+", "+name2+", "+name3;
  }
  if (amount_nec4 == 0) {
    alert("Before clicking the 'Add to Cart' button you must:\n\n1. Select your gemstones.\n2. Adjust length if necessary.\n3. Select spacer if desired.\n\nOnce you've completed a design, then click the 'Add to Cart' button.");
  } else {
    document.getElementById("purchaseButton_nec4").innerHTML = "<a href=\"javascript:void(0)\" onclick=\"window.open('https://www.paypal.com/cart/add=1&amp;business=blackmtn%40xmission.com&amp;item_name=Custom%20Design:%20+"+length_nec4+"+"+itemType_nec4+"+"+itemSize_nec4+"+"+finalDesign_nec4+"&amp;amount="+amount_nec4+"&amp;return=http%3A//www.blackmountainbead.com&amp;cancel_return=http%3A//www.blackmountainbead.com','cartwin','width=750,height=560')\"><img src=\"https://www.paypal.com//en_US/i/btn/x-click-but22.gif\" border=\"0\" width=\"87\" height=\"23\" alt=\"PayPal\"></a>";
  }
}

function updateBra6PaymentButton() {
  getVars();
  var name1 = gemName[stone1];
  var name2 = gemName[stone2];
  var name3 = gemName[stone3];
  var spacer = "";

  var amount_bra6 = window.document.bra6.braPrice6.value;
  var length_bra6 = window.document.bra6.braLen6.value + "in.";
  var itemType_bra6 = "Bracelet";
  var itemSize_bra6 = "6mm";
  if (window.document.bra6.spacer.checked) {
    var finalDesign_bra6 = name1+", "+name2+", "+name3 + " w/spacer";
  } else {
    var finalDesign_bra6 = name1+", "+name2+", "+name3;
  }
  if (amount_bra6 == 0) {
    alert("Before clicking the 'Add to Cart' button you must:\n\n1. Select your gemstones.\n2. Adjust length if necessary.\n3. Select spacer if desired.\n\nOnce you've completed a design, then click the 'Add to Cart' button.");
  } else {
    document.getElementById("purchaseButton_bra6").innerHTML = "<a href=\"javascript:void(0)\" onclick=\"window.open('https://www.paypal.com/cart/add=1&amp;business=blackmtn%40xmission.com&amp;item_name=Custom%20Design:%20+"+length_bra6+"+"+itemType_bra6+"+"+itemSize_bra6+"+"+finalDesign_bra6+"&amp;amount="+amount_bra6+"&amp;return=http%3A//www.blackmountainbead.com&amp;cancel_return=http%3A//www.blackmountainbead.com','cartwin','width=750,height=560')\"><img src=\"https://www.paypal.com//en_US/i/btn/x-click-but22.gif\" border=\"0\" width=\"87\" height=\"23\" alt=\"PayPal\"></a>";
  }
}

function updateBra4PaymentButton() {
  getVars();
  var name1 = gemName[stone1];
  var name2 = gemName[stone2];
  var name3 = gemName[stone3];
  var spacer = "";

  var amount_bra4 = window.document.bra4.braPrice4.value;
  var length_bra4 = window.document.bra4.braLen4.value + "in.";
  var itemType_bra4 = "Bracelet";
  var itemSize_bra4 = "4mm";
  if (window.document.bra4.spacer.checked) {
    var finalDesign_bra4 = name1+", "+name2+", "+name3 + " w/spacer";
  } else {
    var finalDesign_bra4 = name1+", "+name2+", "+name3;
  }
  if (amount_bra4 == 0) {
    alert("Before clicking the 'Add to Cart' button you must:\n\n1. Select your gemstones.\n2. Adjust length if necessary.\n3. Select spacer if desired.\n\nOnce you've completed a design, then click the 'Add to Cart' button.");
  } else {
    document.getElementById("purchaseButton_bra4").innerHTML = "<a href=\"javascript:void(0)\" onclick=\"window.open('https://www.paypal.com/cart/add=1&amp;business=blackmtn%40xmission.com&amp;item_name=Custom%20Design:%20+"+length_bra4+"+"+itemType_bra4+"+"+itemSize_bra4+"+"+finalDesign_bra4+"&amp;amount="+amount_bra4+"&amp;return=http%3A//www.blackmountainbead.com&amp;cancel_return=http%3A//www.blackmountainbead.com','cartwin','width=750,height=560')\"><img src=\"https://www.paypal.com//en_US/i/btn/x-click-but22.gif\" border=\"0\" width=\"87\" height=\"23\" alt=\"PayPal\"></a>";
  }
}

function updateAnk4PaymentButton() {
  getVars();
  var name1 = gemName[stone1];
  var name2 = gemName[stone2];
  var name3 = gemName[stone3];
  var spacer = "";

  var amount_ank4 = window.document.ank4.ankPrice4.value;
  var length_ank4 = window.document.ank4.ankLen4.value + "in.";
  var itemType_ank4 = "Anklet";
  var itemSize_ank4 = "4mm";
  if (window.document.ank4.spacer.checked) {
    var finalDesign_ank4 = name1+", "+name2+", "+name3 + " w/spacer";
  } else {
    var finalDesign_ank4 = name1+", "+name2+", "+name3;
  }
  if (amount_ank4 == 0) {
    alert("Before clicking the 'Add to Cart' button you must:\n\n1. Select your gemstones.\n2. Adjust length if necessary.\n3. Select spacer if desired.\n\nOnce you've completed a design, then click the 'Add to Cart' button.");
  } else {
    document.getElementById("purchaseButton_ank4").innerHTML = "<a href=\"javascript:void(0)\" onclick=\"window.open('https://www.paypal.com/cart/add=1&amp;business=blackmtn%40xmission.com&amp;item_name=Custom%20Design:%20+"+length_ank4+"+"+itemType_ank4+"+"+itemSize_ank4+"+"+finalDesign_ank4+"&amp;amount="+amount_ank4+"&amp;return=http%3A//www.blackmountainbead.com&amp;cancel_return=http%3A//www.blackmountainbead.com','cartwin','width=750,height=560')\"><img src=\"https://www.paypal.com//en_US/i/btn/x-click-but22.gif\" border=\"0\" width=\"87\" height=\"23\" alt=\"PayPal\"></a>";
  }
}

function updateEar6PaymentButton() {
  getVars();
  var name4 = gemName[stone4];

  var amount_ear6 = window.document.ear6.earPrice6.value;
  var itemType_ear6 = "Earring";
  var itemSize_ear6 = "6mm";
  var finalDesign_ear6 = name4;

  if (amount_ear6 == 0) {
    alert("Before clicking the 'Add to Cart' button you must:\n\n1. Select your gemstones.\n2. Adjust length if necessary.\n3. Select spacer if desired.\n\nOnce you've completed a design, then click the 'Add to Cart' button.");
  } else {
    document.getElementById("purchaseButton_ear6").innerHTML = "<a href=\"javascript:void(0)\" onclick=\"window.open('https://www.paypal.com/cart/add=1&amp;business=blackmtn%40xmission.com&amp;item_name=Custom%20Design:%20+"+itemType_ear6+"+"+itemSize_ear6+"+"+finalDesign_ear6+"&amp;amount="+amount_ear6+"&amp;return=http%3A//www.blackmountainbead.com&amp;cancel_return=http%3A//www.blackmountainbead.com','cartwin','width=750,height=560')\"><img src=\"https://www.paypal.com//en_US/i/btn/x-click-but22.gif\" border=\"0\" width=\"87\" height=\"23\" alt=\"PayPal\"></a>";
  }
}

var stone1, stone2, stone3, stone4;

function getVars() {
	stone1 = window.document.gemForm.gem1.options[window.document.gemForm.gem1.selectedIndex].value;
	stone2 = window.document.gemForm.gem2.options[window.document.gemForm.gem2.selectedIndex].value;
	stone3 = window.document.gemForm.gem3.options[window.document.gemForm.gem3.selectedIndex].value;
	stone4 = window.document.gemForm.gem4.options[window.document.gemForm.gem4.selectedIndex].value;
}

function changeCombo1() {
	getVars();
	getTotal();
	showExampleGem1(stone1);
}

function changeCombo1a() {
	getVars();
	getTotal();
	showExampleGem2(stone2);
}

function changeCombo2() {
	getVars();
	getTotal();
	showExampleGem3(stone3);
}

function changeEarring() {
	getVars();
	getTotalEar();
	showExampleGem4(stone4);
}

function start() {
	isLoaded = true;
	startup();
}

winLoaded = false;

function startup() {
	winLoaded = true;
	defExampleGem1();
	defExampleGem2();
	defExampleGem3();
	defExampleGem4();
}
