/* JS for Checkout */ /* Hides the first, shows the second */ function hideShow(anId, anId2) { e=document.getElementById(anId); if (e != null) { e.className = "hidden"; anId = anId.substring(0, anId.length - 3); e=document.getElementById(anId); if (e != null) { if (anId == "state") { e.value = "--"; } else { //e.value = ""; } } } if (anId2 != "") { e=document.getElementById(anId2); if (e != null) { if (anId != "state") { e.className = "visible"; } else { e.className = "red visible"; } } } } function countryChange() { e=document.getElementById("country"); eS=document.getElementById("state"); eC=document.getElementById("stateCA"); eP=document.getElementById("province"); if (e!= null && eS != null && eC != null && eP != null) { if (e.value == "US") { hideShow("regionTR", "stateTR"); hideShow("regionTR2", "stateTR2"); hideShow("provinceTR", ""); hideShow("provinceTR2", ""); hideShow("regionAst", "stateAst"); hideShow("nonZipCode", "zipCode"); eP.value=""; eC.selectedIndex = 0; } else if (e.value == "CA") { hideShow("regionTR", "provinceTR"); hideShow("regionTR2", "provinceTR2"); hideShow("stateTR", ""); hideShow("stateTR2", ""); hideShow("regionAst", "stateAst"); hideShow("cityAPO", "cityNor"); hideShow("zipCode", "nonZipCode"); eP.value=""; eS.selectedIndex = 0; } else { hideShow("stateTR", "regionTR"); hideShow("stateTR2", "regionTR2"); hideShow("provinceTR", ""); hideShow("provinceTR2", ""); hideShow("stateAst", "regionAst"); hideShow("cityAPO", "cityNor"); hideShow("zipCode", "nonZipCode"); eS.selectedIndex = 0; eC.selectedIndex = 0; } } } function stateChange() { e=document.getElementById("state"); if (e != null) { if (e.value == "AA" || e.value == "AE" || e.value == "AP") { hideShow("cityNor", "cityAPO"); } else { hideShow("cityAPO", "cityNor"); } } } function checkZip() { var ok = true; e=document.getElementById("postalCode"); if (e != null) { e2=document.getElementById("country"); if (e2 != null) { if (e2.value == "CA") { if (e.value.length != 6) { ok = false; } } } } return ok; } // allows 0-9 only function checkForNumericKey(e) { // e is an event if (e != null) { var keynum var keychar var numcheck if(window.event) // IE { keynum = e.keyCode } else if(e.which) // Netscape/Firefox/Opera { keynum = e.which } keychar = String.fromCharCode(keynum) numcheck = /\d/ return numcheck.test(keychar) } } /* Shipping Portion, copied to ensure original not broken */ /* Hides the first, shows the second */ function hideShowS(anId, anId2) { e=document.getElementById(anId); if (e != null) { e.className = "hidden"; anId = anId.substring(0, anId.length - 3); e=document.getElementById(anId); if (e != null) { if (anId == "stateS") { e.value = "--"; } else { //e.value = ""; } } } e=document.getElementById(anId2); if (e != null) { if (anId != "stateS") { e.className = "visible"; } else { e.className = "red visible"; } } } function countryChangeS() { e=document.getElementById("countryS"); eS=document.getElementById("stateS"); eC=document.getElementById("stateCAS"); eP=document.getElementById("provinceS"); if (e!= null && eS != null && eC != null && eP != null) { if (e.value == "US") { hideShowS("regionTRS", "stateTRS"); hideShowS("regionTR2S", "stateTR2S"); hideShowS("provinceTRS", ""); hideShowS("provinceTR2S", ""); hideShowS("regionAstS", "stateAstS"); hideShowS("nonZipCodeS", "zipCodeS"); eP.value=""; eC.selectedIndex = 0; } else if (e.value == "CA") { hideShowS("regionTRS", "provinceTRS"); hideShowS("regionTR2S", "provinceTR2S"); hideShowS("stateTRS", ""); hideShowS("stateTR2S", ""); hideShowS("regionAstS", "stateAstS"); hideShowS("cityAPOS", "cityNorS"); hideShowS("zipCodeS", "nonZipCodeS"); eP.value=""; eS.selectedIndex = 0; } else { hideShowS("stateTRS", "regionTRS"); hideShowS("stateTR2S", "regionTR2S"); hideShowS("provinceTRS", ""); hideShowS("provinceTR2S", ""); hideShowS("stateAstS", "regionAstS"); hideShowS("cityAPOS", "cityNorS"); hideShowS("zipCodeS", "nonZipCodeS"); eS.selectedIndex = 0; eC.selectedIndex = 0; } } } function stateChangeS() { e=document.getElementById("stateS"); if (e != null) { if (e.value == "AA" || e.value == "AE" || e.value == "AP") { hideShowS("cityNorS", "cityAPOS"); } else { hideShowS("cityAPOS", "cityNorS"); } } } function checkZipS() { var ok = true; e=document.getElementById("postalCodeS"); if (e != null) { e2=document.getElementById("countryS"); if (e2 != null) { if (e2.value == "CA") { if (e.value.length != 6) { ok = false; } } } } return ok; } var clickCount = 0; function onlyOneClick() { //if (++clickCount <= 1) { window.open('/receipt.jsp', 'Receipt', 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600') //} }