usingNamespace("Biz.ShellShocker")["DealsScheduleBar"] = {ItemList: new Array(),ItemTypes: new Array(),CacheExpiration: 180000,CurrentItemIndex: 0,LastFreshTime: new Date(),LastQueryParam: "",LastQueryItemType: -1,LastQueryItemTransNo: -1,QueryMaxInterval: 250,QueryTimes: 0,QueueMaxLen: 1,ItemSwiper: new Object(),SwiperIndexMap: new Array(),IsQuerying: false,init: function (needCache, cacheExpiration, itemCount) {var dsb = this;var list = jQuery("#hdDealsItemList").val();if (index == "" || list == "") {return;}this.CurrentItemIndex = parseInt(index);var ilist = list.split(",");this.ItemList = ilist;this.CacheExpiration = cacheExpiration * 60 * 1000;this.ItemSwiper = new Swiper('#shellShocker2013 .swiper-container', {slidesPerSlide: 1,loop: false,onTouchMove: function () {if (!dsb.IsQuerying) {var queryIndex = -1;var d = dsb.moveDirection();dsb.updateActiveSlide();dsb.CurrentItemIndex = dsb.SwiperIndexMap[dsb.ItemSwiper.activeIndex];if (d == -1 && dsb.ItemList[dsb.CurrentItemIndex + 1] != undefined) {queryIndex = dsb.CurrentItemIndex + 1;}else if (d == 1 && dsb.ItemList[dsb.CurrentItemIndex - 1] != undefined) {queryIndex = dsb.CurrentItemIndex - 1;}if (queryIndex >= 0) {dsb.IsQuerying = true;dsb.changeDetail(dsb.ItemList[queryIndex], dsb.ItemTypes[queryIndex]);}}}});var el = this.ItemSwiper.wrapper;var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];for (var i = 0; i < events.length; i++) {el.addEventListener(events[i], function () {var active_slide = '.time-tab' + dsb.SwiperIndexMap[dsb.ItemSwiper.activeIndex];jQuery('.time-tab').removeClass('selected');jQuery(active_slide).addClass('selected');}, false)}jQuery('.time-tabs a').each(function (index) {jQuery(this).click(function (e) {e.preventDefault();jQuery('.time-tab').removeClass('selected');jQuery(this).parent().addClass('selected');});});this.SwiperIndexMap[0] = parseInt(index);for (var i = 1; i < itemCount; i++) {this.SwiperIndexMap[i] = -1;}},moveDirection: function () {var x = this.ItemSwiper.getWrapperTranslate("x");if (x < -(this.ItemSwiper.activeSlide /*+ 0.3*/) * this.ItemSwiper.width) {/*left*/return -1;}else if (x > -(this.ItemSwiper.activeSlide/* - 0.3*/) * this.ItemSwiper.width) {/*right*/return 1;}else {return 0;}},updateActiveSlide: function () {var x = this.ItemSwiper.getWrapperTranslate("x");this.ItemSwiper.activeSlide = parseInt(-x / this.ItemSwiper.width);},clickTime: function (item, t) {this.changeDetail(item, t);this.slide();},changeDetail: function (item, t) {for (var i = 0; i < this.ItemList.length; i++) {if (item == this.ItemList[i]) {this.CurrentItemIndex = i;break;}}this.queryItemDetail(item, t);},queryItemDetail: function (item, t) {if (typeof (item) == undefined || typeof (t) == undefined || item == "" || t == "") {this.IsQuerying = false;return;}var para = "TransNo=" + item + "&DealType=" + t + "&IsHomePage=1&HomepageVersion=2013&Index=" + (this.CurrentItemIndex + 1);if (para == this.LastQueryParam) {this.IsQuerying = false;return;}this.LastQueryParam = para;this.LastQueryItemType = t;this.LastQueryItemTransNo = item;var now = new Date();var itemQueried = false;for (var i = 0; i < this.SwiperIndexMap.length; i++) {if (this.SwiperIndexMap[i] == this.CurrentItemIndex) {itemQueried = true;break;}}var needQuery = !itemQueried || (now.getTime() - this.LastFreshTime.getTime() > this.CacheExpiration);if (needQuery) {this.LastFreshTime = new Date();this.QueryTimes++;if (jQuery("#ShellShockerOverlay").css("display") != "") {this.loading();}setTimeout("Biz.ShellShocker.DealsScheduleBar.getData('" + para + "','" + this.CurrentItemIndex + "');", this.QueryMaxInterval);}else {Web.StateManager.Cookies.save(Web.StateManager.Cookies.Name.CFG, { "w44": this.LastQueryItemTransNo });Web.StateManager.Cookies.save(Web.StateManager.Cookies.Name.CFG, { "w45": this.LastQueryItemType });this.IsQuerying = false;}},getData: function (para, index) {var dsb = this;if (dsb.QueryTimes <= dsb.QueueMaxLen) {jQuery("body").queue(function () {jQuery.get(Web.UI.ResourceManager.Url.www("Common/Ajax/ShellShocker.aspx"), para, function (data) {var itemIndex = jQuery(data).find("#ItemIndex").val() - 1;dsb.insertSlide(jQuery(data).find("#HomepageItemCell").html(), itemIndex);Web.StateManager.Cookies.save(Web.StateManager.Cookies.Name.CFG, { "w44": dsb.LastQueryItemTransNo });Web.StateManager.Cookies.save(Web.StateManager.Cookies.Name.CFG, { "w45": dsb.LastQueryItemType });var countdownDivId = jQuery(data).find("#CountdownDivId").val();var remainTime = parseFloat(jQuery(data).find("#RemainTime").val());if (countdownDivId && remainTime) {jQuery("#" + countdownDivId).countdown({timestamp: (new Date()).getTime() + remainTime}, function () {dsb.QueueMaxLen++;dsb.QueryTimes++;dsb.getData(para, index);});}var coremetricsData = jQuery(data).find("#CoremetricsData").val();if (coremetricsData) {Biz.Common.Coremetric.send("ShellShocker" + (itemIndex + 1), JSON.parse(coremetricsData));}dsb.IsQuerying = false;jQuery("body").dequeue();});});}else {for (var i = 0; i < this.SwiperIndexMap.length; i++) {if (this.SwiperIndexMap[i] == index) {this.unloading(i);break;}}}dsb.QueryTimes--;},insertSlide: function (data, index) {for (var i = 0; i < this.SwiperIndexMap.length ; i++) {if (this.SwiperIndexMap[i] == index) {/*swiper's bug in IE 8, cannot insert slide after the last one*/if (this.SwiperIndexMap[i + 1] < 0 || this.SwiperIndexMap[i + 1] == undefined) {this.ItemSwiper.createSlide(data).append();}else {this.ItemSwiper.createSlide(data).insertAfter(i);}this.ItemSwiper.removeSlide(i);break;}else if (this.SwiperIndexMap[i] < 0) {this.ItemSwiper.createSlide(data).append();this.SwiperIndexMap[i] = index;break;}else if (this.SwiperIndexMap[i] < index) {continue;}else if (this.SwiperIndexMap[i] > index) {/*this.ItemSwiper.insertSlideAfter(i - 1, data);this doesn's work well when i=1*/if (i == this.ItemSwiper.activeSlide) {this.ItemSwiper.positions.start -= this.ItemSwiper.width;this.ItemSwiper.positions.current = this.ItemSwiper.getWrapperTranslate("x") - this.ItemSwiper.width;}this.ItemSwiper.createSlide(data).insertAfter(i - 1);for (var j = this.SwiperIndexMap.length - 1; j > i ; j--) {this.SwiperIndexMap[j] = this.SwiperIndexMap[j - 1];}this.SwiperIndexMap[i] = index;break;}}},slide: function () {for (var i = 0; i < this.SwiperIndexMap.length; i++) {if (this.SwiperIndexMap[i] == this.CurrentItemIndex) {var that = this;setTimeout(function () {that.ItemSwiper.swipeTo(i, 400, false)}, 30);break;}}},loading: function () {this.insertSlide("
", this.CurrentItemIndex);},unloading: function (index) {if (jQuery(Biz.ShellShocker.DealsScheduleBar.ItemSwiper.slides[index]).find("#ShellShockerOverlay_" + index.toString())) {this.ItemSwiper.removeSlide(index);for (var i = index; i < this.SwiperIndexMap.length - 1; i++) {this.SwiperIndexMap[i] = this.SwiperIndexMap[i + 1];}}}};usingNamespace("Biz.HomePage")["HomePage2011"] = {popupInit: function () {jQuery("a[rel='modal1']").click(function () {switch (jQuery(this).attr("name")) {case "a-seller":jQuery('#AlarmPanelNew .title').text(Web.Lang.marketplaceSeller);break;case "ship-free":jQuery('#AlarmPanelNew .title').text(Web.Lang.shippingRestrictions);jQuery('#AlarmPanelNew').attr('class', 'atnIcon icnInfoNew');break;case "ship-by-newegg":jQuery('#AlarmPanelNew .title').text(Web.Lang.shippedByNewegg);break;case "terms-mfrwarranty":jQuery('#AlarmPanelNew .title').text(Web.Lang.warrantyInfo);break;}Biz.HomePage.HomePage2011.popupDiv(this, 400, 200);});jQuery("#overlay").click(function () { Biz.HomePage.HomePage2011.closePopup() });Biz.HomePage.HomePage2011.resetPopup();jQuery(document).keypress(function (e) {if (jQuery("#modal1").css("display") == "block" && (e.which == 0 || e.which == 27)) {Biz.HomePage.HomePage2011.closePopup();return false;}return true;});},popupDiv: function (o, w, h) {o.blur();var vp = Biz.Common.Viewport;var wuc = Web.UI.Control;var pos = jQuery(o).offset();var width = jQuery(o).width();var pX = (pos.left + width < vp.right() - w) ? pos.left + width : vp.right() - w;var pY = (pos.top < vp.bottom() - h) ? pos.top : vp.bottom() - h;var body = document.getElementsByTagName("body")[0];jQuery("#modal1").css({ "left": pX + "px", "top": pY + "px" });jQuery("#modal1").removeClass('objVideo');jQuery("#modal1").children(".content").html('');jQuery("#modal1").toggleClass('loading');jQuery("#overlay").css("display", "block");if (Web.Environment.Browser.currentVersion() == Web.Enum.Browser.IE_6) {wuc.setAttribute($("overlay"), { "style.height": (body.scrollHeight + 50) + "px" });wuc.setAttribute($("overlay"), { "style.width": (body.scrollWidth) + "px" });$("overlay").innerHTML = "";wuc.setAttribute($("modal1"), { "style.height": "6em" });};jQuery("#modal1").show("fast");jQuery("#modal1").children(".content").html($(o.id + "_Content").innerHTML);return false;},closePopup: function () {jQuery("#modal1").hide("fast");jQuery("#overlay").css("display", "none");Biz.HomePage.HomePage2011.resetPopup();return true;},resetPopup: function () {jQuery('#AlarmPanelNew').attr('class', 'atnIcon icnInfo');jQuery('#AlarmPanelNew .title').text('');jQuery('#AlarmPanelNew').find("img").css("display", "");}};usingNamespace("Biz.Subscribe")["SubscribeToEmail2011"] = {nSubmit: function (subUrl) {var result = Biz.Common.NewsletterSingup.nSubmit('Newsletter', 'LoginName');if (result) {jQuery("#divNormal").css("display", "none");jQuery("#divSubmitSucceed").css("display", "block");if (Web.Config.SiteCatalyst.Enable) {Biz.Common.SiteCatalyst.sendForOnClick({ 'events': 'event21', 'eVar27': scp.pageName ? scp.pageName : (scp.cmPageName ? scp.cmPageName : void (0)), 'eVar49': 'email' }, 'email sign up');}document.forms["Newsletter"].submit();}else {document.getElementById("LoginName").focus();}}};NEG.Module("Biz.HomePage2013.Personalization", function (require) {var jQuery = require("NEG.ThirdParty.JQuery");var storage = require('Biz.Storage');var resourceMananger = require("Biz.UI.ResourceManager");function Personalization() {var viewedItem = storage.getItem("ItemViewed", new Array());var shoppingCartItem = Biz.Common.ShoppingItem.extractFromOrderInfo();var wishlistItem = Web.StateManager.Cookies.get("NV_WISHLIST");var orderedItem = Web.StateManager.Cookies.get(Web.StateManager.Cookies.Name.PRDLIST, "ItemOrdered");var searchKeyword = storage.getItem("ItemSearchKeywords", "");var subCookie = function (source, maxlength, delimiter) {var result = source;if (source) {var sourceArray = source.split(delimiter);if (sourceArray.length > maxlength) {result = sourceArray.slice(0, maxlength).join(delimiter);}}return result;};var getParameters = function () {var viewedItems = viewedItem.join("#");var shoppingCartItems = subCookie(shoppingCartItem, 20, "&");var wishlistItems = subCookie(wishlistItem, 20, "&");var orderedItems = subCookie(orderedItem, 10, ",");var searchKeywords = "";if (searchKeyword) {var keyValue = searchKeyword.split("|");if (keyValue.length >= 2) {searchKeywords = keyValue[1];}}return "v=" + escape(viewedItems) + "&s=" + escape(shoppingCartItems) + "&w=" + escape(wishlistItems) + "&o=" + escape(orderedItems) + "&k=" + escape(searchKeywords);};var getAjaxParameters = function () {return "q=" + Biz.HomePage2013.Config.FilterItem + "&" + getParameters() + "&ispreview=" + Biz.HomePage2013.Config.IsPerEdit + "&HomepageVersion=2013";};var api = {getData: function () {var script = document.getElementById("personalizationAjaxJs");if (script && script != null) {document.getElementsByTagName('head')[0].removeChild(script);}script = document.createElement("script");script.type = "text/javascript";script.id = 'personalizationAjaxJS';script.src = resourceMananger.Url.www("Common/Ajax/PersonalizationHomePage.aspx") + "?" + getAjaxParameters();document.getElementsByTagName('head')[0].appendChild(script);},renderData: function (pData) {if (pData.length > 0) {var modules = pData.split("|||###|||");if (modules != null && modules.length > 0) {jQuery("#personalizationContent1 .loader").remove();if (modules[0] != null) {jQuery("#personalizationContent1").append(modules[0]);}if (modules[1] != null) {jQuery("#personalizationContent2").append(modules[1]);}};var perModules = jQuery("a[href*='Product/ProductList.aspx?Submit=Pers']");jQuery.each(perModules, function (index, value) {value.href += "&" + getParameters();});if (Biz.Personalization2013 && Biz.Personalization2013.Top) {var $loopTop = Biz.Personalization2013.Top.Count > 1 ? true : false;var personalization2013Top = Biz.Personalization2013.Top.CoremetricData || {};var swPersonalization2013 = new Swiper('#personalizationContent1 .swiper-container', {pagination: $loopTop ? '#personalizationContent1 .pagination' : "",loop: $loopTop,simulateTouch: $loopTop,onSlideChangeEnd: function () {var currentID = jQuery(swPersonalization2013.activeSlide()).attr("data-cm-groupid");if (personalization2013Top && personalization2013Top.length > 0) {Biz.Common.Coremetric.send(currentID, Biz.Personalization2013.Top.CoremetricData, true);Biz.Common.SiteCatalyst.sendCache("list1", "dynamic recommendation click");}}});var activeSliderID = jQuery(swPersonalization2013.activeSlide()).attr("data-cm-groupid");Biz.Common.Coremetric.send(activeSliderID, personalization2013Top, true);if ($loopTop) {jQuery('#personalizationContent1 .swiper-container .arrow-left').click(function (e) {e.preventDefault();swPersonalization2013.swipePrev();});jQuery('#personalizationContent1 .swiper-container .arrow-right').click(function (e) {e.preventDefault();swPersonalization2013.swipeNext();});}}if (Biz.Personalization2013 && Biz.Personalization2013.Left) {var $loopLeft = Biz.Personalization2013.Left.Count > 1 ? true : false;var personalization2013Left = Biz.Personalization2013.Left.CoremetricData || {};var swPersonalization2013Left = new Swiper('#personalizationContent2 .swiper-container', {pagination: $loopLeft ? '#personalizationContent2 .pagination' : "",loop: $loopLeft,simulateTouch: $loopLeft,onSlideChangeEnd: function () {var currentID = jQuery(swPersonalization2013Left.activeSlide()).attr("data-cm-groupid");if (personalization2013Left && personalization2013Left.length > 0) {Biz.Common.Coremetric.send(currentID, Biz.Personalization2013.Left.CoremetricData, true);Biz.Common.SiteCatalyst.sendCache("list1", "dynamic recommendation click");}}});var activeSliderID = jQuery(swPersonalization2013Left.activeSlide()).attr("data-cm-groupid");Biz.Common.Coremetric.send(activeSliderID, personalization2013Left, true);if ($loopLeft) {jQuery('#personalizationContent2 .swiper-container .arrow-left').click(function (e) {e.preventDefault();swPersonalization2013Left.swipePrev();});jQuery('#personalizationContent2 .swiper-container .arrow-right').click(function (e) {e.preventDefault();swPersonalization2013Left.swipeNext();});}}if (Biz.Personalization2013 && Biz.Personalization2013.Right) {Biz.Common.Coremetric.send("Right1", Biz.Personalization2013.Right.CoremetricData, true);}Biz.Common.SiteCatalyst.sendCache("list1", "dynamic recommendation impression");Biz.HomePage.HomePage2011.popupInit();} else {jQuery("#personalizationContent1 .loader").remove();}},renderData4Region: function (pData) {if (pData.length > 0) {var modules = pData.split("|||###|||");var displayModuleCounts = 0;if (modules != null && modules.length > 0) {displayModuleCounts = 1;var otherModulesDivHolder = "";var modulesCounts = modules.length;for (var i = 1; i < modulesCounts; i++) {if (modules[i].length > 0) {displayModuleCounts++;var tempDiv = "";otherModulesDivHolder = otherModulesDivHolder + tempDiv;}}jQuery("#personalizationContent1").after(otherModulesDivHolder);jQuery("#personalizationContent1 .loader").remove();if (modules[0].length > 0) {jQuery("#personalizationContent1").append(modules[0]);}for (var i = 1; i < modulesCounts; i++) {if (modules[i].length > 0) {var id = i + 1;var currentId = "#personalizationContent" + id;jQuery(currentId).append(modules[i]);}}var perModules = jQuery("a[href*='Product/ProductList.aspx?Submit=Pers']");jQuery.each(perModules, function (index, value) {value.href += "&" + getParameters();});};var swPersonalization2013Array = new Array();var displayModules = [];for (var j = 0; j < displayModuleCounts; j++) {displayModules.push(j);}var $loopTop = false;displayModules.forEach(function (value, index) {var tempTopN;var j = index + 1;switch (j) {case 1:tempTopN = Biz.Personalization2013.Top1;break;case 2:tempTopN = Biz.Personalization2013.Top2;break;case 3:tempTopN = Biz.Personalization2013.Top3;break;case 4:tempTopN = Biz.Personalization2013.Top4;break;case 5:tempTopN = Biz.Personalization2013.Top5;break;case 6:tempTopN = Biz.Personalization2013.Top6;break;case 7:tempTopN = Biz.Personalization2013.Top7;break;default:}if (Biz.Personalization2013 && tempTopN) {$loopTop = tempTopN.Count > 1 ? true : false;var personalization2013Top = tempTopN.CoremetricData || {};var tempSwiper = "#personalizationContent" + j + " .swiper-container";var tempPagination = "#personalizationContent" + j + " .pagination";var swPersonalization2013 = new Swiper(tempSwiper, {pagination: $loopTop ? tempPagination : "",loop: $loopTop,simulateTouch: $loopTop,onSlideChangeEnd: function () {var currentID = jQuery(swPersonalization2013.activeSlide()).attr("data-cm-groupid");if (personalization2013Top && personalization2013Top.length > 0) {Biz.Common.Coremetric.send(currentID, tempTopN.CoremetricData, true);Biz.Common.SiteCatalyst.sendCache("list1", "dynamic recommendation click");}}});var activeSlideID = jQuery(swPersonalization2013.activeSlide()).attr("data-cm-groupid");Biz.Common.Coremetric.send(activeSlideID, personalization2013Top, true);Biz.Common.SiteCatalyst.sendCache("list1", "dynamic recommendation impression");swPersonalization2013Array.push(swPersonalization2013);}});if ($loopTop) {switch (displayModuleCounts) {case 7:jQuery("#personalizationContent7 .swiper-container .arrow-left").click(function (e) {e.preventDefault();swPersonalization2013Array[6].swipePrev();});jQuery("#personalizationContent7 .swiper-container .arrow-right").click(function (e) {e.preventDefault();swPersonalization2013Array[6].swipeNext();});case 6:jQuery("#personalizationContent6 .swiper-container .arrow-left").click(function (e) {e.preventDefault();swPersonalization2013Array[5].swipePrev();});jQuery("#personalizationContent6 .swiper-container .arrow-right").click(function (e) {e.preventDefault();swPersonalization2013Array[5].swipeNext();});case 5:jQuery("#personalizationContent5 .swiper-container .arrow-left").click(function (e) {e.preventDefault();swPersonalization2013Array[4].swipePrev();});jQuery("#personalizationContent5 .swiper-container .arrow-right").click(function (e) {e.preventDefault();swPersonalization2013Array[4].swipeNext();});case 4:jQuery("#personalizationContent4 .swiper-container .arrow-left").click(function (e) {e.preventDefault();swPersonalization2013Array[3].swipePrev();});jQuery("#personalizationContent4 .swiper-container .arrow-right").click(function (e) {e.preventDefault();swPersonalization2013Array[3].swipeNext();});case 3:jQuery("#personalizationContent3 .swiper-container .arrow-left").click(function (e) {e.preventDefault();swPersonalization2013Array[2].swipePrev();});jQuery("#personalizationContent3 .swiper-container .arrow-right").click(function (e) {e.preventDefault();swPersonalization2013Array[2].swipeNext();});case 2:jQuery("#personalizationContent2 .swiper-container .arrow-left").click(function (e) {e.preventDefault();swPersonalization2013Array[1].swipePrev();});jQuery("#personalizationContent2 .swiper-container .arrow-right").click(function (e) {e.preventDefault();swPersonalization2013Array[1].swipeNext();});case 1:jQuery("#personalizationContent1 .swiper-container .arrow-left").click(function (e) {e.preventDefault();swPersonalization2013Array[0].swipePrev();});jQuery("#personalizationContent1 .swiper-container .arrow-right").click(function (e) {e.preventDefault();swPersonalization2013Array[0].swipeNext();});default:}}Biz.HomePage.HomePage2011.popupInit();} else {jQuery("#personalizationContent1 .loader").remove();}}};return api;}return Personalization;});NEG.Module("Biz.HomePage2016.Personalization4Global", function (require) {var jQuery = require("NEG.ThirdParty.JQuery");var storage = require('Biz.Storage');var resourceMananger = require("Biz.UI.ResourceManager");function Personalization() {var viewedItem = storage.getItem("ItemViewed", new Array());var shoppingCartItem = Biz.Common.ShoppingItem.extractFromOrderInfo();var wishlistItem = Web.StateManager.Cookies.get("NV_WISHLIST");var orderedItem = Web.StateManager.Cookies.get(Web.StateManager.Cookies.Name.PRDLIST, "ItemOrdered");var searchKeyword = storage.getItem("ItemSearchKeywords", "");var subCookie = function (source, maxlength, delimiter) {var result = source;if (source) {var sourceArray = source.split(delimiter);if (sourceArray.length > maxlength) {result = sourceArray.slice(0, maxlength).join(delimiter);}}return result;};var getParameters = function () {var viewedItems = viewedItem.join("#");var shoppingCartItems = subCookie(shoppingCartItem, 20, "&");var wishlistItems = subCookie(wishlistItem, 20, "&");var orderedItems = subCookie(orderedItem, 10, ",");var searchKeywords = "";if (searchKeyword) {var keyValue = searchKeyword.split("|");if (keyValue.length >= 2) {searchKeywords = keyValue[1];}}return "v=" + escape(viewedItems) + "&s=" + escape(shoppingCartItems) + "&w=" + escape(wishlistItems) + "&o=" + escape(orderedItems) + "&k=" + escape(searchKeywords);};var getAjaxParameters = function () {return getParameters() + "&ispreview=" + Biz.HomePage2016.Config.IsPerEdit;};var api = {getData: function () {var script = document.getElementById("personalizationAjaxJs");if (script && script != null) {document.getElementsByTagName('head')[0].removeChild(script);}script = document.createElement("script");script.type = "text/javascript";script.id = 'personalizationAjaxJS';script.src = resourceMananger.Url.www("Common/Ajax/PersonalizationHomePage4Global.aspx") + "?" + getAjaxParameters();document.getElementsByTagName('head')[0].appendChild(script);},renderData4Region: function (pData) {if (pData.length > 0) {var modules = pData.split("|||###|||");if (modules != null && modules.length > 0) {jQuery("#personalizationAllContent .loader").remove();if (modules[0].length > 0) {jQuery("#personalizationAllContent").append(modules[0]);}};Biz.HomePage.HomePage2011.popupInit();} else {jQuery("#personalizationAllContent .loader").remove();}}};return api;}return Personalization;});NEG.Module("Biz.HomePage2016.Personalization", function (require) {var jQuery = require("NEG.ThirdParty.JQuery");var storage = require('Biz.Storage');var resourceMananger = require("Biz.UI.ResourceManager");function personalization() {var viewedItem = storage.getItem("ItemViewed", new Array());var shoppingCartItem = Biz.Common.ShoppingItem.extractFromOrderInfo();var wishlistItem = Web.StateManager.Cookies.get("NV_WISHLIST");var orderedItem = Web.StateManager.Cookies.get(Web.StateManager.Cookies.Name.PRDLIST, "ItemOrdered");var searchKeyword = storage.getItem("ItemSearchKeywords", "");var subCookie = function (source, maxlength, delimiter) {var result = source;if (source) {var sourceArray = source.split(delimiter);if (sourceArray.length > maxlength) {result = sourceArray.slice(0, maxlength).join(delimiter);}}return result;};var getParameters = function () {var viewedItems = viewedItem.join("#");var shoppingCartItems = subCookie(shoppingCartItem, 20, "&");var wishlistItems = subCookie(wishlistItem, 20, "&");var orderedItems = subCookie(orderedItem, 10, ",");var searchKeywords = "";if (searchKeyword) {var keyValue = searchKeyword.split("|");if (keyValue.length >= 2) {searchKeywords = keyValue[1];}}return "v=" + escape(viewedItems) + "&s=" + escape(shoppingCartItems) + "&w=" + escape(wishlistItems) + "&o=" + escape(orderedItems) + "&k=" + escape(searchKeywords);};var getAjaxParameters = function () {return "q=" + Biz.HomePage2016.Config.FilterItem + "&" + getParameters() + "&ispreview=" + Biz.HomePage2016.Config.IsPerEdit + "&HomepageVersion=2016";};var api = {getData: function () {var script = document.getElementById("personalizationAjaxJs");if (script) {document.getElementsByTagName('head')[0].removeChild(script);}script = document.createElement("script");script.type = "text/javascript";script.id = 'personalizationAjaxJS';script.src = resourceMananger.Url.www("Common/Ajax/PersonalizationHomePage.aspx") + "?" + getAjaxParameters();document.getElementsByTagName('head')[0].appendChild(script);},renderData: function (pData) {if (pData.length > 0) {var modules = pData.split("|||###|||");if (modules != null && modules.length > 1) {jQuery("#personalizationContent1 .loader").remove();if (modules[0] == "" && modules[1] == "") {return;}for (var i = 0; i < modules.length; i++) {if (i <= 1 && Biz.HomePage2016.Config.PersonalizationDisplay) {jQuery("#personalizationContent" + (i + 1)).append(modules[i]);} else if (i > 1 && Biz.HomePage2016.Config.PopularDealsDisplay) {jQuery("#popularDeals ul").append(modules[i]);}}};var perModules = jQuery("a[href*='Product/ProductList.aspx?Submit=Pers']");jQuery.each(perModules, function (index, value) {value.href += "&" + getParameters();});} else {jQuery("#homepage2016-section3").remove();return;};Biz.Common.Swiper.init("#personalizationContent1");Biz.Common.Swiper.init("#personalizationContent2");Biz.HomePage.HomePage2011.popupInit();}};return api;}return personalization;});NEG.Module("Biz.HomePage2016.WeRecommend", function (require) {var jQuery = require("NEG.ThirdParty.JQuery");var resourceMananger = require("Biz.UI.ResourceManager");return function () {var api = {getData: function () {var script = document.getElementById("weRecommendAjaxJs");if (script) {document.getElementsByTagName('head')[0].removeChild(script);}script = document.createElement("script");script.type = "text/javascript";script.id = 'weRecommendAjaxJs';script.src = resourceMananger.Url.www("Common/Ajax/WeRecommendHomePage.aspx") + "?HomepageVersion=2016";document.getElementsByTagName('head')[0].appendChild(script);},renderData: function (data) {jQuery("#BestSellers .loader").remove();if (data && data.length > 0) {jQuery("#BestSellers").append(data);Biz.Common.Swiper.init("#BestSellers");}}};return api;};});NEG.Module("Biz.HomePage2016.LazyLoad", function (require) {var jQuery = require("NEG.ThirdParty.JQuery"),viewprot = require("NEG.Widget.Viewport"),personalization = require("Biz.HomePage2016.Personalization");Personalization4Global = require("Biz.HomePage2016.Personalization4Global");return function () {var api = {init: function () {var views = [],lazyModules = [];if (Biz.HomePage2016.Config.PersonalizationDisplay) {lazyModules.push({ "personalizationContent1": personalization });}if (Biz.HomePage2016.Config.Personalization4GlobaDisplay) {lazyModules.push({ "personalizationAllContent": Personalization4Global });}if (Biz.HomePage2016.Config.PopularDealsDisplay && !Biz.HomePage2016.Config.PersonalizationDisplay) {lazyModules.push({ "popularDeals": personalization });}if (!Biz.HomePage2016.Config.PopularDealsDisplay && !Biz.HomePage2016.Config.PersonalizationDisplay) {jQuery("#homepage2016-section3").remove();}for (var lmIndex = 0; lmIndex < lazyModules.length; lmIndex++) {var lmItem = lazyModules[lmIndex];for (key in lmItem) {views.push(jQuery("#" + key)[0]);}}var lazyloadViewport = viewprot(views);lazyloadViewport.on("FIRSTIN", function (dom) {var jDom = jQuery(this);if (!jDom) {return;}var jDomId = jDom.attr("id");if (!jDomId) {return;}var arrayValue;for (var lmIndex = 0; lmIndex < lazyModules.length; lmIndex++) {var lmItem = lazyModules[lmIndex];for (key in lmItem) {if (key === jDomId) {arrayValue = lmItem[key];break;}}}if (arrayValue) {var runFunc = arrayValue();if (runFunc) {runFunc.getData();}}});setTimeout(function () { window.scrollBy(0, 1); }, 3000);}};return api;};});NEG.Module("Biz.ShellShocker.CountDown", function (require) {var $ = jQuery,COUNT_DOWN_HTML = ' \: \ \: \';var countdown = function (selector, option) {var me = arguments.callee;if (!(this instanceof me))return new me(selector, option);var container = $(selector),_option = NEG.merge({callback: null,interval: 1000,lastTimeClass: '.lastTime'},option);if (container.length == 0) return;var StartTimeout = function (obj) {setTimeout(function () {TickStart(obj);}, _option.interval);};var TickStart = function (obj) {(function Tick() {if (typeof obj.timeup != 'undefined' && obj.timeup) {CallbackFunc();} else {if (container.tickList.length >= container.length) {container.tickList.shift();}CalculateTIme(obj);ReplaceDOM(obj);container.tickList.push(setTimeout(Tick, _option.interval));}})();};var CalculateTIme = function (obj) {if (obj.sec > 0) {obj.sec -= 1;} else if (obj.sec == 0 && obj.min > 0) {obj.min -= 1;obj.sec = 59;} else if (obj.sec == 0 && obj.min == 0 && obj.hour > 0) {obj.hour -= 1;obj.min = 59;obj.sec = 59;}if (obj.sec != 0 || obj.min != 0 || obj.hour != 0) {return;}obj.timeup = true;};var ReplaceDOM = function (obj) {$('.hh1', obj).text(TimeFormat(obj.hour, 0));$('.hh2', obj).text(TimeFormat(obj.hour, 1));$('.mm1', obj).text(TimeFormat(obj.min, 0));$('.mm2', obj).text(TimeFormat(obj.min, 1));$('.ss1', obj).text(TimeFormat(obj.sec, 0));$('.ss2', obj).text(TimeFormat(obj.sec, 1));};var TimeFormat = function (num, position) {var str = num.toString();if (str.length < 2) str = "0" + str;return str.substr(position, position + 1);};var CallbackFunc = function () {container.tickList.forEach(function (timerId) {clearTimeout(timerId);});if (typeof _option.callback === 'function') {_option.callback();}};container.tickList = [];for (var i = 0; i < container.length; i++) {container[i] = $(container[i]);var lastTime = $(".lastTime", container[i]);container[i].append(COUNT_DOWN_HTML);container[i].lastTime = lastTime.text();lastTime.remove();container[i].timeArray = container[i].lastTime.split(":");container[i].hour = parseInt(container[i].timeArray[0]);container[i].min = parseInt(container[i].timeArray[1]);container[i].sec = parseInt(container[i].timeArray[2]);ReplaceDOM(container[i]);StartTimeout(container[i]);}};return countdown;});usingNamespace("Biz.HomePage2016")["ShellShocker"] = {init: function () {this.processCurrentDisplayItem();},processCurrentDisplayItem: function () {try {var countDownItems = jQuery("#ShellShocker .countdown-wrap");var allDisplayItems = jQuery("#ShellShocker .swiper-pagination-bullet");var randomInTopN = allDisplayItems.length - countDownItems.length;var currentIndex = Math.floor(Math.random() * randomInTopN);jQuery("#ShellShocker .swiper-pagination-bullet")[currentIndex].click();} catch (e) {jQuery("#ShellShocker .swiper-pagination-bullet")[0].click();}},superDealsBar: function () {var currentItemLink = jQuery("#ShellShocker .swiper-slide-active").find("a.item-img");if (currentItemLink.length > 0) {currentItemLink[0].click();}},getShellShockerData: function () {jQuery.ajax({url: Web.Config.Environment.Url.WWW + "Common/Ajax/HomePageShellShocker.aspx",dataType: "jsonp",cache: false,jsonpCallback: "Biz.HomePage2016.ShellShocker.ShellShockerCallBack"});},ShellShockerCallBack: function (data, textStatus) {var content = jQuery(data).html();jQuery('#ShellShocker').html(content);}};