function checkQty(form, product_id, checkSelection, attribute) { var qtyStr = form.elements["item_1_quantity"].value; qtyStr = qtyStr.replace(/^\s+|\s+$/g,""); if (qtyStr.length == 0 || isNaN(qtyStr)) { alert("A numeric quantity value must be entered."); return false; } if(checkSelection) { return checkProductSelection(product_id, attribute); } else { return true; } } function checkProductSelection(product_id, attribute) { var attrDropDown = document.getElementById('attributes_' + product_id); var selectedValue = attrDropDown.options[attrDropDown.selectedIndex].value; if(selectedValue == '-1') { alert('You must select a ' + attribute + ' first.'); return false; } return true; } function setPriceInfo(form, product_id) { var attrDropDown = document.getElementById('attributes_' + product_id); var selectedValue = attrDropDown.options[attrDropDown.selectedIndex].value; var selectedText = attrDropDown.options[attrDropDown.selectedIndex].text; var priceHTML; var skuHTML; var skuStockMsgHTML; //alert(selectedValue + ', ' + selectedText); if(selectedValue == '-1') { priceHTML = eval('sku_price_range_' + product_id); skuHTML = 'Item# ' + product_id; skuStockMsgHTML = ''; } else { priceHTML = eval('sku_price_' + product_id + '_' + selectedValue); skuHTML = 'Item# ' + selectedValue; skuStockMsgHTML = eval('sku_stockMsg_' + product_id + '_' + selectedValue); } form.elements["item_1_sku"].value = selectedValue; document.getElementById('skuID_' + product_id).innerHTML = skuHTML; document.getElementById('priceInfo_' + product_id).innerHTML = priceHTML; document.getElementById('stockMsg_' + product_id).innerHTML = skuStockMsgHTML; } function setAccPriceInfo(product_id, attribute) { var attrDropDown = document.getElementById('attributes_' + product_id); var selectedValue = attrDropDown.options[attrDropDown.selectedIndex].value; var selectedText = attrDropDown.options[attrDropDown.selectedIndex].text; var priceHTML; var skuHTML; var skuStockMsgHTML; //alert(selectedValue + ', ' + selectedText); if(selectedValue == '-1') { priceHTML = eval('sku_price_range_' + product_id); skuHTML = 'Item# ' + product_id; skuStockMsgHTML = ''; document.getElementById('accCart_' + product_id).checked = false; document.getElementById('accCart_' + product_id).disabled = true; document.getElementById('prod_access_content_' + product_id).style.backgroundColor = ''; document.getElementById('errorMsg_' + product_id).innerHTML = 'You must select a ' + attribute + ' before adding this item to your cart'; document.getElementById('accCart_' + product_id + '_span').style.outline = ''; } else { priceHTML = eval('sku_price_' + product_id + '_' + selectedValue); skuHTML = 'Item# ' + selectedValue; skuStockMsgHTML = eval('sku_stockMsg_' + product_id + '_' + selectedValue); document.getElementById('accCart_' + product_id).value = selectedValue; document.getElementById('accCart_' + product_id).disabled = false; document.getElementById('errorMsg_' + product_id).innerHTML = ''; if (!isAccCheckboxSelected) { document.getElementById('accCart_' + product_id + '_span').style.outline = '2px solid #FF0000'; } } document.getElementById('skuID_' + product_id).innerHTML = skuHTML; document.getElementById('priceInfo_' + product_id).innerHTML = priceHTML; document.getElementById('stockMsg_' + product_id).innerHTML = skuStockMsgHTML; } function accCheckChanged(product_id) { if (document.getElementById('accCart_' + product_id).checked) { document.getElementById('prod_access_content_' + product_id).style.backgroundColor = '#F9F0CC'; if (!isAccCheckboxSelected) { boxes = document.accessories.addToCart.length; for (i = 0; i < boxes; i++) { id = document.accessories.addToCart[i].id.toString(); document.getElementById(id + '_span').style.outline = ''; } isAccCheckboxSelected = true; } } else { document.getElementById('prod_access_content_' + product_id).style.backgroundColor = ''; } } function famCheckChanged(sku) { if (document.getElementById('famCart_' + sku).checked) { document.getElementById('famCart_content_' + sku).style.backgroundColor = '#F9F0CC'; if (!isFamCheckboxSelected) { boxes = document.famListing.addFamToCart.length; for (i = 0; i < boxes; i++) { id = document.famListing.addFamToCart[i].value.toString(); document.getElementById('famCart_' + id + '_chkbox').style.outline = ''; } isFamCheckboxSelected = true; } } else { document.getElementById('famCart_content_' + sku).style.backgroundColor = ''; } }