/* Append File:brandLeftTreeImg */ var CookieHelper = { trim: function(b) { return (b || "").replace(/^\s+|\s+$/g, "") }, setCookie: function(b, d, a) { if (typeof d != "undefined") { a = a || {}; if (d === null) { d = ""; a.expires = -1 } var c = ""; if (a.expires && (typeof a.expires == "number" || a.expires.toUTCString)) { if (typeof a.expires == "number") { c = new Date; c.setTime(c.getTime() + a.expires * 24 * 60 * 60 * 1E3) } else c = a.expires; c = "; expires=" + c.toUTCString() } var e = a.path ? "; path=" + a.path : "", f = a.domain ? "; domain=" + a.domain : ""; a = a.secure ? "; secure" : ""; document.cookie = [b, "=", encodeURIComponent(d), c, e, f, a].join("") } }, readCookie: function(b) { var d = null; if (document.cookie && document.cookie != "") for (var a = document.cookie.split(";"), c = 0; c < a.length; c++) { var e = this.trim(a[c]); if (e.substring(0, b.length + 1) == b + "=") { d = decodeURIComponent(e.substring(b.length + 1)); break } } return d } } var LeftTree = LeftTree || {}; LeftTree.Tools = { getQueryString: function(data) { var tdata = ''; for (var key in data) { tdata += "&" + encodeURIComponent(key) + "=" + encodeURIComponent(data[key]); } tdata = tdata.replace(/^&/g, ""); return tdata }, addEvent: function(elm, type, fn, useCapture) { if (elm.addEventListener) { elm.addEventListener(type, fn, useCapture); return true; } else if (elm.attachEvent) { var r = elm.attachEvent('on' + type, fn); return r; } else { elm['on' + type] = fn; } }, MathWinHeigth: function() { var winH = 0; if (window.innerHeight) { winH = Math.min(window.innerHeight, document.documentElement.clientHeight); } else if (document.documentElement && document.documentElement.clientHeight) { winH = document.documentElement.clientHeight; } else if (document.body) { winH = document.body.clientHeight; } return winH; }, getElementByClassName: function(tagName, className) { var classObj = document.getElementsByTagName(tagName); var len = classObj.length; for (var i = 0; i < len; i++) { if (classObj[i].className == className) { return classObj[i]; break; } } }, attrStyle: function(elem, attr) { if (!elem) { return; } if (elem.style[attr]) { return elem.style[attr]; } else if (elem.currentStyle) { return elem.currentStyle[attr]; } else if (document.defaultView && document.defaultView.getComputedStyle) { attr = attr.replace(/([A-Z])/g, '-$1').toLowerCase(); return document.defaultView.getComputedStyle(elem, null).getPropertyValue(attr); } else { return null; } }, getOffsetTop: function(element) { var top = 0; while (element) { if (LeftTree.Tools.attrStyle(element, "position") === "fixed") { break; } top += element.offsetTop; element = element.offsetParent; } return top; } }; JsonpCallBack(); var IE6 = !!window.ActiveXObject && !window.XMLHttpRequest; function firstExpandMaster(masterRootLi) {//alert(8) if (masterContent == 'undefined') return; if (masterRootLi == null) return; masterRootLi.innerHTML += getBrandHtml(masterContent, params.tagtaype); } function treeHref(curLitterNum) { //alert(curLitterNum) var hideItemAllHeight = 0; for (var i = 1; i < curLitterNum; i++) { var hideItem = document.getElementById("letter" + i); if (!hideItem) continue; var hideItemHeight = hideItem.offsetHeight - 1; hideItemAllHeight += hideItemHeight; } var treeBox = document.getElementById("treev1"); //�� treeBox.scrollTop = hideItemAllHeight; //alert(hideItemAllHeight) //tree1�߶Ȳ������������¼���߶� if (treeBox.scrollTop < hideItemAllHeight) { //var treeBottom = document.getElementById("tree-bottom"); //treeBottom.style.height = parseInt(treeBottom.style.height) + (hideItemAllHeight - treeBox.scrollTop) + "px"; treeBox.scrollTop = hideItemAllHeight; } } //���㵱ǰ�ڵ㵽���ζ������� function MathCurrentTreeNodeTop(curNode) {//alert(10) var topHeight = 0; if (!curNode) return topHeight; while (curNode && curNode.id != "treev1") { topHeight += curNode.offsetTop; curNode = curNode.offsetParent; } return topHeight; } //������ָ��λ�� function scrollToCurrentTreeNode() {//alert(11) var currentNode = document.getElementById("curObjTreeNode"); var topHeight = MathCurrentTreeNodeTop(currentNode); var treeBox = document.getElementById("treev1"); //�� if (typeof CookieHelper == "undefined") { treeBox.scrollTop = topHeight; return; } var ScrollTreeNodeTop = CookieHelper.readCookie("ScrollTreeNodeTop"); var isMaster = 0; if (currentNode) { var child = currentNode.firstChild; if (child.className && child.className.indexOf("mainBrand") != -1) { isMaster = 1; } } else { ScrollTreeNodeTop = 0; } //��������Լ��ⲿ����������������� if (isMaster == 0 && /(mb_|b_|sb_|master|brand|serial)/gi.test(document.referrer) && document.referrer != "") { topHeight = parseInt(ScrollTreeNodeTop); } treeBox.scrollTop = topHeight; if (topHeight > parseInt(treeBox.scrollTop)) { var treeBottom = document.getElementById("tree-bottom"); treeBottom.style.height = parseInt(treeBottom.style.height) + (topHeight - parseInt(treeBox.scrollTop)) + "px"; treeBox.scrollTop = topHeight; } CookieHelper.setCookie("ScrollTreeNodeTop", parseInt(treeBox.scrollTop), { "expires": 360, "path": "/", "domain": "m.bludragyn.com" }); } //��ȡ��ǰ�ڵ�������Ʒ�ƽڵ� function GetCurrentNodeMaster(curNode) {//alert(12) if (!curNode) { return null; } while (curNode) { var child = curNode.firstChild; if (child.className && child.className.indexOf("mainBrand") != -1) { break; } curNode = curNode.parentNode; } return curNode; } //���㵱ǰչ�������ĸ߶� function MathCurrentNodeMasterHeight(curNode) {//alert(13) var elemHeight = 0; if (!curNode) { return elemHeight; } while (curNode) { var child = curNode.firstChild; if (child.className && child.className.indexOf("mainBrand") != -1) { break; } curNode = curNode.parentNode; } elemHeight = curNode.offsetHeight; return elemHeight; } function treeBoxHeight() {//alert(14) var treeBox = document.getElementById("treev1"); //�� var winH; var topHeight = 0; var bodyClientHeight = document.documentElement.clientHeight; var treeSubNavv1Height = LeftTree.Tools.getElementByClassName("div", "treeSubNavv1"); var IFrameTomHeight = LeftTree.Tools.getElementByClassName("div", "treeNavv1"); var treev1 = document.getElementById("treev1"); var isIE6 = !!window.ActiveXObject && !window.XMLHttpRequest; if (treeBox == null) { return; } while (treeBox) { topHeight += treeBox.offsetTop; treeBox = treeBox.offsetParent; } winH = LeftTree.Tools.MathWinHeigth(); if (topHeight < 1) { topHeight = 0; } if (winH <= topHeight) { winH = topHeight; } if (treev1 != null && treev1.nodeType == 1) { var tree1Height = winH - topHeight; if (tree1Height < 1) { tree1Height = 0; } //treev1.style.height = tree1Height + "px"; } if (treeSubNavv1Height != null && IFrameTomHeight != null && treev1 != null) { if (isIE6) { if (topHeight > (treeSubNavv1Height.clientHeight + IFrameTomHeight.clientHeight)) { if (bodyClientHeight - treeSubNavv1Height.clientHeight - IFrameTomHeight.clientHeight - 10 < 0) { //treev1.style.height = 0; } else { //treev1.style.height = bodyClientHeight - treeSubNavv1Height.clientHeight - IFrameTomHeight.clientHeight - 10; } } } } //���θ߶� var leftTreeBox = document.getElementById("leftTreeBox"); var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; var header = document.getElementById("header"); var headerTop = LeftTree.Tools.getOffsetTop(header); //��ȡ���������붥������ var headerHeight = LeftTree.Tools.attrStyle(header, "height"); //if (scrollTop >= (headerTop + headerHeight)) { scrollHeight += treeFixedNavHeight; } //fixed Ӱ������߶� var leftTreeHeight = winH - headerTop + scrollTop; var treepx = 0; //leftTreeBox.style.height = leftTreeHeight + "px"; //treev1.style.height = (644) + "px"; } //���ݵ�����λ���������ξඥ�߶� function treeFixedNavTop() { var header = document.getElementById("header"); var headerTop = LeftTree.Tools.getOffsetTop(header); //��ȡ���������붥������ var headerHeight = header.offsetHeight; var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; if (scrollTop >= (headerTop + parseInt(headerHeight))) { //document.getElementById("leftTreeBox").style.top = 0 + "px"; return; } //document.getElementById("leftTreeBox").style.top = headerTop + headerHeight - scrollTop + "px"; } //��������Ե����������� function MathScrollSettingTagBar() { window.setTimeout(function() { treeBoxHeight(); }, 250); //�������ĸ߶� treeFixedNavTop(); } //�������ε�����λ�������ĸ߶� function treeHeight() { if (!IE6) { //MathScrollSettingTagBar(); } else { var leftTreeBox = document.getElementById("leftTreeBox"); var leftTreeHeight = LeftTree.Tools.getOffsetTop(leftTreeBox); setTimeout(function() { leftTreeBox.style.top = leftTreeHeight + ie6AdHeight + "px"; }, 500); } }; var ie6AdHeight = 0; function JsonpCallBack() { //alert(18); var jsonTree = brandsSeriesHaveImageGallery; //data; //brandsHaveSeries; var treeHtml = getTreeHtml(jsonTree); var treeBox = document.getElementById("leftTreeBox"); if (treeBox) treeBox.innerHTML = treeHtml; //��ǩ�䴫�ݲ��� scrollToCurrentTreeNode(); LeftTree.Tools.addEvent(window, "load", treeBoxHeight, false); LeftTree.Tools.addEvent(window, "resize", treeBoxHeight, false); //�������¼� var treeBox = document.getElementById("treev1"); LeftTree.Tools.addEvent(treeBox, "scroll", function() { if (typeof CookieHelper == "undefined") return; CookieHelper.setCookie("ScrollTreeNodeTop", parseInt(treeBox.scrollTop), { "expires": 360, "path": "/", "domain": "m.bludragyn.com" }); }, false); //�����¼� LeftTree.Tools.addEvent(window, "scroll", function() { if (!IE6) { //MathScrollSettingTagBar(); } else { var leftTreeBox = document.getElementById("leftTreeBox"); //leftTreeBox.style.top = leftTreeBox + ie6AdHeight + "px"; //29:��½���߶� } }, false); treeHeight(); } //��ȡ�ַ�html function getCharNavHtml(charObj, valObj) { //alert(charObj) var html = "
"; var num = 0; for (var key in charObj) { var k = 0; num++; for (var i = 0; i < valObj.length; i++) { if (charObj[key] == valObj[i]) { k++; break; } }; if (k > 0) { html += "
- " + key + "
"; } else { //html += "
- " + key + "
"; } } html += "
"; return html; } //��ȡ�����html function getTreeHtml(jsonTree) { var abcHaveBrands = { A: "A", B: "B", C: "C", D: "D", E: "E", F: "F", G: "G", H: "H", I: "I", J: "J", K: "K", L: "L", M: "M", N: "N", O: "O", P: "P", Q: "Q", R: "R", S: "S", T: "T", U: "U", V: "V", W: "W", X: "X", Y: "Y", Z: "Z" }; if (abcHaveBrands == "undefined") return ""; var html = getCharNavHtml(abcHaveBrands, brandsSeriesHaveImageGallery_HaveCount); //); html += "
"; var i = 0; var v = brandsSeriesHaveImageGallery; var objbhs = eval(brandsSeriesHaveImageGallery); var hts = ""; var htm = ""; for (var firstChar in abcHaveBrands) { i++; var k = 0; for (var o = 0; o < brandsSeriesHaveImageGallery_HaveCount.length; o++) { if (firstChar == brandsSeriesHaveImageGallery_HaveCount[o]) { k++; break; } }; if (k > 0) { html += "
- " + firstChar + ""; html += "
"; htm = ""; jQuery.each(v, function(i, k) { if (k.initials == firstChar) { var className = "mainBrand"; var curIdStr = ""; if (k.initials != "" && typeof (k.initials) != "undefined") { className = "mainBrand current current_unfold"; } else { className = "mainBrand current_unfold"; } htm += "
- " + k.name + ""; if (k.config != null && k.config.length > 0) { //С htm += "
"; if (k.congif == "cs") { } else { var curIdStr = ""; jQuery.each(k.config, function(_i, _k) { if (_k.config != null && _k.config.length > 0) { var className = "brandType"; } htm += "
- " + _k.brandsName + ""; if (_k.config != null && _k.config.length > 0) { jQuery.each(_k.config, function(__i, __k) { var className = "subBrand"; htm += "
- " + __k.seriesName + ""; htm += "
"; }); } }); } htm += "
"; } //С htm += " "; //�� } }); html += htm; html += "
"; } } html += "
";// style=\"height:10px; overflow:hidden\" return html; } $("#treev1 a").bind("click", function() { $(this).next().toggle(); }); function LetterNumber(letter) { switch (letter.toUpperCase()) { case "A": return 1; case "B": return 2; case "C": return 3; case "D": return 4; case "E": return 5; case "F": return 6; case "G": return 7; case "H": return 8; case "I": return 9; case "J": return 10; case "K": return 11; case "L": return 12; case "M": return 13; case "N": return 14; case "O": return 15; case "P": return 16; case "Q": return 17; case "R": return 18; case "S": return 19; case "T": return 20; case "U": return 21; case "V": return 22; case "W": return 23; case "X": return 24; case "Y": return 25; case "Z": return 26; } }