var arrFound = new Array(); var curCheck = new Array(); var minPrice = -1; var maxPrice = -1; var minMSRP = -1; var maxMSRP = -1; var mousex = mousey = 0; var algor = 0; var xMulti = yMulti = 0; var largeImgBoxWidth = largeImgBoxHeight = 660; var optLrg, zoomHideTimeout, imgPos, reqOpt, checkCnt, arrHidden, hideCnt, isFound, showZT, imgPos; var debug = ""; var divPos = null; var strHost = location.hostname.toLowerCase(); if (strHost.indexOf("atgstores") < 0) { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf("/") + 1); if (sPage.toLowerCase() != "view.aspx" && sPage.indexOf(".html") < 2 && strHost.indexOf("kitchens") < 0 && strHost.indexOf("ibaths") < 0 && strHost.indexOf("homesavvi") < 0) { strHost = "www.atgstores.com" } else { strHost = strHost.replace("www.", "").replace("development.", "").replace(".com", ".ATGStores.com") } } function timeLeft() { if (shipTimeCutOff != "") { msPerDay = 24 * 60 * 60 * 1000; var B = new Date(); var A = new Date(B.getMonth() + "/" + B.getDay() + "/" + B.getYear() + " " + shipTimeCutOff); var C = (B.getTimezoneOffset() / 60) + 1; var D = ((A.getTime() + (8 * 60 * 60 * 1000)) - (B.getTime() + (C * 60 * 60 * 1000))); e_daysLeft = D / msPerDay; daysLeft = Math.floor(e_daysLeft); e_hrsLeft = (e_daysLeft - daysLeft) * 24; hrsLeft = Math.floor(e_hrsLeft); e_minsLeft = (e_hrsLeft - hrsLeft) * 60; minsLeft = Math.floor((e_hrsLeft - hrsLeft) * 60); secLeft = Math.floor((e_minsLeft - minsLeft) * 60); document.getElementById("timeLeft").style.display = "block"; if ((hrsLeft + minsLeft + secLeft) > 0 && hrsLeft < 12) { document.getElementById("timeLeft").innerHTML = '<span style="font-weight:normal;font-size:8pt;">Order in ' + hrsLeft + "h " + minsLeft + "m " + secLeft + "s to have it ship today</span>"; setTimeout("timeLeft()", 1000) } else { document.getElementById("timeLeft").innerHTML = '<span style="font-weight:normal;font-size:8pt;">Order before ' + shipTimeCutOff + "AM PST to have it ship tomorrow</span>" } } } timeLeft(); if (readQuery("searchTerm") != null) { addLoadEvent(function () { multiHi(unescape(readQuery("searchTerm")), document.getElementById("viewBody"), "#FFFF66") }) } function checkForSet() { var C = 0; var B = 1; var A = ""; while (document.getElementById("spnSetSku" + C) != null) { if (C == 0) { A = document.getElementById("spnSetSku" + C).innerHTML } else { if (document.getElementById("cbxProdSetPage" + C).checked) { A += "," + document.getElementById("spnSetSku" + C).innerHTML } } C += 1; B += 2 } return A } var intervalFav; function hideFav() { intervalFav = window.setTimeout("hideFavTime()", 750) } function hideFavTime() { document.getElementById("ulAddFav").style.display = "none" } function stopFavHide() { clearTimeout(intervalFav) } function showBorder(B, E, D) { var C = B.getElementsByTagName("img"); C[1].style.display = "block"; var A = B.parentNode.getElementsByTagName("div"); A[0].innerHTML = '<img src="http://hi.atgimg.com/images/options/image/' + E + '" style="position:absolute;width:120px;height:120px;top:2px;left:2px;z-index:2;"><img src="/images/windowLgLB.png" style="position:absolute;z-index:5;"><div style="position:absolute;bottom:10px;left:4px;text-align:center;z-index:8;font-size:8pt;color:#333;background:#EEE;filter:alpha(opacity=80);-moz-opacity:0.8;-khtml-opacity: 0.8;opacity: 0.8;width:115px;">' + D + "</div>"; A[0].style.top = B.style.top.replace("px", "") * 1 + 33; A[0].style.left = B.style.left.replace("px", "") * 1 + 33; A[0].style.width = "130"; A[0].style.height = "150"; A[0].style.display = "block" } function clearBorder(B) { var C = B.getElementsByTagName("img"); var A = B.parentNode.getElementsByTagName("div"); if (C[1].id != "imgCurrent") { C[1].style.display = "none" } A[0].style.display = "none" } function saveRecent(G, M, C, I, K) { var N = readCookie("recentView"); var D = N; var F = G + "|" + M + "|" + C + "|" + I + "/" + K + "~"; if (D != null) { var H = -1; H = D.indexOf(F); if (H > -1) { D = D.replace(F, "") } D = F + D; var B = D.split("~"); var E = B.length; if (E > 5) { var A = 0; var J = ""; for (A = 0; A < 5; A++) { var L = B[A] + "~"; J = J + L } D = J } } else { D = G + "|" + M + "|" + C + "|" + I + "/" + K + "~" } D = D.replace(" ", ""); SetMyCookie("recentView", D, 5) } function SetMyCookie(E, D, C) { var B = new Date(); var A = new Date(); if (C == null || C == 0) { C = 1 } A.setTime(B.getTime() + 3600000 * 24 * C); document.cookie = E + "=" + D + ";path=/;expires=" + A.toTimeString() } function swapImage(C, G, F) { var D = document.createElement("img"); D.src = C; D.onLoad = altLoad(D); var E = document.getElementById("divMiniImageWrapper"); var A = E.getElementsByTagName("span"); for (var B = 0; B < A.length; B++) { if (A(B).id == G.id) { A(B).style.borderColor = "red" } else { A(B).style.borderColor = "#F3F3F3" } } if (F != "") { document.getElementById("divAltImgCap").innerHTML = F.replace(/([0-9]+)/, '<a href="/products/view.aspx?sku=$1">$1</a>'); document.getElementById("divAltImgCap").style.display = "block"; if (document.getElementById("imgText")) { document.getElementById("imgText").style.display = "none" } } else { document.getElementById("divAltImgCap").innerHTML = ""; document.getElementById("divAltImgCap").style.display = "none"; if (document.getElementById("imgText")) { document.getElementById("imgText").style.display = "block" } } updateZoom(C) } function updateZoom(A) { xMulti = 0; var C = new Image(); C.onerror = function () { loadLarge(A) }; C.src = A.replace(/\/p\//, "/x/"); if (C.width > 0 && C.width < 50) { loadLarge(A) } else { var B = document.getElementById("imgZoom"); B.src = C.src } } function loadLarge(A) { var C = new Image(); C.onerror = function () { document.getElementById("imgZoom").src = "" }; C.src = A.replace(/\/p\//, "/l/"); var B = document.getElementById("imgZoom"); B.src = C.src } function altLoad(B) { if (B.width == 0 || !B.complete) { window.setTimeout(function () { altLoad(B) }, 50) } else { var A = document.getElementById("imgProduct"); if (B.width > 300) { B.width = 300 } if (B.height > 300) { B.height = 300 } A.src = B.src; A.width = B.width; A.height = B.height } } function multiHi(E, B, C) { if (!/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { var A = E.split(" "); for (var D = 0; D < A.length; D++) { if (A[D].length > 2) { highlight(A[D], B, C) } } } } function highlight(D, A, E) { var F = D.toLowerCase(); if (F != "") { for (var H = 0; H < A.childNodes.length; H++) { var C = A.childNodes[H]; var B = A.childNodes[H]; if (C.nodeType == 3) { var G = C.data; var J = G.toLowerCase(); var K = ""; if (J.indexOf(D) != -1) { var I = document.createElement("span"); C.parentNode.replaceChild(I, C); while ((K = J.indexOf(D)) != -1) { I.appendChild(document.createTextNode(G.substr(0, K))); I.appendChild(create_node(document.createTextNode(G.substr(K, D.length)), E)); G = G.substr(K + D.length); J = J.substr(K + D.length) } I.appendChild(document.createTextNode(G)) } } else { highlight(D, C, E) } } } } function create_node(C, A) { var B = document.createElement("SPAN"); B.style.backgroundColor = A; B.appendChild(C); return B } function rateIt(B) { document.getElementById("miniReviewText").innerHTML = miniReviewDefaultText + '<span class="red">&nbsp;&nbsp;&nbsp;&nbsp;SAVED</span>'; miniReviewBaseImage = "/images/reviews/star" + B + "_0.gif"; document.getElementById("miniReviewWriteReview").innerHTML = '<a class="blueUnderLine" href="/products/review.aspx?family=' + miniReviewGroupId + '">Write a review</a>'; var A = new ajaxRequestObject("/ajax/miniReview.aspx", "group_id=" + miniReviewGroupId + "&rate=" + B); A.doGetCallback() } function rateReview(D, B, A) { var C = new ajaxRequestObject("/ajax/reviewReview.aspx", "reviewId=" + D + "&helpful=" + B); C.doGetCallback(); A.parentNode.innerHTML = "<span style='color: green'>Thank you for rating this review.</span>" } function rateAnswer(A, F, C, D, B) { var E = new ajaxRequestObject("/ajax/rateAnswer.aspx", "questionId=" + A + "&answerId=" + F + "&helpful=" + C + "&report=" + D); E.doGetCallback(); B.parentNode.innerHTML = "<span style='color: green'>Thank you for giving feedback on this answer.</span>" } function getQtyPage(B) { var E = document.getElementById("selQty"); var A = ""; var C = readCookie("NetSessionID"); var D = ""; if (C != null) { if (C.length < 30) { A = A + "&NetSessionID=" + C } } if (readCookie("af") != null) { A = A + "&af=" + readCookie("af") } if (readCookie("af2") != null) { A = A + "&af2=" + readCookie("af2") } if (readCookie("af800") != null) { A = A + "&af800=" + readCookie("af800") } if (readCookie("af%5ftrack%5fid") != null) { A = A + "&afTrackId=" + readCookie("af%5ftrack%5fid") } if (document.getElementById("spnSetSku1")) { D = checkForSet() } else { D = document.getElementById("spnPart").innerHTML.replace(/<span><span [^>]*>([0-9]*)<\/span><\/span>/ig, "$1") } B.href = "http://" + strHost + "/cart/addtocart.aspx?sku=" + D + "&qty=" + E.value + A } function updateCartCookie() { if (document.getElementById("spnPrice")) { var A = document.getElementById("spnPrice"); var F = A.innerHTML.split("&"); F[0] = F[0].replace("$", "").replace(",", ""); if (readCookie("cartItem") != null) { if (readCookie("cartItem").indexOf("~") > 0) { SetCookie("cartItem", "1-" + F[0], 365) } else { var E = document.getElementById("selQty"); var C = readCookie("cartItem").split("-"); if (C[0] == "NaN") { SetCookie("cartItem", "1-" + F[0], 365) } else { var D = C[0] * 1 + E.value * 1; var B = C[1] * 1 + (E.value * 1 * F[0] * 1) * 1; SetCookie("cartItem", D + "-" + B, 365) } } } else { SetCookie("cartItem", "1-" + F[0], 365) } } return true } function showImgText(D) { var C = document.getElementById("imgText"); if (C) { if (D == 1) { C.style.display = "block" } else { C.style.display = "none" } } } function tagProd(B) { var A = new ajaxRequestObject("/ajax/tag.aspx", "tag=" + document.getElementById("tbxTag").value + "&family=" + B); A.doGetCallback(); document.getElementById("tbxTag").value = ""; document.getElementById("divTagHelp").innerHTML = "Your tags have been saved"; document.getElementById("divTagHelp").style.color = "#009933" } function addToCart() { var A = true; var B = ""; A = checkOption(B); if (!A) { document.getElementById("divAddError").innerHTML = '<div style="float:left;width:255px;margin-left:5px;">Select ' + B.toLowerCase() + ' before adding to your cart </div><img src="/images/arrow.png" style="vertical-align:middle;">'; document.getElementById("divAddError").style.display = "block" } return A } function checkOption(B) { var A = true; for (i = numGroups - 1; i >= 0; i--) { if (optMustBe[i] == -1) { document.getElementById("oErr" + (i + 1)).style.display = "inline"; A = false; if (B.length > 0) { B += ", " } B += document.getElementById("oName" + (i + 1)).innerHTML } } return A } function initOption() { try { if (arrOpt.length > 0) { setPreSet(); checkMatch() } buildSelString() } catch (A) { } } function setPreSet() { for (i = 0; i < numGroups; i++) { if (optMustBe[i] > -1) { document.getElementById("oSel" + (i + 1)).innerHTML = optSelName[i]; document.getElementById((i + 1) + "::" + optMustBe[i]).className = "optionSel"; for (var A = 1; A <= numOptions[i]; A++) { if (A != optMustBe[i]) { isFound = false; checkDis(i + 1, A, true); if (!isFound) { document.getElementById((i + 1) + "::" + A).className = "optionNotAvailable" } } } } } } function oSelect(E, G, C, D) { var A = document.getElementById("oSel" + E); var H = document.getElementById("oErr" + E); var F = document.getElementById(E + "::" + G); if (F.className == "optionNotAvailable") { for (B = numGroups - 1; B >= 0; B--) { if (numOptions[B] > 1) { optSelName[B] = ""; document.getElementById("oSel" + (B + 1)).innerHTML = ""; optMustBe[B] = -1; if (B + 1 == E) { for (k = 1; k <= numOptions[B]; k++) { if (k != G) { document.getElementById((B + 1) + "::" + k).className = "option" } } } else { for (k = 1; k <= numOptions[B]; k++) { if (k != G) { document.getElementById((B + 1) + "::" + k).className = "option" } } } } optSelName[E - 1] = C; A.innerHTML = optSelName[E - 1]; optMustBe[E - 1] = G; H.style.display = "none"; F.className = "optionSel" } } else { A.innerHTML = C; optSelName[E - 1] = C; optMustBe[E - 1] = G; H.style.display = "none"; F.className = "optionSel"; for (B = 1; B <= numOptions[E - 1]; B++) { if (G != B) { if (document.getElementById(E + "::" + B).className != "optionNotAvailable") { document.getElementById(E + "::" + B).className = "option" } } } } checkDis(-1); if (D) { for (var B = 1; B <= numOptions[E - 1]; B++) { if (B != G) { isFound = false; checkDis(E, B, true); if (!isFound) { document.getElementById(E + "::" + B).className = "optionNotAvailable" } } } } checkMatch(); buildSelString(); document.getElementById("notAv").className = "hide" }

function checkMatch(D, E) {
    if (D === undefined) { D = "0" }
    if (E === undefined) { E = "0" }
    var C = buildSelID(D, E);
    if (arrOpt[C]) {
        intSku = arrOpt[C].sku; document.getElementById("spnPart").innerHTML = intSku;
        document.getElementById("tdPrice").innerHTML = toCurrency(arrOpt[C].price);
        document.getElementById("spnMSRP").innerHTML = toCurrency(arrOpt[C].msrp);
        document.getElementById("tdSave").innerHTML = toCurrency(arrOpt[C].msrp * 1 - arrOpt[C].price * 1) + "&nbsp;(" + toPercent((arrOpt[C].msrp * 1 - arrOpt[C].price * 1) / arrOpt[C].msrp * 1).replace(/\.[0-9][0-9]/, "") + ")";
        document.getElementById("spnProdId").innerHTML = arrOpt[C].partNo;
        if (document.getElementById("viewProd_celIntMfrProdIdText")) {
            document.getElementById("viewProd_celIntMfrProdIdText").innerHTML = "<strong>Mfr Part No:</strong><br>" + arrOpt[C].partNo;
            document.getElementById("viewProd_celBasisText").innerHTML = "<strong>Basis:</strong><br>" + toCurrency(arrOpt[C].basis);
            document.getElementById("viewProd_celLUCostText").innerHTML = "<strong>LU Cost:</strong><br>" + toCurrency(arrOpt[C].ac);
            document.getElementById("viewProd_celIntRetailText").innerHTML = "<strong>Retail Price:</strong><br>" + toCurrency(arrOpt[C].price);
            document.getElementById("viewProd_celShippingText").innerHTML = "<strong>Shipping Cost:</strong><br>" + toCurrency(arrOpt[C].ship);
            document.getElementById("viewProd_celMarginText").innerHTML = "<strong>Margin:</strong><br>" + toCurrency(arrOpt[C].price - arrOpt[C].ac - arrOpt[C].ship)
        } minPrice = maxPrice = arrOpt[C].price;
        minMSRP = maxMSRP = arrOpt[C].msrp;
        if (arrOpt[C].bo != "") { 
    if (document.getElementById("divShipTime")) { document.getElementById("divShipTime").style.display = "none" } document.getElementById("divStock").style.display = "block"; document.getElementById("divStock").innerHTML = '<span class="red" style="font-size:12pt;">Out of Stock until ' + arrOpt[C].bo + "</span>"; if (arrOpt[C].invChk != "") { document.getElementById("divStock").innerHTML += '<div style="color:#666;font-size:8pt;font-weight:normal;">Stock Updated ' + arrOpt[C].invChk + "</div>" } } else { if (arrOpt[C].mfrStk != "") { var A, B; document.getElementById("divStock").style.display = "block"; if (document.getElementById("divShipTime")) { document.getElementById("divShipTime").style.display = "none" } if (document.getElementById("timeLeft")) { B = document.getElementById("timeLeft").innerHTML } else { B = "" } if (arrOpt[C].mfrStk > 5 || arrOpt[C].mfrStk == -1) { A = 'In Stock<div id="timeLeft">' + B + "</div>" } else { if (arrOpt[C].mfrStk > 0) { A = arrOpt[C].mfrStk + ' In Stock<div id="timeLeft">' + B + "</div>" } else { A = '<span class="red" style="font-size:12pt;">Out of Stock</span><div id="timeLeft" style="display:none;">' + B + "</div>" } } if (arrOpt[C].invChk != "") { A += '<div style="color:#666;font-size:8pt;font-weight:normal;">Stock Updated ' + arrOpt[C].invChk + "</div>" } document.getElementById("divStock").innerHTML = A } else { if (document.getElementById("divShipTime")) { document.getElementById("divShipTime").style.display = "block" } document.getElementById("divStock").style.display = "none" } } if (document.getElementById("imgProduct")) { if (arrOpt[C].img != "") { document.getElementById("imgProduct").src = imgPath + "/img/p/" + mfrId + "/" + arrOpt[C].img; document.getElementById("divAltImgCap").style.display = "none" } else { if (defaultImg != "") { document.getElementById("imgProduct").src = defaultImg } } } if (arrOpt[C].imgT != "") { document.getElementById("imgText").innerHTML = arrOpt[C].imgT; document.getElementById("imgText").style.display = "block" } else { if (defaultImgText != "") { document.getElementById("imgText").innerHTML = defaultImgText; document.getElementById("imgText").style.display = "block" } else { if (document.getElementById("imgText")) { document.getElementById("imgText").style.display = "none" } } } if (arrOpt[C].desc != "") { document.getElementById("divSkuDesc").innerHTML = arrOpt[C].desc } else { document.getElementById("divSkuDesc").innerHTML = "" } if (document.getElementById("spnDim")) { if (arrOpt[C].d != "") { document.getElementById("spnDim").innerHTML = arrOpt[C].d.replace(/-\s*([a-zA-Z]+)/g, "<br>&nbsp;$1").replace(/-\s$/, "") } else { if (defaultDim != "") { document.getElementById("spnDim").innerHTML = defaultDim.replace(/-\s*([a-zA-Z]+)/g, "<br>&nbsp;$1").replace(/-\s$/, "") } else { document.getElementById("spnDim").innerHTML = "" } } } updatePrice(); if (D == 0 && arrOpt[C].img != "") { updateZoom(imgPath + "/img/p/" + mfrId + "/" + arrOpt[C].img) } } else { document.getElementById("spnPart").innerHTML = document.getElementById("divNeedSelect").innerHTML; document.getElementById("imgProduct").src = defaultImg; updatePrice() } } function updatePrice() { if (minPrice == maxPrice) { if (minPrice > -1) { document.getElementById("tdPrice").innerHTML = toCurrency(minPrice); document.getElementById("spnMSRP").innerHTML = toCurrency(minMSRP); document.getElementById("tdSave").innerHTML = toCurrency(minMSRP * 1 - minPrice * 1) + "&nbsp;(" + toPercent((minMSRP * 1 - minPrice * 1) / minMSRP * 1).replace(/\.[0-9][0-9]/, "") + ")" } else { document.getElementById("tdPrice").innerHTML = defaultPrice; document.getElementById("tdSave").innerHTML = defaultSave; document.getElementById("spnMSRP").innerHTML = defaultMSRP } } else { document.getElementById("tdPrice").innerHTML = toCurrency(minPrice) + " - " + toCurrency(maxPrice); document.getElementById("spnMSRP").innerHTML = toCurrency(minMSRP) + " - " + toCurrency(maxMSRP); if (toPercent((minMSRP * 1 - minPrice * 1) / minMSRP * 1).replace(/\.[0-9][0-9]/, "") == toPercent((maxMSRP * 1 - maxPrice * 1) / maxMSRP * 1).replace(/\.[0-9][0-9]/, "")) { document.getElementById("tdSave").innerHTML = toCurrency(minMSRP * 1 - minPrice * 1) + "&nbsp;(" + toPercent((minMSRP * 1 - minPrice * 1) / minMSRP * 1).replace(/\.[0-9][0-9]/, "") + ")" } else { document.getElementById("tdSave").innerHTML = toPercent((minMSRP * 1 - minPrice * 1) / minMSRP * 1).replace(/\.[0-9][0-9]/, "") + " - " + toPercent((maxMSRP * 1 - maxPrice * 1) / maxMSRP * 1).replace(/\.[0-9][0-9]/, "") } } } function oMouseOver(B, C, A) { if (optMustBe[B - 1] == C) { document.getElementById("oSel" + B).innerHTML = A } else { document.getElementById("oSel" + B).innerHTML = "<span style='color:#336699'>" + A + "</span>" } if (document.getElementById(B + "::" + C).className == "optionNotAvailable") { showNotAv(B, A) } if (optLrg) { optLrg.style.display = "none" } if (document.getElementById(B + "::" + C).getElementsByTagName("div")[0].className == "optionImg") { optLrg = document.getElementById(B + "::" + C).getElementsByTagName("div")[2]; optLrg.style.display = "block"; optLrg.innerHTML = '<img src="' + document.getElementById(B + "::" + C).getElementsByTagName("div")[0].style.backgroundImage.replace(/mini/gi, "image").replace("url(", "").replace(")", "") + '"><br>' + A } checkMatch(B, C); checkDis(B, C); switch (B) { case 1: clearTimeout(timer1); break; case 2: clearTimeout(timer2); break; case 3: clearTimeout(timer3); break; case 4: clearTimeout(timer4); break; case 5: clearTimeout(timer5); break; case 6: clearTimeout(timer6); break; case 7: clearTimeout(timer7); break; case 8: clearTimeout(timer8); break } } function showNotAv(C, A) { var D = new Array(); for (i = 0; i <= numGroups; i++) { if (optMustBe[i] > -1 && i + 1 != C) { D[D.length] = document.getElementById("oName" + (i + 1)).innerHTML + ": <span style='color:#990000'>" + optSelName[i] + "</span>" } } var B = document.getElementById("notAv"); B.innerHTML = "<div style='margin:10px;'>This item is not avaiable in<br>" + D.join("<br>") + "<br>" + document.getElementById("oName" + (C)).innerHTML + ": <span style='color:#990000'>" + A + "</div>"; B.className = "notAv" } function checkLevel(F, C, B, G) { if (G == 1) { if (C > 1) { F += "::" } if (reqOpt[C - 1] > 0) { curCheck[C - 1] = reqOpt[C - 1]; checkLevel((F + reqOpt[C - 1]), C + 1, reqOpt[C - 1], 0) } else { for (var E = 1; E <= numOptions[C - 1]; E++) { curCheck[C - 1] = E; checkLevel((F + E), C + 1, E, 0) } } } else { curCheck[C - 2] = B; if (C <= numGroups) { if (reqOpt[C - 1] > 0) { checkLevel(F + "::" + reqOpt[C - 1], C + 1, reqOpt[C - 1], 0) } else { for (var D = 1; D <= numOptions[C - 1]; D++) { checkLevel(F + "::" + D, C + 1, D, 0) } } } else { if (arrOpt[F]) { isFound = true; if (minPrice > arrOpt[F].price || minPrice == -1) { minPrice = arrOpt[F].price; minMSRP = arrOpt[F].msrp } if (maxPrice < arrOpt[F].price || maxPrice == -1) { maxPrice = arrOpt[F].price; maxMSRP = arrOpt[F].msrp } arrFound[C - 2][B - 1] = 1; for (var A = 0; A < numGroups - 1; A++) { arrFound[A][(curCheck[A] - 1)] = 1 } } } } } function hideOpt(B, C, D) { var A = document.getElementById(C + "::" + D); if (numOptions[C - 1] > 1) { if (B == 1) { if (A) { A.className = "optionNotAvailable" } hideCnt++; arrHidden[hideCnt] = C + "::" + D } else { if (A) { if (optMustBe[C - 1] == D) { A.className = "optionSel" } else { A.className = "option" } } } } } function buildSelID(C, B) { var A = new Array(numGroups); for (i = numGroups; i >= 1; i--) { if (i == C) { A[i - 1] = B } else { if (numOptions[i - 1] == 1) { A[i - 1] = 1 } else { A[i - 1] = optMustBe[i - 1] } } } return A.join("::") } function buildSelString(C, B) { var A = ""; for (i = 1; i <= numGroups; i++) { if (i != C && numOptions[i - 1] > 1) { if (optMustBe[i - 1] == -1) { if (A != "") { A += ", " } A += document.getElementById("oName" + i).innerHTML } } } if (A != "") { document.getElementById("divNeedSelect").innerHTML = document.getElementById("spnPart").innerHTML = "Select " + A.toLowerCase() } else { document.getElementById("divNeedSelect").innerHTML = "To Buy, Add to Shopping Cart"; document.getElementById("divAddError").style.display = "none" } } function checkDis(F, A, E) { hideCnt = -1; arrHidden = new Array(); debug = ""; var C = false; reqOpt = new Array(0, 0, 0, 0, 0, 0, 0, 0); if (F > 0) { C = true } for (var J = 0; J <= numGroups - 1; J++) { if (F - 1 == J) { reqOpt[J] = A; C = true } else { if (optMustBe[J] > -1) { reqOpt[J] = optMustBe[J]; C = true } } arrFound[J] = new Array(numOptions[J]) } var G = 0; if (C == true) { var B = ""; minPrice = -1; maxPrice = -1; minMSRP = -1; maxMSRP = -1; if (!E) { for (var J = 0; J < numGroups; J++) { if (reqOpt[J] > 0) { if (J > 0) { B += "::" } curCheck[J] = reqOpt[J]; B += reqOpt[J] } else { checkLevel(B, J + 1, 1, 1); break } } } else { checkLevel("", 1, 1, 1) } var I; var D; if (!E) { for (var J = 0; J <= numGroups - 1; J++) { I = 0; D = 0; if (optMustBe[J] == -1 && F - 1 != J) { for (var H = 0; H < numOptions[J]; H++) { if (!arrFound[J][H]) { hideOpt(1, J + 1, H + 1); I += 1 } else { hideOpt(0, J + 1, H + 1); D = H } } if (F == -1 && I == (numOptions[J] - 1)) { var K = String(document.getElementById((J + 1) + "::" + (D + 1)).getElementsByTagName("div")[0].title); K = K.substring(K.length, 16); oSelect(J + 1, D + 1, K, false) } } } } if (F > 0) { divDebug.innerHTML = debug } } } function oMouseOut(A) { document.getElementById("notAv").className = "hide"; switch (A) { case 1: clearTimeout(timer1); timer1 = setTimeout("mOut(" + A + ")", "150"); break; case 2: clearTimeout(timer2); timer2 = setTimeout("mOut(" + A + ")", "150"); break; case 3: clearTimeout(timer3); timer3 = setTimeout("mOut(" + A + ")", "150"); break; case 4: clearTimeout(timer4); timer4 = setTimeout("mOut(" + A + ")", "150"); break; case 5: clearTimeout(timer5); timer5 = setTimeout("mOut(" + A + ")", "150"); break; case 6: clearTimeout(timer6); timer6 = setTimeout("mOut(" + A + ")", "150"); break; case 7: clearTimeout(timer7); timer7 = setTimeout("mOut(" + A + ")", "150"); break; case 8: clearTimeout(timer8); timer8 = setTimeout("mOut(" + A + ")", "150"); break } } function mOut(B) { var A = document.getElementById("oSel" + B); if (optMustBe[B - 1] > -1) { A.innerHTML = "<span style='color:#CC6600'>" + optSelName[B - 1] + "</span>" } else { A.innerHTML = "" } for (j = hideCnt; j >= 0; j--) { document.getElementById(arrHidden[j]).className = "option" } checkMatch(); checkDis(0, 0); if (optLrg) { optLrg.style.display = "none" } } function intBox(A) { if (A.innerHTML == "+") { A.innerHTML = "-"; document.getElementById("tblIntBlock").style.display = "block" } else { A.innerHTML = "+"; document.getElementById("tblIntBlock").style.display = "none" } return false } function mouseO(A) { clearTimeout(showZT); showZT = setTimeout(function () { showZoom(1) }, 300) } function showZoom(A) { imgPos = findPos(document.getElementById("imgProduct")); divPos = findPos(document.getElementById("mainImg")); if (A === undefined) { A = 1 } if (A < 10) { var B = document.getElementById("imgProduct"); var C = document.getElementById("imgZoom"); if (document.getElementById("imgZoom").src != "") { xMulti = C.width / B.width; yMulti = C.height / B.height; document.getElementById("divLarge").style.width = "1"; document.getElementById("divLarge").style.height = "1"; document.getElementById("divLarge").style.display = "block"; if (xMulti > 0) { if (xMulti == 1) { document.getElementById("divLarge").style.display = "none" } else { document.onmousemove = update; update() } } else { showZT = setTimeout(function () { showZoom(A + 1) }, 100) } } } else { document.getElementById("divLarge").style.width = "1"; document.getElementById("divLarge").style.height = "1"; document.getElementById("divLarge").style.display = "block" } } function mouseOut(B) { if (divPos == null) { return false } if (mousex == 0 && mousey == 0) { return false } if ((mousex - divPos[0] > 0) && (mousex - divPos[0] < 320) && (mousey - divPos[1] > 0) && (mousey - divPos[1] < 320)) { return false } clearTimeout(showZT); document.getElementById("divZoomBox").style.display = "none"; document.getElementById("divLarge").style.display = "none"; mousex = mousey = 0; var A = document.getElementById("imgZoom"); A.style.top = 0; A.style.left = 0 } function getMouseXY(A) { if (!A) { A = window.event } if (A) { if (A.pageX || A.pageY) { mousex = A.pageX; mousey = A.pageY; algor = "[e.pageX]"; if (A.clientX || A.clientY) { algor += " [e.clientX] " } } else { if (A.clientX || A.clientY) { mousex = A.clientX + document.body.scrollLeft; mousey = A.clientY + document.body.scrollTop; algor = "[e.clientX]"; if (A.pageX || A.pageY) { algor += " [e.pageX] " } } } } } function update(F) { if (xMulti == 0) { } else { var D = document.getElementById("imgProduct"); var C = document.getElementById("imgProduct"); var E = document.getElementById("imgZoom"); var B = document.getElementById("divZoomBox"); var A = document.getElementById("vewBody"); xMulti = E.width / D.width; yMulti = E.height / D.height; getMouseXY(F); if ((mousey - divPos[1]) < 320 && (mousey - divPos[1]) > 0 && (mousex - divPos[0]) > 0 && (mousex - divPos[0]) < 320) { if (xMulti > 2.2 && yMulti > 2.2) { document.getElementById("divLarge").style.display = "block"; document.getElementById("divLarge").style.width = "660"; document.getElementById("divLarge").style.height = "660"; document.getElementById("divLarge").style.margin = ""; E.style.top = -yMulti * (mousey - imgPos[1]) + (largeImgBoxHeight / 2); E.style.left = -xMulti * (mousex - imgPos[0]) + (largeImgBoxWidth / 2); B.style.display = "block"; B.style.height = largeImgBoxHeight / yMulti; B.style.width = largeImgBoxWidth / xMulti; B.style.top = (mousey - divPos[1]) - (largeImgBoxHeight / yMulti / 2); B.style.left = (mousex - divPos[0]) - (largeImgBoxWidth / xMulti / 2) } else { if (xMulti > 1 || yMulti > 1) { document.getElementById("divLarge").style.display = "block"; document.getElementById("divLarge").style.width = E.width + 20; document.getElementById("divLarge").style.height = E.height + 20; E.style.top = "10"; E.style.left = "10" } } } else { mouseOut(F) } } } function findPos(A) { var B = curtop = 0; if (A.offsetParent) { do { B += A.offsetLeft; curtop += A.offsetTop } while (A = A.offsetParent) } return [B, curtop] };