﻿imageRoot = 'images/'; var sbType = ""; var pSel; if (pageFOManager == 'undefined') { var pageFOManager = null } var SlideBookManager = Class.create({ initialize: function () { Event.observe($(window), 'load', function () { $$('div[GSwidget=SliderBook]').each(function (s) { this.CreateElement(s) } .bind(this)) } .bindAsEventListener(this)) }, ElementUploaded: function (el) { el.select('div[GSwidget=SliderBook]').each(function (s) { this.CreateElement(s) } .bind(this)) }, CreateElement: function (s) { if (s.readAttribute('sbInit') != 'true') { s.writeAttribute({ 'sbInit': 'true' }); switch (s.readAttribute('sbtype')) { case 'UC': new ComboSlideBook(s); break; case 'FC': new ForumComboSlideBook(s); break; case 'UF': new ComboFavouritesSlideBook(s); break; case 'CX': new CelebrityFashionPhotoSlideBook(s); break; case 'CP': new CelebrityFashionPhotoForPollsSlideBook(s); break; case 'PC': new ProductCombosSlideBook(s); break; case 'FP': new FashionPhotoSlideBook(s); break; case 'FS': new FavouritesSlideBook(s); break; case 'HSP': new ProductSlideBook(s); break; case 'UAP': new UserAddedProductSlideBook(s); break; case 'UCFL': sbType = "UCFL"; new ComboSlideBookForFashionLabel(s); break; case 'UFFL': sbType = "UFFL"; new ComboFavouritesSlideBookForFashionLabel(s); break; default: new SlideBook(s); break } } } }); var slideBookManager = new SlideBookManager(); var SlideBook = Class.create({ initialize: function (containerDiv) { this.container = containerDiv; this.container.objectRef = this; this.bookPages = []; this.itemCount = 0; this.pageCount; this.movementQueueIsLocked = false; this.movementIsActive = false; this.selectionOptions = {}; this.previousDistance = 0; this.slidebookType; this.navPanel; try { this.options = this.container.select('div[GSWP=true]')[0].innerHTML.evalJSON() } catch (e) { this.options = null } this.options = Object.extend({ pageCols: 5, pageRows: 2, activePageLength: 2, initialpage: 1, maxLoadAttempts: 3, mainContentDivWidth: 500, mainContentDivHeight: 300, sideViewFraction: 0, switchSpeedDistance: 0.5, switchSpeedDuration: .5, maxMovementDistance: 300, minMovementDistance: 5, maxMovementQueueLength: 4, navigationOptions: {}, selectorOptions: {}, topOffset: 0, wheelFactor: -10, templateSelector: 'div[id=contentTemplate]', movementFraction: (1 / 3), accelerationLimit: 3, frameDuration: .02, emptyMessage: 'Sorry! There are no items in this catagory for this shop<br />please make a different selection.' }, this.options || {}); this.scrollerLeftVal = this.options.mainContentDivWidth - 1; this.options.pageSize = this.options.pageCols * this.options.pageRows; this.options.itemWidth = this.options.mainContentDivWidth / (2 * this.options.sideViewFraction + this.options.pageCols); this.width = this.options.itemWidth * this.options.pageCols; this.options.maxMovementQueueLength = this.options.maxMovementQueueLength * this.width; this.template = new Template(unescape(this.container.getElementsBySelector(this.options.templateSelector)[0].innerHTML.sub('%7B', '{').sub('hacksrc', 'src').sub('%7D', '}').sub('%7B', '{').sub('hacksrc', 'src').sub('%7D', '}').sub('%7B', '{').sub('hacksrc', 'src').sub('%7D', '}'))); this.selectionOptions = this.options.selectorOptions; this.selectionOptions = Object.extend({ categoryTier: 0, categoryID: 0, genderID: 0, orderBy: 3, brandGUID: '00000000-0000-0000-0000-000000000000', brandType: 0 }, this.selectionOptions || {}); this.IsFirstLoad = true; this.HasHashParameters = false; this.navPanel = new NavigationPanel(this.options.navigationOptions, this.container, this); if (this.slidebookType == "ProductScroller") { this.GetHashParameterDetails(); if (this.HasHashParameters) { } } this.CreateFiltersAndSelectors(); this.ItemCountGet(); this.viewingWindow = (new Element('div', { className: 'viewingWindow' })).setStyle({ height: (this.options.mainContentDivHeight - 6) + 'px', width: this.options.mainContentDivWidth + 'px', position: 'relative', overflow: 'hidden' }); this.scrollerDiv = (new Element('div', { className: 'scrollingWindow' })).setStyle({ height: (this.options.mainContentDivHeight + 30) + 'px', width: this.options.mainContentDivWidth + 'px', position: 'absolute', overflowY: 'hidden', overflowX: 'scroll', top: '0px', left: '0px' }); this.itemsContainerDiv = (new Element('div', { className: 'itemsContainer' })).setStyle({ whiteSpace: 'nowrap', width: '100%' }); this.container.insert({ 'top': this.viewingWindow.update(this.scrollerDiv.update(this.itemsContainerDiv)) }); if (this.options.initialPageDiv) this.viewingWindow.hide(); this.viewingWindow.observe('mousewheel', this.ScrollWheel.bindAsEventListener(this)); this.viewingWindow.observe('DOMMouseScroll', this.ScrollWheel.bindAsEventListener(this)); if (this.slidebookType == "ProductScroller" && this.HasHashParameters) { $(this.options.initialPageDiv).hide(); $(this.viewingWindow).show(); this.IsFirstLoad = false } if (Prototype.Browser.IE) this.HackForModalContentPopupForIE() }, HackForModalContentPopupForIE: function () { if (Prototype.Browser.IE && document.location.href.toLowerCase().indexOf("modalcontent") > -1) { $(this.viewingWindow).setStyle({ margin: "0 auto", marginBotton: "0", marginLeft: "20px", marginTop: "0", padding: "0" }); $(this.navPanel.nextBtn).setStyle({ paddingLeft: "6px", cursor: "pointer", float: "left" }); $($(this.navPanel.nextBtn).parentNode).setStyle({ float: "left" }); $(this.navPanel.prevBtn).setStyle({ paddingLeft: "6px", cursor: "pointer", float: "left", marginLeft: "10px", marginRight: "13px" }); $($(this.navPanel.prevBtn).parentNode).setStyle({ float: "left" }); $(this.navPanel.scrollContainer).setStyle({ paddingTop: "6px", marginRight: "14px", height: "50px", float: "left" }); $(this.navPanel.pageDiv).setStyle({ textAlign: "center", color: "#A983A3", fontSize: "14px", marginRight: "10px", marginTop: "12px", padding: "0px", width: "100px", float: "left" }); $(this.navPanel.el).setStyle({ textAlign: "left", height: "60px", width: "620px" }) } }, CreateFiltersAndSelectors: function () { }, ScrollWheel: function (event) { Event.stop(event); var scrollingVal = 0; if (window.event) { scrollingVal = window.event.wheelDelta } else { scrollingVal = -event.detail } if (pageFOManager) { pageFOManager.CloseAll() } this.SetMovementDistance((scrollingVal / Math.abs(scrollingVal)) / this.options.wheelFactor, this.SetMovementRelative) }, UpdateOptions: function (newOptions) { if ($("ClrPalette")) $("ClrPalette").hide(); this.selectionOptions = Object.extend(this.selectionOptions, newOptions); this.ClearAllPages(); this.ItemCountGet() }, ClearAllPages: function () { this.bookPages.each(function (s) { s.DeactivatePage(); s = null }); this.bookPages = []; this.itemsContainerDiv.update() }, CreatePages: function () { this.pageCount = Math.ceil(this.itemCount / this.options.pageSize); this.navPanel.UpdatePageCount(this.pageCount); if (this.pageCount == 0) { try { if (Prototype.Browser.IE) { this.itemsContainerDiv.update(new Element('div', { className: 'emptymessage', style: 'width:100%' }).update(this.htmlDecode(this.options.emptyMessage))) } else { this.itemsContainerDiv.update(new Element('p', { className: 'emptymessage' }).update(this.htmlDecode(this.options.emptyMessage))) } } catch (e) { } this.hasPages = false; if (this.IsFirstLoad && (this.options.initialPageDiv)) { $(this.options.initialPageDiv).hide(); this.viewingWindow.show(); this.IsFirstLoad = false } return } this.hasPages = true; this.bookPages.push(new BlankSlideBookPage(this)); for (i = 1; i <= this.pageCount; i++) { this.bookPages.push(new this.sliderPageType(i, this)) } this.scrollerLeftVal = 0; this.Movement(); this.SetMovementDistance(1, this.SetMovementAbsolute) }, isEmpty: function (val) { if (val) { return ((val === null) || val.length == 0 || /^\s+$/.test(val)) } else { return true } }, HTML2Numerical: function (s) { var arr1 = new Array('&nbsp;', '&iexcl;', '&cent;', '&pound;', '&curren;', '&yen;', '&brvbar;', '&sect;', '&uml;', '&copy;', '&ordf;', '&laquo;', '&not;', '&shy;', '&reg;', '&macr;', '&deg;', '&plusmn;', '&sup2;', '&sup3;', '&acute;', '&micro;', '&para;', '&middot;', '&cedil;', '&sup1;', '&ordm;', '&raquo;', '&frac14;', '&frac12;', '&frac34;', '&iquest;', '&agrave;', '&aacute;', '&acirc;', '&atilde;', '&Auml;', '&aring;', '&aelig;', '&ccedil;', '&egrave;', '&eacute;', '&ecirc;', '&euml;', '&igrave;', '&iacute;', '&icirc;', '&iuml;', '&eth;', '&ntilde;', '&ograve;', '&oacute;', '&ocirc;', '&otilde;', '&Ouml;', '&times;', '&oslash;', '&ugrave;', '&uacute;', '&ucirc;', '&Uuml;', '&yacute;', '&thorn;', '&szlig;', '&agrave;', '&aacute;', '&acirc;', '&atilde;', '&auml;', '&aring;', '&aelig;', '&ccedil;', '&egrave;', '&eacute;', '&ecirc;', '&euml;', '&igrave;', '&iacute;', '&icirc;', '&iuml;', '&eth;', '&ntilde;', '&ograve;', '&oacute;', '&ocirc;', '&otilde;', '&ouml;', '&divide;', '&Oslash;', '&ugrave;', '&uacute;', '&ucirc;', '&uuml;', '&yacute;', '&thorn;', '&yuml;', '&quot;', '&amp;', '&lt;', '&gt;', '&oelig;', '&oelig;', '&scaron;', '&scaron;', '&yuml;', '&circ;', '&tilde;', '&ensp;', '&emsp;', '&thinsp;', '&zwnj;', '&zwj;', '&lrm;', '&rlm;', '&ndash;', '&mdash;', '&lsquo;', '&rsquo;', '&sbquo;', '&ldquo;', '&rdquo;', '&bdquo;', '&dagger;', '&dagger;', '&permil;', '&lsaquo;', '&rsaquo;', '&euro;', '&fnof;', '&alpha;', '&beta;', '&gamma;', '&delta;', '&epsilon;', '&zeta;', '&eta;', '&theta;', '&iota;', '&kappa;', '&lambda;', '&mu;', '&nu;', '&xi;', '&omicron;', '&pi;', '&rho;', '&sigma;', '&tau;', '&upsilon;', '&phi;', '&chi;', '&psi;', '&omega;', '&alpha;', '&beta;', '&gamma;', '&delta;', '&epsilon;', '&zeta;', '&eta;', '&theta;', '&iota;', '&kappa;', '&lambda;', '&mu;', '&nu;', '&xi;', '&omicron;', '&pi;', '&rho;', '&sigmaf;', '&sigma;', '&tau;', '&upsilon;', '&phi;', '&chi;', '&psi;', '&omega;', '&thetasym;', '&upsih;', '&piv;', '&bull;', '&hellip;', '&prime;', '&prime;', '&oline;', '&frasl;', '&weierp;', '&image;', '&real;', '&trade;', '&alefsym;', '&larr;', '&uarr;', '&rarr;', '&darr;', '&harr;', '&crarr;', '&larr;', '&uarr;', '&rarr;', '&darr;', '&harr;', '&forall;', '&part;', '&exist;', '&empty;', '&nabla;', '&isin;', '&notin;', '&ni;', '&prod;', '&sum;', '&minus;', '&lowast;', '&radic;', '&prop;', '&infin;', '&ang;', '&and;', '&or;', '&cap;', '&cup;', '&int;', '&there4;', '&sim;', '&cong;', '&asymp;', '&ne;', '&equiv;', '&le;', '&ge;', '&sub;', '&sup;', '&nsub;', '&sube;', '&supe;', '&oplus;', '&otimes;', '&perp;', '&sdot;', '&lceil;', '&rceil;', '&lfloor;', '&rfloor;', '&lang;', '&rang;', '&loz;', '&spades;', '&clubs;', '&hearts;', '&diams;'); var arr2 = new Array('&#160;', '&#161;', '&#162;', '&#163;', '&#164;', '&#165;', '&#166;', '&#167;', '&#168;', '&#169;', '&#170;', '&#171;', '&#172;', '&#173;', '&#174;', '&#175;', '&#176;', '&#177;', '&#178;', '&#179;', '&#180;', '&#181;', '&#182;', '&#183;', '&#184;', '&#185;', '&#186;', '&#187;', '&#188;', '&#189;', '&#190;', '&#191;', '&#192;', '&#193;', '&#194;', '&#195;', '&#196;', '&#197;', '&#198;', '&#199;', '&#200;', '&#201;', '&#202;', '&#203;', '&#204;', '&#205;', '&#206;', '&#207;', '&#208;', '&#209;', '&#210;', '&#211;', '&#212;', '&#213;', '&#214;', '&#215;', '&#216;', '&#217;', '&#218;', '&#219;', '&#220;', '&#221;', '&#222;', '&#223;', '&#224;', '&#225;', '&#226;', '&#227;', '&#228;', '&#229;', '&#230;', '&#231;', '&#232;', '&#233;', '&#234;', '&#235;', '&#236;', '&#237;', '&#238;', '&#239;', '&#240;', '&#241;', '&#242;', '&#243;', '&#244;', '&#245;', '&#246;', '&#247;', '&#248;', '&#249;', '&#250;', '&#251;', '&#252;', '&#253;', '&#254;', '&#255;', '&#34;', '&#38;', '&#60;', '&#62;', '&#338;', '&#339;', '&#352;', '&#353;', '&#376;', '&#710;', '&#732;', '&#8194;', '&#8195;', '&#8201;', '&#8204;', '&#8205;', '&#8206;', '&#8207;', '&#8211;', '&#8212;', '&#8216;', '&#8217;', '&#8218;', '&#8220;', '&#8221;', '&#8222;', '&#8224;', '&#8225;', '&#8240;', '&#8249;', '&#8250;', '&#8364;', '&#402;', '&#913;', '&#914;', '&#915;', '&#916;', '&#917;', '&#918;', '&#919;', '&#920;', '&#921;', '&#922;', '&#923;', '&#924;', '&#925;', '&#926;', '&#927;', '&#928;', '&#929;', '&#931;', '&#932;', '&#933;', '&#934;', '&#935;', '&#936;', '&#937;', '&#945;', '&#946;', '&#947;', '&#948;', '&#949;', '&#950;', '&#951;', '&#952;', '&#953;', '&#954;', '&#955;', '&#956;', '&#957;', '&#958;', '&#959;', '&#960;', '&#961;', '&#962;', '&#963;', '&#964;', '&#965;', '&#966;', '&#967;', '&#968;', '&#969;', '&#977;', '&#978;', '&#982;', '&#8226;', '&#8230;', '&#8242;', '&#8243;', '&#8254;', '&#8260;', '&#8472;', '&#8465;', '&#8476;', '&#8482;', '&#8501;', '&#8592;', '&#8593;', '&#8594;', '&#8595;', '&#8596;', '&#8629;', '&#8656;', '&#8657;', '&#8658;', '&#8659;', '&#8660;', '&#8704;', '&#8706;', '&#8707;', '&#8709;', '&#8711;', '&#8712;', '&#8713;', '&#8715;', '&#8719;', '&#8721;', '&#8722;', '&#8727;', '&#8730;', '&#8733;', '&#8734;', '&#8736;', '&#8743;', '&#8744;', '&#8745;', '&#8746;', '&#8747;', '&#8756;', '&#8764;', '&#8773;', '&#8776;', '&#8800;', '&#8801;', '&#8804;', '&#8805;', '&#8834;', '&#8835;', '&#8836;', '&#8838;', '&#8839;', '&#8853;', '&#8855;', '&#8869;', '&#8901;', '&#8968;', '&#8969;', '&#8970;', '&#8971;', '&#9001;', '&#9002;', '&#9674;', '&#9824;', '&#9827;', '&#9829;', '&#9830;'); return this.swapArrayVals(s, arr1, arr2) }, htmlDecode: function (s) { var c, m, d = s; if (this.isEmpty(d)) return ""; d = this.HTML2Numerical(d); arr = d.match(/&#[0-9]{1,5};/g); if (arr != null) { for (var x = 0; x < arr.length; x++) { m = arr[x]; c = m.substring(2, m.length - 1); if (c >= -32768 && c <= 65535) { d = d.replace(m, String.fromCharCode(c)) } else { d = d.replace(m, "") } } } return d }, swapArrayVals: function (s, arr1, arr2) { if (this.isEmpty(s)) return ""; var re; if (arr1 && arr2) { if (arr1.length == arr2.length) { for (var x = 0, i = arr1.length; x < i; x++) { re = new RegExp(arr1[x], 'g'); s = s.replace(re, arr2[x]) } } } return s }, inArray: function (item, arr) { for (var i = 0, x = arr.length; i < x; i++) { if (arr[i] === item) { return i } } return -1 }, SetMovementRelative: function (distance) { distance = distance * this.width; this.movementDistance += distance; this.movementDistance = Math.max(-1 * this.options.maxMovementQueueLength, this.movementDistance); this.movementDistance = Math.min(this.options.maxMovementQueueLength, this.movementDistance) }, SetMovementAbsolute: function (distance) { distance = Math.min(Math.max(1, distance), this.pageCount); distance = distance * this.width; this.movementDistance = distance - this.scrollerLeftVal }, TurnPage: function (distance) { this.movementDistance = Math.round((this.scrollerLeftVal / this.width) + distance) * this.width - this.scrollerLeftVal }, SetMovementDistance: function (distance, movementActionFunction) { if (!this.hasPages) { return } if (this.movementQueueIsLocked) { this.SetMovementDistance.bind(this).delay(0.02, distance, movmementActionFunction); return } this.movementQueueIsLocked = true; movementActionFunction.apply(this, [distance]); if (this.movementDistance == undefined || isNaN(this.movementDistance)) this.movementDistance = 5; this.navPanel.UpdatePosition(Math.min(Math.max((this.movementDistance + this.scrollerLeftVal) / (this.width * 1.0), 1), this.pageCount)); this.movementQueueIsLocked = false; if (!this.movementIsActive) { if (pageFOManager) { pageFOManager.pOUnlock = false } this.GetMovementDistance() } }, GetMovementDistance: function () { if (this.movementQueueIsLocked) { this.GetMovementDistance.bind(this).defer(); return } this.movementQueueIsLocked = true; this.movementIsActive = true; var distance; if (this.movementDistance != 0) { distance = Math.min(Math.max(this.movementDistance * this.options.movementFraction, -this.options.maxMovementDistance), this.options.maxMovementDistance); if (Math.abs(distance) > Math.abs(this.previousDistance)) { distance = (this.previousDistance * this.options.accelerationLimit + distance) / (this.options.accelerationLimit + 1) } if (Math.abs(distance) < this.options.minMovementDistance) { distance = Math.min(this.options.minMovementDistance, Math.abs(this.movementDistance)) * distance / Math.abs(distance) } if (distance + this.scrollerLeftVal > this.pageCount * this.width) { this.movementDistance = 0; distance = this.pageCount * this.width - this.scrollerLeftVal } else if (distance + this.scrollerLeftVal < this.width) { this.movementDistance = 0; distance = this.width - this.scrollerLeftVal } else { this.movementDistance -= distance } if (distance == 0) { pageFOManager.pOUnlock = true; this.movementIsActive = false; this.movementQueueIsLocked = false; return } } else { pageFOManager.pOUnlock = true; this.movementIsActive = false; this.movementQueueIsLocked = false; return } this.scrollerLeftVal += distance; this.movementQueueIsLocked = false; this.GetMovementDistance.bind(this).delay(this.options.frameDuration); this.Movement() }, Movement: function () { this.page = Math.floor(this.scrollerLeftVal / (this.width * 1.0)); this.CheckActivations(); this.scrollerDiv.scrollLeft = this.scrollerLeftVal; this.CompletePageMove() }, CheckActivations: function () { for (i = Math.max(1, this.page - this.options.activePageLength); i <= Math.min(this.pageCount, this.page + this.options.activePageLength); i++) { this.bookPages[i].ActivatePage() } }, CompletePageMove: function () { if (pageFOManager) { pageFOManager.SetScrolled() } }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.ProductsGetRecordCount(this.selectionOptions.categoryTier, this.selectionOptions.categoryID, this.selectionOptions.genderID, this.selectionOptions.orderBy, this.selectionOptions.brandGUID, this.selectionOptions.brandType, this.selectionOptions.Color == undefined ? "" : this.selectionOptions.Color, this.selectionOptions.priceFrom == undefined ? 0 : this.selectionOptions.priceFrom, this.selectionOptions.priceTo == undefined ? 0 : this.selectionOptions.priceTo, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) }, ItemCountGetOC: function (count) { this.itemCount = count; this.CreatePages() }, ItemCountGetOE: function (arg) { this.itemCount = 0 }, GetHashParameterDetails: function () { try { var hashArr = document.location.href.split("#"); if (hashArr.length > 1) { var hashVal = hashArr[1].split("|"); for (var i = 0; i < hashVal.length; i++) { var paramKeyArray = hashVal[i].split("="); switch (paramKeyArray[0]) { case "cT": this.selectionOptions.categoryTier = paramKeyArray[1]; break; case "cID": this.selectionOptions.categoryID = paramKeyArray[1]; break; case "bT": this.selectionOptions.brandType = paramKeyArray[1]; break; case "bG": this.selectionOptions.brandGUID = paramKeyArray[1]; break; case "Clr": this.selectionOptions.Color = paramKeyArray[1]; break; case "pF": this.selectionOptions.priceFrom = paramKeyArray[1]; break; case "pT": this.selectionOptions.priceTo = paramKeyArray[1]; break; case "P": this.pageNumber = paramKeyArray[1]; this.options.initialPage = paramKeyArray[1]; break } } this.HasHashParameters = true } } catch (e) { } } }); var ProductSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = ProductSlideBookPage; this.slidebookType = "ProductScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { temp = new Element('div'); $$('body')[0].insert({ 'bottom': temp }); pSel = new ProductSelector(temp, this.options.selectorOptions, this) }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.ProductsGetRecordCount(this.selectionOptions.categoryTier, this.selectionOptions.categoryID, this.selectionOptions.genderID, this.selectionOptions.orderBy, this.selectionOptions.brandGUID, this.selectionOptions.brandType, this.selectionOptions.Color == undefined ? "" : this.selectionOptions.Color, this.selectionOptions.priceFrom == undefined ? 0 : this.selectionOptions.priceFrom, this.selectionOptions.priceTo == undefined ? 0 : this.selectionOptions.priceTo, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var ComboSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = ComboSlideBookPage; this.slidebookType = "UserOutfitScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.ComboGetRecordCount(this.options.userID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var ComboSlideBookForFashionLabel = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = ComboSlideBookForFashionLabelPage; this.slidebookType = "UserOutfitScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.ComboGetRecordCount(this.options.userID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var ComboFavouritesSlideBookForFashionLabel = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = ComboFavouritesSlideBookForFashionLabelPage; this.slidebookType = "FavouriteOutfitScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.ComboFavouritesGetRecordCount(this.options.userID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var ForumComboSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = ForumComboSlideBookPage; this.slidebookType = "ForumOutfitScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.ForumComboGetRecordCount(this.options.forumID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var ComboFavouritesSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = ComboFavouritesSlideBookPage; this.slidebookType = "FavouriteOutfitScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.ComboFavouritesGetRecordCount(this.options.userID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var CelebrityFashionPhotoSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = CelebrityFashionPhotoSlideBookPage; this.slidebookType = "CelebrityPhotoScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.CelebrityFashionPhotosGetRecordCount(this.options.celebrityGUID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var CelebrityFashionPhotoForPollsSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = CelebrityFashionPhotoForPollsSlideBookPage; this.slidebookType = "CelebrityPhotoScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.CelebrityFashionPhotosGetRecordCount(this.options.celebrityGUID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var ProductCombosSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = ProductCombosSlideBookPage; this.slidebookType = "OutfitsForProductPageScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.ProductCombosGetRecordCount(this.options.productGUID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var FashionPhotoSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = FashionPhotoSlideBookPage; this.slidebookType = "UserFashionPhotoScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.FashionPhotosGetRecordCount(this.options.userID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var FavouritesSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = FavouritesSlideBookPage; this.slidebookType = "UserFavouriteProductScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.FavouritesGetRecordCount(this.options.userID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var UserAddedProductSlideBook = Class.create(SlideBook, { initialize: function ($super, containerDiv) { this.sliderPageType = UserAddedProductSlideBookPage; this.slidebookType = "UserFavouriteProductScroller"; $super(containerDiv) }, CreateFiltersAndSelectors: function () { }, ItemCountGet: function () { ret = Avenue7_Presentation.ScrollerService.UserAddedProductDataGetCount(this.options.userID, this.ItemCountGetOC.bind(this), this.ItemCountGetOE.bind(this)) } }); var BlankSlideBookPage = Class.create({ initialize: function () { }, ActivatePage: function () { return this }, DeactivatePage: function () { return this }, CalculatePosition: function () { }, ShowPage: function () { }, HidePage: function () { }, MoveTo: function () { }, MoveToRec: function () { } }); var SlideBookPage = Class.create({ initialize: function (pageNumber, book) { this.pageNumber = pageNumber; this.book = book; this.loadAttempts = 0; this.options = {}; this.isActive = false }, FullInitialisation: function () { if (!this.mainDiv) { this.mainDiv = (new Element('div')).setStyle({ position: 'absolute', height: this.book.options.mainContentDivHeight + 'px', width: this.book.width + 'px', overflow: 'hidden', top: '0px', left: (this.pageNumber * this.book.width) + 'px' }); this.mainDiv.obj = this; this.book.itemsContainerDiv.insert({ 'bottom': this.mainDiv }) } }, ActivatePage: function () { if (!this.isActive) { this.isActive = true; this.FullInitialisation(); this.loadAttempts++; this.LoadPageData() } return this }, LoadPageData: function () { }, ActivateFromHTML: function (htmlData) { this.mainDiv.update(htmlData) }, ActivateOC: function (jsonData) { this.mainDiv.update(''); jsonData = jsonData.replace(/(\n|\r|\t)/g, ''); jsonData.evalJSON(true).each(function (s) { var htmlTemplate = this.book.template.evaluate(s); try { if (s.TotalLikes != undefined) { if (s.TotalComments == 0) { if (htmlTemplate.indexOf('id=comments') > -1) htmlTemplate = htmlTemplate.replace('id=comments', 'id=comments style=display:none'); else htmlTemplate = htmlTemplate.replace('id="comments"', 'id="comments" style="display:none"') } if (s.TotalLikes == 0) { if (htmlTemplate.indexOf('id=voteCount') > -1) htmlTemplate = htmlTemplate.replace('id=voteCount', 'id=voteCount style=display:none'); else htmlTemplate = htmlTemplate.replace('id="voteCount"', 'id="voteCount" style="display:none"') } if (s.TotalFavorites == 0) { if (htmlTemplate.indexOf('id=favorite') > -1) htmlTemplate = htmlTemplate.replace('id=favorite', 'id=favorite style=display:none'); else htmlTemplate = htmlTemplate.replace('id="favorite"', 'id="favorite" style="display:none"') } if (s.ViewCount == 0) { } } } catch (e) { } new Insertion.Bottom(this.mainDiv, htmlTemplate) } .bind(this)) }, ActivateOE: function (arg) { if (this.loadAttempts >= this.book.options.maxLoadAttempts) { this.mainDiv.update('There was a problem retrieving the items for this page') } else { this.ActivatePage() } }, DeactivatePage: function () { if (this.mainDiv) { this.mainDiv.fire('SlideBookPage:Deactivate'); this.mainDiv.update(''); this.isActive = false } this.loadAttempts = 0; return this }, CalculatePosition: function (leftVal, topVal) { leftVal = leftVal + 'px'; topVal = topVal + 'px'; this.mainDiv.setStyle({ left: leftVal, top: topVal }) }, ShowPage: function () { this.mainDiv.show() }, HidePage: function () { this.mainDiv.hide() }, MoveTo: function (leftVal, topVal, durationVal) { new Effect.Move(this.mainDiv, { x: leftVal, y: topVal, mode: 'absolute', duration: durationVal }) }, MoveToRec: function (leftVal, topVal, durationVal) { new Effect.Move(this.mainDiv, { x: leftVal, y: topVal, mode: 'absolute', duration: durationVal, afterFinish: this.book.CompletePageMove.bind(this.book) }) } }); var ProductSlideBookPage = Class.create(SlideBookPage, { ActivateOC: function ($super, jsonData) { $super(jsonData); CreatePopUpObjects(this.mainDiv) }, ActivateFromHTML: function ($super, htmlData) { $super(htmlData); CreatePopUpObjects(this.mainDiv) }, LoadPageData: function () { if ((this.book.IsFirstLoad && (this.book.options.initialPageDiv) && this.book.options.initialPage == this.pageNumber) && !this.book.HasHashParameters) { this.ActivateFromHTML($(this.book.options.initialPageDiv).innerHTML); $(this.book.options.initialPageDiv).hide(); this.book.viewingWindow.show(); this.book.IsFirstLoad = false } else { ret = Avenue7_Presentation.ScrollerService.ProductDataGet(this.book.selectionOptions.categoryTier, this.book.selectionOptions.categoryID, this.book.selectionOptions.brandGUID, this.book.selectionOptions.brandType, this.pageNumber, this.book.options.pageSize, this.book.selectionOptions.Color == undefined ? "" : this.book.selectionOptions.Color, this.book.selectionOptions.priceFrom == undefined ? 0 : this.book.selectionOptions.priceFrom, this.book.selectionOptions.priceTo == undefined ? 0 : this.book.selectionOptions.priceTo, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } } }); var ComboSlideBookPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.ComboDataGet(this.book.options.userID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var ComboSlideBookForFashionLabelPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.ComboDataGetForFashionLabel(this.book.options.userID, this.book.options.CurUserID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var ComboFavouritesSlideBookForFashionLabelPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.ComboFavouritesDataGetForFashionLabel(this.book.options.userID, this.book.options.CurUserID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var ForumComboSlideBookPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.ForumComboDataGet(this.book.options.forumID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var ComboFavouritesSlideBookPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.ComboFavouritesDataGet(this.book.options.userID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var UserAddedProductSlideBookPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.UserAddedProductDataGet(this.book.options.userID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var CelebrityFashionPhotoSlideBookPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.CelebrityFashionPhotosDataGet(this.book.options.celebrityGUID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var CelebrityFashionPhotoForPollsSlideBookPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.CelebrityFashionPhotosDataAscDateGet(this.book.options.celebrityGUID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var ProductCombosSlideBookPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.ProductCombosDataGet(this.book.options.productGUID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var FashionPhotoSlideBookPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.FashionPhotosDataGet(this.book.options.userID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var FavouritesSlideBookPage = Class.create(SlideBookPage, { LoadPageData: function () { ret = Avenue7_Presentation.ScrollerService.FavouritesDataGet(this.book.options.userID, this.book.options.pageSize, this.pageNumber, this.ActivateOC.bind(this), this.ActivateOE.bind(this)) } }); var NavigationPanel = Class.create({ initialize: function (options, mainEl, parent) { this.options = options; this.options = Object.extend({ nextImg: 'http://static.avenue7.co.uk/App_Themes/Av7/images/all-lang/common/scroller_rarrowpink_a_.gif', prevImg: 'http://static.avenue7.co.uk/App_Themes/Av7/images/all-lang/common/scroller_larrowpink_a_.gif', displayNext: true, displayPrev: true, displayScrollBar: true, displayPageNumber: true, scrollOptions: {}, pageNumOptions: {} }, this.options || {}); this.parent = parent; this.pageNumber = 1; if (this.options.navContainerID) { this.el = $(this.options.navContainerID) } else { this.el = new Element('div', { className: 'navigationController' }); mainEl.insert({ 'bottom': this.el }) } if (this.options.displayNext) { if (this.options.nextID) { this.nextBtn = $(this.options.nextID) } else if (this.options.nextDiv) { this.nextBtn = new Element('img', { 'src': this.options.nextImg, 'alt': 'Next', className: 'nextButton' }); $(this.options.nextDiv).update(this.nextBtn) } else { this.nextBtn = new Element('img', { 'src': this.options.nextImg, 'alt': 'Next', className: 'nextButton' }); this.el.insert({ 'bottom': this.nextBtn }); this.nextBtn.wrap(new Element('div', { className: 'nextButtonDiv' })) } this.nextBtn.observe('click', function () { this.ScrollBy(1, this.parent.TurnPage) } .bindAsEventListener(this)) } if (this.options.displayPageNumber) { if (this.options.pageNumID) { this.pageDiv = $(this.options.pageNumID) } else { this.pageDiv = new Element('div', { className: 'pageNumbers', className: 'pageNumber' }); this.el.insert({ 'top': this.pageDiv }) } this.PageNumbers = new PageNum(this.pageDiv, this.options.pageNumOptions, parent.slidebookType) } if (this.options.displayScrollBar) { if (this.options.scrollContainerID) { this.scrollContainer = $(this.options.scrollContainerID) } else { this.scrollContainer = new Element('div', { className: 'scrollContainer' }); this.el.insert({ 'top': this.scrollContainer }) } this.ScrollBar = new ScrollBar(this.scrollContainer, this.options.scrollOptions, 5, this) } if (this.options.displayPrev) { if (this.options.prevID) { this.prevBtn = $(this.options.prevID) } else if (this.options.prevDiv) { this.prevBtn = new Element('img', { 'src': this.options.prevImg, 'alt': 'Previous', className: 'previousButton' }); $(this.options.prevDiv).update(this.prevBtn) } else { this.prevBtn = new Element('img', { 'src': this.options.prevImg, 'alt': 'Previous', className: 'previousButton' }); this.el.insert({ 'top': this.prevBtn }); this.prevBtn.wrap(new Element('div', { className: 'previousButtonDiv' })) } this.prevBtn.observe('click', function () { this.ScrollBy(-1, this.parent.TurnPage) } .bindAsEventListener(this)) } }, ScrollBy: function (distance, movementBehaviorFunction) { this.parent.SetMovementDistance(distance, movementBehaviorFunction) }, UpdatePosition: function (pageNumber) { if (pageNumber <= 1) { this.prevBtn.src = this.prevBtn.src.sub('_a_', '_da_') } else { this.prevBtn.src = this.prevBtn.src.sub('_da_', '_a_') } if (pageNumber >= this.pageCount) { this.nextBtn.src = this.nextBtn.src.sub('_a_', '_da_') } else { this.nextBtn.src = this.nextBtn.src.sub('_da_', '_a_') } this.PageNumbers.UpdatePage(pageNumber); this.ScrollBar.UpdatePageNumber(pageNumber); if (pageNumber != 1) { try { var pageTracker = _gat._getTracker("UA-1379214-1"); pageTracker._trackPageview("/" + this.parent.slidebookType + "/" + pageNumber) } catch (err) { } } if (pageNumber != 1) { try { Analytics.AddActivity(13, this.parent.slidebookType + ' - page ' + pageNumber, userGUID, sessionID) } catch (err) { } } this.pageNumber = pageNumber; if (this.parent.slidebookType == "ProductScroller") this.UpdateURL() }, UpdatePageCount: function (pageCount) { this.pageCount = pageCount; this.PageNumbers.UpdatePageCount(pageCount); this.ScrollBar.UpdatePageCount(pageCount); this.pageCount = pageCount; this.UpdatePosition(1) }, UpdateURL: function () { if (document.URL.split("#").length > 1 && this.parent.IsFirstLoad) { return } var url = document.URL.split("#")[0] + "#"; url += "cT=" + this.parent.selectionOptions.categoryTier + "|" + "cID=" + this.parent.selectionOptions.categoryID + "|" + "bT=" + this.parent.selectionOptions.brandType + "|"; if (this.parent.selectionOptions.brandGUID != "00000000-0000-0000-0000-000000000000") url += "bG=" + this.parent.selectionOptions.brandGUID + "|"; if (this.parent.selectionOptions.Color != undefined && this.parent.selectionOptions.Color != "") url += "Clr=" + this.parent.selectionOptions.Color + "|"; if (this.parent.selectionOptions.priceFrom != undefined && this.parent.selectionOptions.priceFrom != "") url += "pF=" + this.parent.selectionOptions.priceFrom + "|"; if (this.parent.selectionOptions.priceTo != undefined && this.parent.selectionOptions.priceTo != "") url += "pT=" + this.parent.selectionOptions.priceTo + "|"; url += "P=" + this.pageNumber; document.location = url } }); var PageNum = Class.create({ initialize: function (container, options, slidebooktype) { this.options = options; this.options = Object.extend({}); this.container = container; this.pageTotal = 1; this.UpdatePage(1) }, UpdatePage: function (pageNumber) { if (this.pageTotal > 0) { this.pageNumber = Math.floor(pageNumber); this.container.update('Page ' + this.pageNumber + ' of ' + this.pageTotal) } else { this.container.update('No items') } }, UpdatePageCount: function (pageCount) { this.pageTotal = pageCount; this.UpdatePage(1) } }); var ScrollBar = Class.create({ initialize: function (container, options, pageCount, parent) { this.options = options; this.options = Object.extend({ scrollBarImage: 'http://static.avenue7.co.uk/App_Themes/Av7/images/all-lang/common/scroller_bar.png', scrollPointerImage: 'http://static.avenue7.co.uk/App_Themes/Av7/images/all-lang/common/scroller_sliderpink.gif', totalWidth: 200, pointerWidth: 10, pointerHeight: 50, maxScaleLength: 5 }, this.options || {}); this.edge = {}; this.bound = {}; this.moveLock = false; this.parent = parent; this.activeWidth = this.options.totalWidth - this.options.pointerWidth; this.SetScrollScales(pageCount); this.currentPosition = 0; this.container = container; this.container.relativize(); this.container.setStyle({ width: this.options.totalWidth + 'px' }); if (this.options.barID) { this.bar = $(this.options.barID) } else { this.bar = (new Element('img', { 'src': this.options.scrollBarImage })).setStyle({ height: this.options.pointerHeight + 'px', width: (this.options.totalWidth - this.options.pointerWidth) + 'px' }); this.container.insert({ 'top': this.bar }) } this.bar.observe('click', this.BarClick.bindAsEventListener(this)); this.pointer = {}; if (this.options.pointerID) { this.pointer = $(this.options.pointerID) } else { this.pointer = (new Element('div')).setStyle({ position: 'absolute', width: this.options.pointerWidth + 'px', height: this.options.pointerHeight + 'px', left: '0px', background: 'url(' + this.options.scrollPointerImage + ')' }); this.container.insert({ 'top': this.pointer }) } this.pointer.observe('mousedown', this.PointerGrab.bindAsEventListener(this)); this.parent.el.observe('mouseleave', this.PointerRelease.bindAsEventListener(this)) }, PointerGrab: function (event) { if (!this.mouseMoveHandler && this.enabled) { this.mouseMoveHandler = this.MouseDrag.bindAsEventListener(this); this.mouseReleaseHandler = this.PointerRelease.bindAsEventListener(this); Event.observe(this.container, 'mousemove', this.mouseMoveHandler); Event.observe(this.container, 'mouseup', this.mouseReleaseHandler); Event.observe(this.container, 'mouseout', this.mouseReleaseHandler); this.container.writeAttribute({ className: 'scrollBarGrab' }) } }, BarClick: function (event) { if (this.enabled) { this.CalculateMove(Event.pointerX(event)) } }, MouseDrag: function (event) { if (this.repeatMove) { clearInterval(this.repeatMove) } this.CalculateMove(Event.pointerX(event)) }, CalculateMove: function (eventDistance) { this.clickPosition = eventDistance - this.container.cumulativeOffset().left - this.options.pointerWidth / 2; this.MovePointer(this.clickPosition, true) }, PointerRelease: function (event) { if (event.type == 'mouseout') { if (Event.element(event) != this.container) { return } } this.container.writeAttribute({ className: 'scrollContainer' }); Event.stopObserving(this.container, 'mousemove', this.mouseMoveHandler); Event.stopObserving(this.container, 'mouseup', this.mouseReleaseHandler); Event.stopObserving(this.container, 'mouseout', this.mouseReleaseHandler); this.mouseMoveHandler = false; clearInterval(this.repeatMove) }, RegisterMove: function (distance) { this.parent.ScrollBy(distance, this.parent.parent.SetMovementRelative) }, MovePointerByPage: function (pageNumber) { if (pageNumber > this.edge.up) { this.bound.up = Math.min(Math.ceil(pageNumber + 1), this.pageCount); this.edge.up = this.bound.up - 1; this.bound.lo = this.bound.up - this.options.maxScaleLength; this.edge.lo = this.bound.lo + 1; if (this.edge.lo > this.edge.up) { this.edge.lo = 0; this.edge.up = 0 } } else if (pageNumber < this.edge.lo) { this.bound.lo = Math.max(Math.floor(pageNumber - 1), 1); this.edge.lo = this.bound.lo + 1; this.bound.up = this.bound.lo + this.options.maxScaleLength; this.edge.up = this.bound.up - 1; if (this.edge.lo > this.edge.up) { this.edge.lo = 0; this.edge.up = 0 } } this.MovePointer((pageNumber - this.bound.lo) / this.scaleFactor) }, MovePointer: function (postn, activeMove) { if (this.moveLock) { this.MovePointer.bind(this).delay(0.02, postn, activeMove); return } this.moveLock = true; postn = Math.min(postn, this.activeWidth); postn = Math.max(postn, 0); if (activeMove) { this.RegisterMove((postn - this.currentPosition) * this.scaleFactor) } this.currentPosition = postn; this.pointer.setStyle({ left: postn + 'px' }); this.moveLock = false }, SetScrollScales: function (pageCount) { this.pageCount = pageCount; if (this.pageCount - 1 < this.options.maxScaleLength) { this.edge.lo = -2; this.bound.lo = 1; this.edge.up = this.pageCount + 1; this.bound.up = this.pageCount; this.scaleFactor = (this.bound.up - this.bound.lo) / (this.activeWidth * 1.0) } else { this.bound.lo = 1; this.edge.lo = this.bound.lo + 1; this.bound.up = this.options.maxScaleLength + this.bound.lo; this.edge.up = this.bound.up - 1; this.scaleFactor = (this.bound.up - this.bound.lo) / (this.activeWidth * 1.0) } }, UpdatePageNumber: function (pageNumber) { if (this.enabled) { this.pageNumber = pageNumber; if (this.mouseMoveHandler) { if (pageNumber > this.edge.up || pageNumber < this.edge.lo) { this.MovePointerByPage(pageNumber) } } else { this.MovePointerByPage(pageNumber) } } }, UpdatePageCount: function (pageCount) { if (pageCount < 2) { this.enabled = true; this.pointer.hide() } else { this.enabled = true; this.pointer.show(); this.SetScrollScales(pageCount) } } }); var ProductSelector = Class.create({ initialize: function (element, options, book) { this.element = element; this.book = book; this.options = options; this.options = Object.extend({ isItems: true, isShops: true, isOrder: true, category: [], shopOptions: {}, categoryOptions: {} }, this.options || {}); this.Dialog = ""; this.BrandName = ""; this.CatName = ""; this.ColorSel; if (this.options.isItems) { if (this.options.itemsSelectorDiv && $(this.options.itemsSelectorDiv)) { this.itemsDiv = $(this.options.itemsSelectorDiv) } else { this.itemsDiv = new Element('div', { className: 'catSelector' }); this.element.insert({ 'top': this.itemsDiv }) } this.itemControl = new CategoryTreeControl(this.itemsDiv, this.options.categoryOptions, this) } this.brandType = this.book.selectionOptions.brandType; if ($("BrandContainer")) { this.InitializeBrandSearch() } if ($(this.options.colorDiv)) this.ColorSel = new ColorSelection($(this.options.colorDiv), this); if (this.options.affiliateTabId) { if (userGUID != '00000000-0000-0000-0000-000000000000') { var friend = new Element("option", { value: "2" }).update("Added by friends"); $(this.options.affiliateTabId).insert({ "bottom": friend }) } this.SetBrandType(); $(this.options.affiliateTabId).observe("change", this.OnBrandTypeChange.bindAsEventListener(this)) } if ($("divPriceFilter")) { this.InitializePriceFilter(); if (this.brandType == "0") { $("divPriceFilter").show(); $("divPriceFilterSep").show() } else { $("divPriceFilter").hide(); $("divPriceFilterSep").hide() } } this.ModalContainer = Builder.node("div", { id: "ModalContainer1", style: "position: fixed; background-color:Black;opacity:0.2;filter:alpha(opacity=20);overflow:hidden;-moz-opacity:0.20;top:0px;left:0px;z-Index:500" }); try { $("bodyWrapper").insert({ "top": this.ModalContainer }) } catch (e) { } var CurObj = this; $$("#span.close").each(function (s) { $(s).observe('click', CurObj.HideDialog.bindAsEventListener(CurObj)) }); try { Event.observe($$('body')[0], 'click', this.HideDialog.bindAsEventListener(this)); $($$('body')[0]).observe('keypress', this.OnKeyPress.bindAsEventListener(this)) } catch (e) { } this.timerID = window.setTimeout(this.RetrieveFilterDetails.bind(this), 1000) }, ApplyOptions: function (newOptions) { this.book.UpdateOptions(newOptions); this.timerID = window.setTimeout(this.RetrieveFilterDetails.bind(this), 1000) }, OnKeyPress: function (event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 27) this.HideDialog() }, OnBrandTypeChange: function (event) { var ele = $$("#" + this.options.affiliateTabId + " option").find(function (ele) { return !!ele.selected }); this.brandType = ele.value; if (ele.value == "0") { if ($("divPriceFilter")) { $("divPriceFilter").show(); $("divPriceFilterSep").show() } } else { if ($("divPriceFilter")) { $("divPriceFilter").hide(); $("divPriceFilterSep").hide() } } this.ToggleBrandInput(ele.value); this.ApplyOptions({ brandType: this.brandType }) }, SetBrandType: function () { var bType = this.brandType; var curObj = this; $$("#" + this.options.affiliateTabId + " option").each(function (item) { if (item.value == bType) { item.selected = true; if (item.value == "0") { if ($("divPriceFilter")) { $("divPriceFilter").show(); $("divPriceFilterSep").show() } } curObj.ToggleBrandInput(item.value) } }) }, InitializeBrandSearch: function () { this.CreateBrandFilter(); this.SetBrandFilter(); $($("BrandContainer").firstDescendant()).observe('click', this.ShowBrandFilter.bindAsEventListener(this)); this.AffiliateBrandHTML; this.CommunityBrandHTML; this.BrandFilterHTML; this.BrandFilterJSON; var CurObj = this; var temp = []; AffiliateBrands.each(function (item) { temp.push(CurObj.CreateBrandItem(item.id, item.name)) }); this.AffiliateBrandHTML = "<ul>" + temp.join('') + "</ul>"; temp = []; CommunityBrands.each(function (item) { temp.push(CurObj.CreateBrandItem(item.id, item.name)) }); this.CommunityBrandHTML = "<ul>" + temp.join('') + "</ul>"; $("txtBrandName").observe("keyup", this.OnBrandSearch.bindAsEventListener(this)); $("txtBrandName").observe("blur", this.BrandOnBlur); $("txtBrandName").observe("click", this.BrandOnFocus) }, BrandOnBlur: function (event) { this.value = "type to search"; Event.stop(event); return false }, BrandOnFocus: function (event) { if (this.value == "type to search") this.value = ""; Event.stop(event); try { if (!event) var event = window.event; event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation() } catch (e) { } return false }, OnBrandSearch: function () { var ret = []; var partial = []; var entry = $("txtBrandName").value; var count = 0; var arrObj; if (this.BrandFilterJSON) { arrObj = this.BrandFilterJSON } else { if (this.brandType == "0" || this.brandType == "3") { arrObj = AffiliateBrands } else { arrObj = CommunityBrands } } for (var i = 0; i < arrObj.length; i++) { var elem = arrObj[i]; var elem_name = elem.name; var elem_value = elem.id; var foundPos = elem_name.toLowerCase().indexOf(entry.toLowerCase()); while (foundPos != -1) { if (foundPos == 0) { ret.push(this.CreateBrandItem(elem_value, elem_name)); break } else if (entry.length >= 2 && true && foundPos != -1) { if (/\s/.test(elem_name.substr(foundPos - 1, 1))) { partial.push(this.CreateBrandItem(elem_value, elem_name)); break } } foundPos = elem_name.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) } } if (partial.length) ret = ret.concat(partial); $("scrollingInner").update("<ul>" + ret.join('') + "</ul>") }, CreateBrandItem: function (itemID, itemName) { return "<li><a value='" + itemID + "' onclick='pSel.OnBrandItemClick(this,event);' style='cursor:pointer'>" + itemName + "</a></li>" }, OnBrandItemClick: function (obj, event) { this.ApplyOptions({ brandGUID: $(obj).readAttribute("value") }); this.UpdateBrandFilter(obj.innerHTML); this.HideDialog(); Event.stop(event) }, ShowBrandFilter: function (event) { this.Dialog = "B"; this.ShowDialog(event) }, ToggleBrandInput: function (brandType) { if (this.BrandFilterHTML == undefined || this.BrandFilterHTML == "") { if (brandType == "0" || brandType == "3") { $("scrollingInner").update(this.AffiliateBrandHTML) } else { $("scrollingInner").update(this.CommunityBrandHTML) } } }, CreateBrandFilter: function () { if ($("divBrandFilter")) { this.BrandFilter = Builder.node('div', { title: '', style: "float: left; padding:0 0 0 10px" }); this.ClearBrandFilter = Builder.node('div', { className: "colorItem", style: "float:right;text-align:right;width:60px;font-size:12px; color:#E50085" }, "Clear"); this.BrandFilterContainer = Builder.node('div', { style: "display:none;position:relative" }, [this.BrandFilter, this.ClearBrandFilter, Builder.node('div', { style: 'clear:both' })]); $("divBrandFilter").appendChild(this.BrandFilterContainer); $(this.ClearBrandFilter).observe('click', this.OnClearBrandFilter.bindAsEventListener(this)); $(this.BrandFilter).observe('click', this.ShowBrandFilter.bindAsEventListener(this)) } }, OnClearBrandFilter: function () { $(this.BrandFilterContainer).hide(); this.ApplyOptions({ brandGUID: '00000000-0000-0000-0000-000000000000' }); this.BrandName = ""; this.UpdateTitle() }, SetBrandFilter: function () { if (this.book.selectionOptions.brandGUID != '00000000-0000-0000-0000-000000000000') { var arrObj; if (this.brandType == "0" || this.brandType == "3") { arrObj = AffiliateBrands } else { arrObj = CommunityBrands } for (var i = 0; i < arrObj.length; i++) { if (arrObj[i].id.toLowerCase() == this.book.selectionOptions.brandGUID.toLowerCase()) { var bName = arrObj[i].name; this.UpdateBrandFilter(bName); break } } } }, UpdateBrandFilter: function (bName) { $(this.BrandFilter).update(bName); $(this.BrandFilter).setAttribute('title', bName); $(this.BrandFilterContainer).show(); this.BrandName = bName; this.UpdateTitle() }, InitializePriceFilter: function () { var curObj = this; var defVal = ""; var priceFrom = this.book.selectionOptions.priceFrom == undefined ? "" : this.book.selectionOptions.priceFrom; var priceTo = this.book.selectionOptions.priceTo == undefined ? "" : this.book.selectionOptions.priceTo; $$("#divPriceFilter ul li a").each(function (item) { $(item).observe('click', curObj.OnPriceFilterClick.bindAsEventListener(curObj)); if ($(item).readAttribute("priceFrom") == priceFrom && $(item).readAttribute("priceTo") == priceTo) { defVal = item.innerHTML } }); this.PriceFilter = Builder.node('div', { title: '', style: "float: left; margin:0 0 0 10px" }, defVal); this.ClearPriceFilter = Builder.node('div', { className: "colorItem", style: "float:right;text-align:right;width:60px;font-size:12px; color:#E50085" }, "Clear"); this.PriceFilterContainer = Builder.node('div', { style: "display:none" }, [this.PriceFilter, this.ClearPriceFilter, Builder.node('div', { style: 'clear:both' })]); $("divPriceFilter").insert({ 'bottom': this.PriceFilterContainer }); if (defVal != "") $(this.PriceFilterContainer).show(); $(this.ClearPriceFilter).observe('click', this.OnClearPriceFilter.bindAsEventListener(this)); $($("divPriceFilter").firstDescendant().firstDescendant()).observe('click', this.ShowPriceFilter.bindAsEventListener(this)); $(this.PriceFilter).observe('click', this.ShowPriceFilter.bindAsEventListener(this)) }, OnPriceFilterClick: function (event) { this.HideDialog(); var ele = Event.element(event); var priceFrom = $(ele).readAttribute("priceFrom"); var priceTo = $(ele).readAttribute("priceTo"); $(this.PriceFilter).update(ele.innerHTML); $(this.PriceFilterContainer).show(); this.ApplyOptions({ priceFrom: priceFrom, priceTo: priceTo }); this.HideDialog(); Event.stop(event) }, OnClearPriceFilter: function () { $(this.PriceFilterContainer).hide(); this.ApplyOptions({ priceFrom: '0', priceTo: '0' }) }, ShowPriceFilter: function (event) { this.Dialog = "P"; this.ShowDialog(event) }, ShowDialog: function (event) { var offset; var sleft; var stop; var Element; this.HideDialog(); var height = Math.max(document.body.scrollHeight, (self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0)) + 'px'; var width = Math.max(document.body.scrollWidth, (self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0)) + 'px'; var pos = Prototype.Browser.IE ? "fixed" : "absolute"; $(this.ModalContainer).setStyle({ height: height, width: width, position: pos }); $(this.ModalContainer).update(" "); $(this.ModalContainer).show(); if (this.Dialog == "P") { offset = $("divPriceFilter").positionedOffset(); offset.top = offset.top - ($("divPricePalatte").getHeight() / 2); Element = "divPricePalatte" } else if (this.Dialog == "C") { offset = $(this.options.colorDiv).positionedOffset(); offset.top = offset.top - ($("ClrPalatte").getHeight() / 2); Element = "ClrPalatte" } else if (this.Dialog == "B") { offset = $("BrandContainer").positionedOffset(); offset.top = offset.top - ($("divBrandPalatte").getHeight() / 2); Element = "divBrandPalatte" } sleft = offset.left + 50; stop = offset.top; $(Element).setStyle({ top: stop + "px", left: sleft + "px", zIndex: 100000, position: "absolute" }); $(Element).show(); Event.stop(event) }, HideDialog: function () { if ($("ClrPalatte")) $("ClrPalatte").hide(); if ($("divPricePalatte")) $("divPricePalatte").hide(); if ($("divBrandPalatte")) $("divBrandPalatte").hide(); $(this.ModalContainer).hide() }, OnKeyPress: function (event) { event = event || window.event; var keyCode = event.which || event.keyCode; if (keyCode == 27) this.HideDialog() }, getDocumentWidth: function () { return Math.max(document.body.scrollWidth, this.getWindowWidth()) }, getDocumentHeight: function () { return Math.max(document.body.scrollHeight, this.getWindowHeight()) }, UpdateTitle: function () { var Title = ""; if (this.BrandName != undefined && this.BrandName != "") { Title = this.BrandName + " " } if (this.CatName != undefined && this.CatName != "") { Title += this.CatName } $("divTitle").firstDescendant().update(Title); document.title = Title.unescapeHTML() + " | " + PageTitle }, UpdateURL: function () { var url = document.URL.split("#")[0] + "#"; url += "cT=" + this.book.selectionOptions.categoryTier + "|" + "cID=" + this.book.selectionOptions.categoryID + "|" + "bT=" + this.book.selectionOptions.brandType + "|"; if (this.book.selectionOptions.brandGUID != "00000000-0000-0000-0000-000000000000") url += "bG=" + this.book.selectionOptions.brandGUID + "|"; if (this.book.selectionOptions.Color != undefined && this.book.selectionOptions.Color != "") url += "Clr=" + this.book.selectionOptions.Color + "|"; if (this.book.selectionOptions.priceFrom != undefined && this.book.selectionOptions.priceFrom != "") url += "pF=" + this.book.selectionOptions.priceFrom + "|"; if (this.book.selectionOptions.priceTo != undefined && this.book.selectionOptions.priceTo != "") url += "pT=" + this.book.selectionOptions.priceTo + "|"; url += "P=" + this.book.navPanel.pageNumber; document.location = url }, RetrieveFilterDetails: function () { try { ret = Avenue7_Presentation.ScrollerService.ProductDataFiltersGet(this.book.selectionOptions.categoryTier, this.book.selectionOptions.categoryID, this.book.selectionOptions.brandGUID, this.book.selectionOptions.brandType, this.book.selectionOptions.Color == undefined ? "" : this.book.selectionOptions.Color, this.book.selectionOptions.priceFrom == undefined ? 0 : this.book.selectionOptions.priceFrom, this.book.selectionOptions.priceTo == undefined ? 0 : this.book.selectionOptions.priceTo, this.RefreshFilters.bind(this), function (args) { }) } catch (e) { } }, RefreshFilters: function (args) { try { var filters = args.evalJSON(); var i = 0; if (filters) { if (this.book.selectionOptions.Color != undefined && this.book.selectionOptions.Color == "") { if (filters[0]) { filters[0].colorFilter.each(function (color) { var colorItem = $$("#ClrPalatte a")[i].descendants(); if (color == "x") { $(colorItem[0]).hide(); $(colorItem[1]).show() } else { $(colorItem[0]).show(); $(colorItem[1]).hide() } i++ }) } } if (this.book.selectionOptions.brandGUID == "00000000-0000-0000-0000-000000000000") { if (filters[0]) { this.BrandFilterJSON = filters[0].brandFilter; var CurObj = this; temp = []; this.BrandFilterJSON.each(function (item) { temp.push(CurObj.CreateBrandItem(item.id, item.name)) }); this.BrandFilterHTML = "<ul>" + temp.join('') + "</ul>"; $("scrollingInner").update(this.BrandFilterHTML) } else $("scrollingInner").update() } if (this.book.selectionOptions.brandType == "0" && (this.book.selectionOptions.priceFrom == "0" && this.book.selectionOptions.priceTo == "0")) { $$("#divPriceFilter ul li a").each(function (item) { $($(item).parentNode).hide() }); if (filters[0]) { filters[0].priceFilter.each(function (price) { $$("a[priceFrom='" + price.priceFrom + "']").each(function (item) { $($(item).parentNode).show() }) }) } } } } catch (e) { } } }); var ColorSelection = Class.create({ initialize: function (element, selector) { try { this.element = element; this.selector = selector; this.Color = ""; var obj = this; $$("#ClrPalatte a").each(function (item) { Event.observe(item, 'click', obj.onColorItemClick.bindAsEventListener(obj)); Event.observe($(item).descendants()[1], 'click', obj.onNonColorItemClick.bindAsEventListener(obj)) }); this.SelectedColorContainer = Builder.node('div', { className: "colorItem", title: "Select color", style: "float: left; margin:0 0 0 10px; border:solid 1px #fff" }); this.ClearColor = Builder.node('div', { className: "colorItem", style: "float:right;text-align:right;width:60px;font-size:12px; color:#E50085" }, "Clear"); this.ColorContainer = Builder.node('div', { style: "display:none" }, [this.SelectedColorContainer, this.ClearColor, Builder.node('div', { style: 'clear:both' })]); $(this.element).insert({ 'bottom': this.ColorContainer }); $(this.ClearColor).observe('click', this.onClear.bindAsEventListener(this)); $(this.SelectedColorContainer).observe('click', this.ShowColorPalette.bindAsEventListener(this)); $($(this.element).firstDescendant()).observe('click', this.ShowColorPalette.bindAsEventListener(this)); var Clr = selector.book.selectionOptions.Color; if (Clr != "") { this.SetColor(Clr) } } catch (e) { } }, onClear: function () { this.Color = ""; this.ApplyOptions(); $(this.ColorContainer).hide() }, onColorItemClick: function (event) { var ele = Event.element(event); var Color = $(ele).getStyle("backgroundColor"); this.SetColor(Color); this.ApplyOptions(); this.selector.HideDialog(); Event.stop(event) }, onNonColorItemClick: function (event) { Event.stop(event); return false }, SetColor: function (color) { this.Color = color; $(this.SelectedColorContainer).setStyle({ backgroundColor: color }); $(this.ColorContainer).show() }, ShowColorPalette: function (event) { this.selector.Dialog = "C"; this.selector.ShowDialog(event); Event.stop(event) }, ApplyOptions: function () { this.selector.ApplyOptions({ Color: this.Color }) } }); var CategoryTreeControl = Class.create({ initialize: function (el, options, selector) { this.selector = selector; this.tier = selector.book.selectionOptions.categoryTier; this.categoryID = selector.book.selectionOptions.categoryID; this.options = Object.extend({ titleSpacerImage: 'http://static.avenue7.co.uk/App_Themes/Av7/images/all-lang/clothes_page/titleSpacer.gif', noMoreOptionsTxt: 'There are no more options.' }, options); this.el = el; this.titleContainer = null; this.itemsContainer = null; var curObj = this; $$("div.treeTitle").each(function (ele) { curObj.titleContainer = ele }); $$("div.treeItems").each(function (ele) { curObj.itemsContainer = ele }); if (this.titleContainer == undefined || this.titleContainer == null) { this.titleContainer = new Element('div', { className: 'treeTitle' }); this.el.insert({ 'top': this.titleContainer }) } if (this.itemsContainer == undefined || this.itemsContainer == null) { this.itemsContainer = new Element('div', { className: 'treeItems' }); this.el.insert({ 'bottom': this.itemsContainer }) } this.DefaultTitle = this.TitleNode("0", "0", "All"); this.Tier1Cat = Tier1Cat; this.Tier2Cat = Tier2Cat; this.Tier3Cat = Tier3Cat; this.InitCategoryFromServer(); if (this.selector.book.HasHashParameters && this.tier > 0) { this.CreateTitleElement(this.tier, this.categoryID); this.CreateItemElement(parseInt(this.tier) + 1, this.categoryID) } this.SetCatCaption() }, InitCategoryFromServer: function () { var curObj = this; $$("div.treeTitle span").each(function (item) { var ele = $(item).firstDescendant(); $(ele).observe('click', curObj.OnTitleClick.bindAsEventListener(curObj)) }); $$("div.treeItems li").each(function (item) { var ele = $(item).firstDescendant(); $(ele).observe('click', curObj.OnItemClick.bindAsEventListener(curObj)) }) }, CreateTitleElement: function (catTier, catId) { var curObj = this; this.RemoveTitleNode(catTier); var item; var title = "All"; if (catTier == 1) { for (var i = 0; i < this.Tier1Cat.length; i++) { item = this.Tier1Cat[i]; if (item.id == catId) { $(curObj.titleContainer).insert({ 'bottom': curObj.TitleNode(1, item.id, item.name) }); title = item.name; break } } } else if (catTier == 2) { for (var i = 0; i < this.Tier2Cat.length; i++) { item = this.Tier2Cat[i]; if (item.id == catId) { $(curObj.titleContainer).insert({ 'bottom': curObj.TitleNode(2, item.id, item.name) }); title = item.name; break } } } else if (catTier == 3) { for (var i = 0; i < this.Tier3Cat.length; i++) { item = this.Tier3Cat[i]; if (item.id == catId) { $(curObj.titleContainer).insert({ 'bottom': curObj.TitleNode(3, item.id, item.name) }); title = item.name; break } } } try { Analytics.AddActivity(96, title, userGUID, sessionID) } catch (e) { } }, CreateItemElement: function (catTier, catId) { $(this.itemsContainer).update(); var curObj = this; if (catTier <= 1) { this.Tier1Cat.each(function (item) { $(curObj.itemsContainer).insert({ 'bottom': curObj.ItemNode(1, item.id, item.name) }) }) } else if (catTier == 2) { this.Tier2Cat.each(function (item) { if (item.RefId == catId) $(curObj.itemsContainer).insert({ 'bottom': curObj.ItemNode(2, item.id, item.name) }) }) } else if (catTier == 3) { this.Tier3Cat.each(function (item) { if (item.RefId == catId) $(curObj.itemsContainer).insert({ 'bottom': curObj.ItemNode(3, item.id, item.name) }) }) } }, RemoveTitleNode: function (catTier) { for (var i = catTier; i < 4; i++) { $$("span.TreeTitleItemTier" + i).each(function (item) { $(item).remove() }) } }, ItemNode: function (tier, cID, title) { this.el = new Element('li', { className: 'TreeItemTier' + this.tier }); this.el.insert({ 'top': new Element('a', { 'href': 'return false;', catTier: tier, catid: cID }).update(title) }); this.el.observe('click', this.OnItemClick.bindAsEventListener(this)); return this.el }, TitleNode: function (tier, cID, title) { this.el = new Element('span', { className: 'TreeTitleItemTier' + tier }); this.el.insert({ 'top': new Element('a', { 'href': 'return false;', catTier: tier, catid: cID }).update(title) }); this.el.insert({ 'bottom': new Element('img', { 'src': this.options.titleSpacerImage, className: 'catTitleSpacerImg' }) }); this.el.observe('click', this.OnTitleClick.bindAsEventListener(this)); return this.el }, OnTitleClick: function (event) { var ele = Event.element(event); if ($(ele).readAttribute("catid") == null) ele = $(ele).firstDescendant(); var CatId = $(ele).readAttribute("catid"); var catTier = $(ele).readAttribute("catTier"); if (CatId == this.categoryID && catTier == this.tier) { Event.stop(event); return false } this.tier = catTier; this.categoryID = CatId; var temp = parseInt(catTier) + 1; if (temp > 3) temp = 3; this.ApplyOptions(); this.CreateTitleElement(catTier == 0 ? 1 : catTier, CatId); this.CreateItemElement(temp, CatId); this.SetCatCaption(); Event.stop(event) }, OnItemClick: function (event) { var ele = Event.element(event); if ($(ele).readAttribute("catid") == null) ele = $(ele).firstDescendant(); var CatId = $(ele).readAttribute("catid"); var catTier = $(ele).readAttribute("catTier"); if (CatId == this.categoryID && catTier == this.tier) { Event.stop(event); return false } var temp = parseInt(catTier) + 1; if (temp > 3) temp = 3; this.tier = catTier; this.categoryID = CatId; this.ApplyOptions(); this.CreateTitleElement(catTier, CatId); this.CreateItemElement(temp, CatId); this.SetCatCaption(); Event.stop(event) }, ApplyOptions: function () { this.selector.ApplyOptions({ categoryID: this.categoryID, categoryTier: this.tier }) }, SetCatCaption: function () { var catTitle = ""; for (var i = 1; i < 4; i++) { $$("span.TreeTitleItemTier" + i).each(function (item) { catTitle += $(item).firstDescendant().innerHTML + " " }) } if (catTitle != "") { catTitle = catTitle.substring(0, catTitle.length - 1) } else { catTitle = "All" } this.selector.CatName = catTitle; this.selector.UpdateTitle() } });