// Getting the ID value depending on browser type and thier supported methods function getStyleObject(objectId) { if (document.getElementById && document.getElementById(objectId)) { return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) { return document.all(objectId).style; } else if (document.layers && document.layers[objectId]) { return document.layers[objectId]; } else { return false; } } function hidShowRoll(hide_show) { var rollStyle = getStyleObject("roll_table"); if (hide_show == "hide") { rollStyle.visibility = "hidden"; } else if (hide_show == "show") { rollStyle.visibility = "visible"; } } function countInks() { var checkedColors = 0; var colorChoices = document.getElementsByName('1'+'[]'); for (var i = 0; i < colorChoices.length; i++) { if (colorChoices[i].checked == true) { checkedColors++; } } return checkedColors; } // Checks the required form fields for values // Creates alerts and draws a red border around fields not filled out function checkFormFields(form) { // Make sure the error string is empty var i = 0; var error_string = ''; // Get the style info for the required fields and set them to no border var quantityStyle = getStyleObject("quantity_box"); var materialStyle = getStyleObject("material_box"); var sizeShapeStyle = getStyleObject("shape_size_box"); var colorStyle = getStyleObject("colors_table"); var holographStyle = getStyleObject("holograph_table"); var pmsStyle = getStyleObject("pms_box"); // reset the border styles of fields that were corrected quantityStyle.border = "solid white 1px"; materialStyle.border = "solid white 1px"; sizeShapeStyle.border = "solid white 1px"; colorStyle.border = "solid white 1px"; pmsStyle.border = "solid white 1px"; // Make sure that the quantity is a number var split_qty = document.maverick.quantity.value.split('/'); if (split_qty.length == 1) { var quantity = document.maverick.quantity.value.replace(/([^0-9])/g, "") // Check the quantity field if (quantity > 10000) { // Make sure to use the affialtes phone number alert("For quantities over 10,000\nPlease contact a Customer Care Rep\n" + ""); quantityStyle.border = "solid red 1px"; return false; } else if (quantity < 500) { i++; error_string += i + ") Please enter a quantity of at least 500\n"; quantityStyle.border = "solid red 1px"; } } if (document.maverick.material.value == '') { i++; error_string += i + ") Please select a Material\n"; materialStyle.border = "solid red 1px"; } if (document.maverick.square.checked != true && document.maverick.width_and_length.value == '') { i++; error_string += i + ") Please select a size\n"; sizeShapeStyle.border = "solid red 1px"; } if (document.maverick.square.checked == true && (document.maverick.width.value == '' || document.maverick.height.value == '')) { i++; error_string += i + ") Please enter a height and width\n"; sizeShapeStyle.border = "solid red 1px"; } var numberOfHolograms = 0; var len = document.maverick.elements.length; for (var x = 0; x < len; x++) { if (document.maverick.elements[x].name == '12[]' && document.maverick.elements[x].checked == true) { numberOfHolograms++; } } if (numberOfHolograms > 1) { i++; error_string += i + ") You can only select 1 Holographic style\n"; holographStyle.border = "solid red 1px"; } var numberOfInks = countInks(); var pmsOne = document.maverick.pms_one.value.replace(/([^0-9])/g, ""); var pmsTwo = document.maverick.pms_two.value.replace(/([^0-9])/g, ""); var pmsThree = document.maverick.pms_three.value.replace(/([^0-9])/g, ""); if (pmsOne.length > 0 || pmsTwo.length > 0 || pmsThree.length > 0) { var pms_error_string = ''; if (pmsOne.length > 0 && (pmsOne.length > 4 || pmsOne.length < 3)) { pms_error_string = ") PMS colors are 3 or 4 digits\n"; pmsStyle.border = "solid red 1px"; i++; } else if (pmsOne.length > 2 && pmsOne.length < 5) { numberOfInks++; } if (pmsTwo.length > 0 && (pmsTwo.length > 4 || pmsTwo.length < 3)) { pms_error_string = ") PMS colors are 3 or 4 digits\n"; pmsStyle.border = "solid red 1px"; i++; } else if (pmsTwo.length > 2 && pmsTwo.length < 5) { numberOfInks++; } if (pmsThree.length > 0 && (pmsThree.length > 4 || pmsThree.length < 3)) { pms_error_string = ") PMS colors are 3 or 4 digits\n"; pmsStyle.border = "solid red 1px"; i++; } else if (pmsThree.length > 2 && pmsThree.length < 5) { numberOfInks++; } if (pms_error_string != '') { error_string += i + pms_error_string; } } if (numberOfInks > 3) { i++; error_string += i + ") You can only select 3 colors maximum\n"; colorStyle.border = "solid red 1px"; pmsStyle.border = "solid red 1px"; } else if (numberOfInks < 1) { i++; error_string += i + ") You must select at least one color\n\tand/or one PMS color\n"; colorStyle.border = "solid red 1px"; pmsStyle.border = "solid red 1px"; } // If there were any errors, make an alert box and prevent submission if (error_string != "") { var fieldCount; if (i == 1) { fieldCount = "field"; } else { fieldCount = i + " fields"; } alert(error_string + "\nThe error/missing required " + fieldCount + " will be outlined in red"); return false; } } function checkForHolograms() { if (document.maverick.material.value == 1630 || document.maverick.material.value == 1631 || document.maverick.material.value == 1632 || document.maverick.material.value == 1633 || document.maverick.material.value == 1639){ document.maverick.hone.checked = false; document.maverick.htwo.checked = false; document.maverick.hthree.checked = false; document.maverick.hfour.checked = false; document.maverick.hfive.checked = false; document.maverick.hone.disabled = true; document.getElementById('hone').style.visibility = "hidden"; document.getElementById('honeBorder').style.border = "solid gray 1px"; document.maverick.htwo.disabled = true; document.getElementById('htwo').style.visibility = "hidden"; document.getElementById('htwoBorder').style.border = "solid gray 1px"; document.maverick.hthree.disabled = true; document.getElementById('hthree').style.visibility = "hidden"; document.getElementById('hthreeBorder').style.border = "solid gray 1px"; document.maverick.hfour.disabled = true; document.getElementById('hfour').style.visibility = "hidden"; document.getElementById('hfourBorder').style.border = "solid gray 1px"; document.maverick.hfive.disabled = true; document.getElementById('hfive').style.visibility = "hidden"; document.getElementById('hfiveBorder').style.border = "solid gray 1px"; } else { document.maverick.hone.disabled = false; document.getElementById('hone').style.visibility = "visible"; document.getElementById('honeBorder').style.border = "solid white 1px"; document.maverick.htwo.disabled = false; document.getElementById('htwo').style.visibility = "visible"; document.getElementById('htwoBorder').style.border = "solid white 1px"; document.maverick.hthree.disabled = false; document.getElementById('hthree').style.visibility = "visible"; document.getElementById('hthreeBorder').style.border = "solid white 1px"; document.maverick.hfour.disabled = false; document.getElementById('hfour').style.visibility = "visible"; document.getElementById('hfourBorder').style.border = "solid white 1px"; document.maverick.hfive.disabled = false; document.getElementById('hfive').style.visibility = "visible"; document.getElementById('hfiveBorder').style.border = "solid white 1px"; } } function checkForHologramMaterial(formField, fieldValue) { radioHologram = document.getElementById(formField); if (radioHologram.disabled == true) { alert('Oops!\nYou have selected both a holographic foil label material and a holographic foil. Please select one or the other.\n\nOur Suggestions.\n\nWe suggest that you select a holographic foil material with solid ink (up tothree colors) to print your message or images.\n\nOr\n\nUse foil as a printing color on our white vinyl destructible label stock This will let you use the holographic foil just like you would use ink. You can use any one of our holographic foils on our white destructible vinyl.\n\nIf you need additional help, please contact CustomerCare.'); return false; } } function getLabel(n) { var label; if (document.getElementByID) { label = document.getElementByID(n); } else if (document.getElementsByTagName) { var labels = document.getElementsByTagName("label"); var len = labels.length; for (var x=0; x