﻿$(document).ready(function () { $("body").append("<div id='tooltip'></div>"); $("#ctl00_ContentPlaceHolder1_segItems > table:td img").each(function () { $(this).mouseover(function (c) { var b = c.pageX + 15; var a = c.pageY + 10; if ((b + $("#tooltip").width()) > $("body").width()) { $("#tooltip").css({ left: (b - $("#tooltip").width()) }) } else { $("#tooltip").css({ left: b }) } $("#tooltip").css({ top: a }); $("#tooltip").html($(this).attr("alt")); $(this).attr("alt", ""); $("#tooltip").show() }).mousemove(function (c) { var b = c.pageX + 15; var a = c.pageY + 10; if ((b + $("#tooltip").width()) > $("body").width()) { $("#tooltip").css({ left: (b - $("#tooltip").width()) }) } else { $("#tooltip").css({ left: b }) } $("#tooltip").css({ top: a }) }).mouseout(function (a) { $(this).attr("alt", $("#tooltip").html()); $("#tooltip").hide() }) }) }); function ToggleCheck(a) { if (a.value == 0) { a.checked = true; a.value = 1 } else { if (a.value == 1) { a.checked = false; a.value = 0 } } } function ConstructOptions() { var c = "<Items>"; var e = false; var f = ""; var g = ""; var a = ""; var h = ""; var k = ""; var b = document.getElementById("ctl00_ContentPlaceHolder1_segItems"); if (b != null) { for (i = 0; i < b.childNodes.length; i++) { var d = b.childNodes.item(i); if (d.nodeName == "INPUT" && d.name == "buildid") { g = d.value } else { if (d.nodeName == "INPUT" && d.name == "source") { a = d.value } else { if (d.nodeName == "INPUT" && d.name == "filterTypeID") { h = d.value } else { if (d.nodeName == "INPUT" && d.name == "subSetTypeID") { k = d.value } else { if (d.nodeName == "TABLE") { for (row = d.rows[0]; row != null; row = row.nextSibling) { if (row.nodeType == 1) { for (cell = row.firstChild; cell != null; cell = cell.nextSibling) { if (cell.nodeType == 1) { e = false; f = ""; for (ctl = cell.firstChild; ctl != null; ctl = ctl.nextSibling) { if (ctl.name == "ckbuild") { if (ctl.value == 1) { pos = ctl.id.indexOf("-", 1); f = ctl.id.substring(1, pos); c += "<Item ID='" + f + "' PPOS='" + ctl.id.substring(pos + 1) + "' />"; e = true } } if (ctl.name == "ddattach") { if (e && ctl.selectedIndex > 0) { c += "<Selected ID='" + f + "' AttachID='" + ctl.options[ctl.selectedIndex].title + "' ListID='" + ctl.options[ctl.selectedIndex].value + "' />" } } } } } } } } } } } } } } c += "</Items>"; if (c != "") { MC.ENET.BuildService.ConstructOptions(c, g, h, k, a, OnConstructOptionsSucceeded, OnConstructOptionsFailed) } return false } function OnConstructOptionsFailed(a) { if (a != null) { if (a != "") { var b = document.getElementById("ctl00_ContentPlaceHolder1_segOptError"); if (b != null) { b.innerHTML = ""; b.innerHTML = a._exceptionType + " " + a._message } } } DisableOptions(a._exceptionType + " " + a._message) } function OnConstructOptionsSucceeded(a) { if (a != null) { if (a[0] == "" && a[1] == "") { DisableOptions(a[2]); return } if (a[0] != "") { var b = document.getElementById("ctl00_ContentPlaceHolder1_segOptLeft"); if (b != null) { b.innerHTML = ""; b.innerHTML = a[0]; b.style.display = "block"; SelectRadioLeft(null) } } else { if (a[0] == "") { var b = document.getElementById("ctl00_ContentPlaceHolder1_segOptLeft"); if (b != null) { b.innerHTML = ""; b.style.display = "none" } b = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelLeft"); if (b != null) { b.innerHTML = ""; b.style.display = "none" } } } if (a[1] != "") { var b = document.getElementById("ctl00_ContentPlaceHolder1_segOptRight"); if (b != null) { b.innerHTML = ""; b.innerHTML = a[1]; b.style.display = "block"; SelectRadioRight(null) } } else { if (a[1] == "") { var b = document.getElementById("ctl00_ContentPlaceHolder1_segOptRight"); if (b != null) { b.innerHTML = ""; b.style.display = "none" } b = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelRight"); if (b != null) { b.innerHTML = ""; b.style.display = "none" } } } CalculatePrice(0) } } function DisableOptions(b) { var a = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelLeft"); if (a != null) { a.innerHTML = b; a.style.display = "block" } a = document.getElementById("ctl00_ContentPlaceHolder1_segOptLeft"); if (a != null) { a.innerHTML = ""; a.style.display = "none" } var a = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelRight"); if (a != null) { a.innerHTML = ""; a.style.display = "none" } a = document.getElementById("ctl00_ContentPlaceHolder1_segOptRight"); if (a != null) { a.innerHTML = ""; a.style.display = "none" } a = document.getElementById("ctl00_ContentPlaceHolder1_segQty"); if (a != null) { a.innerHTML = "" } a = document.getElementById("ctl00_ContentPlaceHolder1_segPrice"); if (a != null) { if (document.getElementById("tbprice") != null) { a.innerHTML = "" } } } function SelectRadioLeft(a) { for (row = document.getElementById("tbOptions1").rows[0]; row != null; row = row.nextSibling) { if (row.nodeType == 1) { for (cell = row.firstChild; cell != null; cell = cell.nextSibling) { if (cell.nodeType == 1) { for (ctl = cell.firstChild; ctl != null; ctl = ctl.nextSibling) { if (ctl.id != null) { if (ctl.id.indexOf("rdOpt", 0) != -1 && a == null) { if (ctl.checked) { for (ctl1 = cell.firstChild; ctl1 != null; ctl1 = ctl1.nextSibling) { if (ctl1.id != null) { if (ctl1.id.indexOf("divOpt", 0) != -1) { div = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelLeft"); if (div != null) { div.innerHTML = ""; div.innerHTML = ctl1.innerHTML; div.style.display = "block"; document.getElementById("ctl00_ContentPlaceHolder1_divOptHdr").style.display = "block" } return } } } } } else { if (ctl.id.indexOf("rdOpt", 0) != -1 && a != null) { if (ctl == a) { ctl.value = 1; ctl.checked = true; for (ctl1 = cell.firstChild; ctl1 != null; ctl1 = ctl1.nextSibling) { if (ctl1.id != null) { if (ctl1.id.indexOf("divOpt", 0) != -1) { div = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelLeft"); if (div != null) { div.innerHTML = ""; div.innerHTML = ctl1.innerHTML; div.style.display = "block"; document.getElementById("ctl00_ContentPlaceHolder1_divOptHdr").style.display = "block" } break } } } } else { ctl.value = 0; ctl.checked = false } } } } } } } } } } function SelectRadioRight(a) { for (row = document.getElementById("tbOptions2").rows[0]; row != null; row = row.nextSibling) { if (row.nodeType == 1) { for (cell = row.firstChild; cell != null; cell = cell.nextSibling) { if (cell.nodeType == 1) { for (ctl = cell.firstChild; ctl != null; ctl = ctl.nextSibling) { if (ctl.id != null) { if (ctl.id.indexOf("rdOpt", 0) != -1 && a == null) { if (ctl.checked) { for (ctl1 = cell.firstChild; ctl1 != null; ctl1 = ctl1.nextSibling) { if (ctl1.id != null) { if (ctl1.id.indexOf("divOpt", 0) != -1) { div = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelRight"); if (div != null) { div.innerHTML = ""; div.innerHTML = ctl1.innerHTML; div.style.display = "block"; document.getElementById("ctl00_ContentPlaceHolder1_divOptHdr").style.display = "block" } return } } } } } else { if (ctl.id.indexOf("rdOpt", 0) != -1 && a != null) { if (ctl == a) { ctl.value = 1; ctl.checked = true; for (ctl1 = cell.firstChild; ctl1 != null; ctl1 = ctl1.nextSibling) { if (ctl1.id != null) { if (ctl1.id.indexOf("divOpt", 0) != -1) { div = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelRight"); if (div != null) { div.innerHTML = ""; div.innerHTML = ctl1.innerHTML; div.style.display = "block"; document.getElementById("ctl00_ContentPlaceHolder1_divOptHdr").style.display = "block" } break } } } } else { ctl.value = 0; ctl.checked = false } } } } } } } } } } function CalculatePrice(h) { var o = 1; var f = ""; var c = ""; var a = "<Settings>"; var n = ""; var m = ""; var k = ""; var b = document.getElementById("ctl00_ContentPlaceHolder1_segItems"); if (b != null) { for (i = 0; i < b.childNodes.length; i++) { var d = b.childNodes.item(i); if (d.nodeName == "INPUT" && d.name == "buildid") { a += "<BldID>" + d.value + "</BldID>" } else { if (d.nodeName == "INPUT" && d.name == "buildItemNo") { a += "<BldItemNo>" + d.value + "</BldItemNo>" } else { if (d.nodeName == "INPUT" && d.name == "source") { a += "<Src>" + d.value + "</Src>" } else { if (d.nodeName == "INPUT" && d.name == "filterTypeID") { a += "<FID>" + d.value + "</FID>" } else { if (d.nodeName == "INPUT" && d.name == "subSetTypeID") { a += "<SID>" + d.value + "</SID>" } else { if (d.nodeName == "INPUT" && d.name == "cartLineNo") { a += "<CLineNo>" + d.value + "</CLineNo>" } } } } } } } } b = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelLeft"); if (b != null) { a += "<Left>"; if (h) { f = b.innerHTML } for (i = 0; i < b.childNodes.length; i++) { d = b.childNodes.item(i); if (d.nodeName == "INPUT") { a += "<Mounting ID='" + d.value + "' />" } else { if (d.nodeName == "LABEL") { a += "<AddText>" + d.innerHTML + "</AddText>" } else { if (d.nodeName == "DIV") { for (j = 0; j < d.childNodes.length; j++) { var e = d.childNodes.item(j); if (e.nodeName == "IMG") { a += "<Item ID='" + e.alt + "' />"; n = e.alt } else { if (e.nodeName == "SPAN") { distID = ""; for (l = 0; l < e.childNodes.length; l++) { var g = e.childNodes.item(l); if (g.nodeName == "IMG") { m = g.alt.substring(0, g.alt.indexOf("|", 0)); k = g.alt.substring(g.alt.indexOf("|", 0) + 1); if (distID.indexOf(g.alt, 0) == -1) { a += "<Selected ID='" + n + "' AttachID='" + m + "' ListID='" + k + "' />"; distID += "," + g.alt } } } } } } } } } } a += "</Left>" } b = document.getElementById("ctl00_ContentPlaceHolder1_segOptSelRight"); if (b != null) { a += "<Right>"; if (h) { c = b.innerHTML } for (i = 0; i < b.childNodes.length; i++) { d = b.childNodes.item(i); if (d.nodeName == "INPUT") { a += "<Mounting ID='" + d.value + "' />" } else { if (d.nodeName == "LABEL") { a += "<AddText>" + d.innerHTML + "</AddText>" } else { if (d.nodeName == "DIV") { for (j = 0; j < d.childNodes.length; j++) { var e = d.childNodes.item(j); if (e.nodeName == "IMG") { a += "<Item ID='" + e.alt + "' />"; n = e.alt } else { if (e.nodeName == "SPAN") { distID = ""; for (l = 0; l < e.childNodes.length; l++) { var g = e.childNodes.item(l); if (g.nodeName == "IMG") { m = g.alt.substring(0, g.alt.indexOf("|", 0)); k = g.alt.substring(g.alt.indexOf("|", 0) + 1); if (distID.indexOf(g.alt, 0) == -1) { a += "<Selected ID='" + n + "' AttachID='" + m + "' ListID='" + k + "' />"; distID += "," + g.alt } } } } } } } } } } a += "</Right>" } b = document.getElementById("ctl00_ContentPlaceHolder1_segQty"); if (b != null) { for (i = 0; i < b.childNodes.length; i++) { d = b.childNodes.item(i); if (d.nodeName == "TABLE") { for (row = d.rows[0]; row != null; row = row.nextSibling) { if (row.nodeType == 1) { for (cell = row.firstChild; cell != null; cell = cell.nextSibling) { if (cell.nodeType == 1) { for (ctl = cell.firstChild; ctl != null; ctl = ctl.nextSibling) { if (ctl.name == "ddmount") { a += "<RelItem ID='" + ctl.options[ctl.selectedIndex].value + "' />" } else { if (ctl.id == "txtQuantity") { o = ctl.value } } } } } } } } } } a += "<Qty>" + o + "</Qty>"; a += "</Settings>"; if (h == 0) { MC.ENET.BuildService.CalculatePrice(a, OnCalculatePriceSucceeded, OnCalculatePriceFailed) } else { if (h == 1) { MC.ENET.BuildService.AddItemsToCart(a, f, c, OnAddItemsToCartSucceeded, OnAddItemsToCartFailed) } } return false } function OnCalculatePriceFailed() { } function OnCalculatePriceSucceeded(a) { if (a != null) { var b = document.getElementById("ctl00_ContentPlaceHolder1_segQty"); if (b != null) { b.innerHTML = ""; b.innerHTML = a[0] } b = document.getElementById("ctl00_ContentPlaceHolder1_segPrice"); if (b != null) { b.innerHTML = ""; b.innerHTML = a[1] } } } function OnAddItemsToCartFailed() { } function OnAddItemsToCartSucceeded(a) { var c = a.split("||"); var b = c[0]; var d = c[1]; if (d == "true") { GetFloatingCart(b) } else { if (b != null || b.length > 0) { window.location.href = "CartPage" + b } else { window.location.href = "CartPage.aspx" } } };
