var aMethods = new Array(); aMethods[1] = new Array(); aMethods[1][0] = new Array(); aMethods[1][0][0] = "2nd Day (UPS or other equivalent carrier)"; aMethods[1][0][1] = "2Day"; aMethods[1][0][2] = "US"; aMethods[1][1] = new Array(); aMethods[1][1][0] = "Next Day (UPS or other equivalent carrier)"; aMethods[1][1][1] = "NextDay"; aMethods[1][1][2] = "US"; aMethods[1][2] = new Array(); aMethods[1][2][0] = "Standard (1 to 6 days approximately)"; aMethods[1][2][1] = "Ground"; aMethods[1][2][2] = "US"; aMethods[1][3] = new Array(); aMethods[1][3][0] = "Standard (1 to 6 days approximately)"; aMethods[1][3][1] = "Standard"; aMethods[1][3][2] = "CA"; aMethods[1][4] = new Array(); aMethods[1][4][0] = "Worldwide Expedited"; aMethods[1][4][1] = "WExpd"; aMethods[1][4][2] = "Other"; aMethods[1][5] = new Array(); aMethods[1][5][0] = "Worldwide Express (fastest)"; aMethods[1][5][1] = "WExpress"; aMethods[1][5][2] = "Other"; aMethods[2] = new Array(); aMethods[2][0] = new Array(); aMethods[2][0][0] = "Ground"; aMethods[2][0][1] = "PARCEL"; aMethods[2][0][2] = "US"; function CopyBilling() { var oCheck = document.getElementById('SameAsBilling'); if (oCheck) { if (oCheck.checked) { document.CheckoutForm.elements['FieldValues[ShippingFirstName]'].value = document.CheckoutForm.elements['FieldValues[BillingFirstName]'].value; document.CheckoutForm.elements['FieldValues[ShippingLastName]'].value = document.CheckoutForm.elements['FieldValues[BillingLastName]'].value; document.CheckoutForm.elements['FieldValues[ShippingAddress1]'].value = document.CheckoutForm.elements['FieldValues[BillingAddress1]'].value; document.CheckoutForm.elements['FieldValues[ShippingAddress2]'].value = document.CheckoutForm.elements['FieldValues[BillingAddress2]'].value; document.CheckoutForm.elements['FieldValues[ShippingCity]'].value = document.CheckoutForm.elements['FieldValues[BillingCity]'].value; document.CheckoutForm.elements["FieldValues[ShippingState]"].selectedIndex = document.CheckoutForm.elements["FieldValues[BillingState]"].selectedIndex; document.CheckoutForm.elements["FieldValues[ShippingProvince]"].value = document.CheckoutForm.elements["FieldValues[BillingProvince]"].value; document.CheckoutForm.elements["FieldValues[ShippingCountry]"].selectedIndex = document.CheckoutForm.elements["FieldValues[BillingCountry]"].selectedIndex; document.CheckoutForm.elements['FieldValues[ShippingZipcode]'].value = document.CheckoutForm.elements['FieldValues[BillingZipcode]'].value; document.CheckoutForm.elements['FieldValues[ShippingPhone]'].value = document.CheckoutForm.elements['FieldValues[BillingPhone]'].value; document.CheckoutForm.elements['FieldValues[ShippingEMailAddress]'].value = document.CheckoutForm.elements['FieldValues[BillingEMailAddress]'].value; SwapShippingMethods(); } } } function CopyCallLetters(sValue) { for (j=0, f=document.forms.length; j0;m--) { oEle.options[m]=null; } } sCountry = oCountry.options[oCountry.selectedIndex].value; var i =0; for (iCnt = 0;iCnt "" && aMethods[iShippingCarrier][iCnt][1] > "") { if (sCountry == 'US' && aMethods[iShippingCarrier][iCnt][2] == 'US') { oEle.options[i] = new Option(aMethods[iShippingCarrier][iCnt][0], aMethods[iShippingCarrier][iCnt][1]); ++i; } else if (sCountry == 'CA' && (aMethods[iShippingCarrier][iCnt][2] == 'CA' || aMethods[iShippingCarrier][iCnt][2] == 'Other')) { oEle.options[i] = new Option(aMethods[iShippingCarrier][iCnt][0], aMethods[iShippingCarrier][iCnt][1]); ++i; } else if ((sCountry != 'CA' && sCountry != 'US') && aMethods[iShippingCarrier][iCnt][2] == 'Other') { oEle.options[i] = new Option(aMethods[iShippingCarrier][iCnt][0], aMethods[iShippingCarrier][iCnt][1]); ++i; } } } if (sCountry == 'US') { oEle.options[2].selected = true; } else if (sCountry == 'CA') { oEle.options[0].selected = true; } StateDisplay(); } } function StateDisplay() { var oBillingState = document.getElementById('BillingState'); var oBillingCountry = document.getElementById('BillingCountry'); var oShippingState = document.getElementById('ShippingState'); var oShippingCountry = document.getElementById('ShippingCountry'); if (oBillingCountry.options[oBillingCountry.selectedIndex].value == 'US') { oBillingState.style.display = ''; } else { oBillingState.style.display = 'none'; } if (oShippingCountry.options[oShippingCountry.selectedIndex].value == 'US') { oShippingState.style.display = ''; } else { oShippingState.style.display = 'none'; } } function DisplayCheckoutLink(bDisplay) { var oLink = document.getElementById('checkoutlink'); if (bDisplay) { oLink.innerHTML = 'Checkout'; } else { oLink.innerHTML = ''; } } function ProductImageSwap(sImage) { var oDiv = document.getElementById('image-container'); if (oDiv) { oDiv.innerHTML = ''; } } function ProductDetails(iProductID) { BuildTable(iProductID, 'p'); } function ProductList(iCategoryID) { BuildTable(iCategoryID, 'c'); } function BuildTable(iID, sIDType) { var currentTime = new Date() var DateTime = currentTime.getTime(); var sPageTitle = 'Product Catalog'; var sURL = "../main/catalog_controller.php?" + sIDType + "=" + iID + "&Now=" + DateTime; xmlhttp = CreateXMLHttp(); if (xmlhttp) { xmlhttp.open("GET", sURL, false); xmlhttp.send(sURL); if (xmlhttp.readyState==4) { UpdateContent(xmlhttp.responseText, sPageTitle); } } } function AddProduct(iProductVarietyID) { var currentTime = new Date() var DateTime = currentTime.getTime(); var sPageTitle = 'Shopping Cart'; var sURL = "../cart/controller.php?Now=" + DateTime; xmlhttp = CreateXMLHttp(); if (xmlhttp) { xmlhttp.open("POST", sURL, false); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=ISO-8859-13'); var sForm = 'AddForm' + iProductVarietyID; var sPostVars = "AddToCart=Y&"; sField = "ProductID" + iProductVarietyID; oEle = document.getElementById(sField); if (oEle) { sPostVars += "FieldValues[ProductID]=" + oEle.value + "&"; sField = "Quantity" + iProductVarietyID; oEle = document.getElementById(sField); if (oEle) { sPostVars += "FieldValues[Quantity]=" + oEle.value + "&"; } sField = "ProductVarietyID" + iProductVarietyID; oEle = document.getElementById(sField); if (oEle) { sPostVars += "FieldValues[ProductVarietyID]=" + oEle.value + "&"; } sField = "CartPrice" + iProductVarietyID; oEle = document.getElementById(sField); if (oEle) { sPostVars += "FieldValues[CartPrice]=" + oEle.value + "&"; } sField = "StationName" + iProductVarietyID; oEle = document.getElementById(sField); if (oEle) { sPostVars += "StationName=" + oEle.value + "&"; } } xmlhttp.send(sPostVars); if (xmlhttp.readyState==4) { UpdateContent(xmlhttp.responseText, sPageTitle); } } } function UpdateCart() { var currentTime = new Date() var DateTime = currentTime.getTime(); var sPageTitle = 'Shopping Cart'; var sURL = "../cart/controller.php?Now=" + DateTime; xmlhttp = CreateXMLHttp(); if (xmlhttp) { xmlhttp.open("POST", sURL, false); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=ISO-8859-13'); var i = 0; var bExists = true; var sPostVars = "Update=Y&"; while (bExists) { sField = "Quantity" + i; oEle = document.getElementById(sField); if (oEle) { sPostVars += oEle.name + "=" + oEle.value + "&"; sField = "RemoveID" + i; oEle = document.getElementById(sField); if (oEle) { if (oEle.checked) { sPostVars += oEle.name + "=" + oEle.value + "&"; } } i += 1; } else { bExists = false; } } xmlhttp.send(sPostVars); if (xmlhttp.readyState==4) { UpdateContent(xmlhttp.responseText, sPageTitle); } } } function CheckoutMisc() { var currentTime = new Date() var DateTime = currentTime.getTime(); var sPageTitle = 'Checkout'; var sURL = "../cart/controller.php?Now=" + DateTime; var oForm = document.forms[0]; xmlhttp = CreateXMLHttp(); if (xmlhttp) { var sPostVars = ""; for (i=0; i < oForm.elements.length; ++i) { if (oForm.elements[i].type == "text" || oForm.elements[i].type == "textarea" || oForm.elements[i].type == "button") { sPostVars += oForm.elements[i].name + "=" + oForm.elements[i].value + "&"; } else if (oForm.elements[i].type == "select-one") { sPostVars += oForm.elements[i].name + "=" + oForm.elements[i].options[oForm.elements[i].selectedIndex].text + "&"; } } xmlhttp.send(sPostVars); if (xmlhttp.readyState==4) { UpdateContent(xmlhttp.responseText, sPageTitle); } } } function StartCheckout() { var currentTime = new Date() var DateTime = currentTime.getTime(); var sPageTitle = 'Checkout'; var sURL = "../cart/controller.php?Now=" + DateTime; xmlhttp = CreateXMLHttp(); if (xmlhttp) { xmlhttp.open("POST", sURL, false); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=ISO-8859-13'); var sPostVars = "Checkout=Y&"; xmlhttp.send(sPostVars); if (xmlhttp.readyState==4) { UpdateContent(xmlhttp.responseText, sPageTitle); } } } function USPSRequest(sURL) { var sReturn = ''; xmlhttp = CreateXMLHttp(); if (xmlhttp) { xmlhttp.open("GET", sURL, false); xmlhttp.send(sURL); if (xmlhttp.readyState==4) { sReturn = xmlhttp.responseText; } } return sReturn; } function CreateXMLHttp() { xmlhttp = false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } return xmlhttp; } function UpdateContent(sContent, sPageTitle) { var oDiv = document.getElementById('content'); oDiv.innerHTML = sContent; var oPageTitle = document.getElementById('pagetitle'); oPageTitle.innerHTML = sPageTitle; oEle = document.getElementById('titlebar'); if (oEle) { oEle.style.display = 'inline'; } }