﻿function ButtonBuyItem_onclick(a, b) { ret = Avenue7_Presentation.ProductService.ProductRecordBuyItem(a, b, BuyProductOC, BuyProductOE); window.open(b) } function BuyProductOC(a) { } function BuyProductOE(a) { } function ButtonReport_Onclick() { ret = Avenue7_Presentation.UserService.ReportItem(window.location.href, ReportOC, ReportOE); MM.showWaiting("This item is being reported, please wait", "Reporting item...") } function ReportOC(a) { MM.showMessage("This item has been reported to the administrators. Thank you for reporting inappropriate content. If you have any further questions please email info@avenue7.com.", "Item Reported.") } function ReportOE(a) { MM.showMessage("There was a problem reporting the item, we will try and solve this problem as soon as possible. In the mean time please email us at info@avenue7.com to tell us of this inappropriate item and we will take action immediately.", "Reporting item failed.") } function AddToFavourites_onclick(a) { if ($('LoggedInCheck')) { ret = Avenue7_Presentation.FavouriteService.FavouritesAddTo(a, AddFavouriteOC, AddFavouriteOE) } else if ($('LoggedOutCheck')) { var b = (unescape(document.cookie)).split("; "); for (var i = 0; i < b.length; i++) { var c = b[i].split("="); if (a == c[1]) { MM.showMessage("This item is already in your favorites!", "Item Already Added"); return } } var d = 0; cookieNumFavs = readCookie("numFavs"); if (cookieNumFavs) d = parseInt(cookieNumFavs) + 1; else d = 1; createCookie("numFavs", d, 9); createCookie("Favourite" + d, a, 9); MW.showBoxP('/ModalContent/AddToFavouriteUnlogged.aspx?ProductGuid=' + a); ret = Avenue7_Presentation.FavouriteService.FavouritesAddToCookie(d, AddFavouriteCookieOC, AddFavouriteCookieOE); return } else { window.location = "~/error.aspx" } } function AddFavouriteOC(a) { if (a == "alreadyAdded") { MM.showMessage("This item is already in your favorites!", "Item Already Added") } else if (a == "login") { MW.showBoxP('/ModalContent/loginSml.aspx') } else { if ($('numFavsDiv')) { var b = window.parent.FlashNewOutfit.bindAsEventListener(this); $('numFavsDiv').update(a); MM.showMessageFunc('Item successfully added to your favorites.', 'Item Added to favorites', b) } else MM.showMessage('Item successfully added to your favorites.', 'Item Added to favorites') } } function AddFavouriteOE(a) { MM.showMessage("There was an error adding this item to your favorites.", "Error Adding to favorites") }; RateSubmitOC = function (a) { var b = a.evalJSON(); $('voteCount').update(b.voteCount); $('viewCount').update(b.viewCount); $('hearts00').hide(); $('hearts05').hide(); $('hearts10').hide(); $('hearts15').hide(); $('hearts20').hide(); $('hearts25').hide(); $('hearts30').hide(); var c = b.ratingCount; if (c < 0.75) $('hearts05').show(); else if (c < 1.25) $('hearts10').show(); else if (c < 1.75) $('hearts15').show(); else if (c < 2.25) $('hearts20').show(); else if (c < 2.75) $('hearts25').show(); else $('hearts30').show() }; RateSubmitOE = function () { MM.showMessage('There was an error with your rating. Sorry! We will fix this ASAP!', 'Error Rating Outfit'); $('rateContainer').hide }; function AddFavouriteOutfitOC(a) { if (a == "alreadyAdded") { MM.showMessage("This outfit is already in your favorites!", "Outfit Already in favorites") } else if (a == "userCreatedOutfit") { MM.showMessage("You can't add your own outfits to your favorites!", "Oops! This Is Your Own Outfit") } else if (a == "login") { MW.showBoxP('/ModalContent/loginSml.aspx') } else if (a == "success") { MM.showMessage('This outfit has been added to your favorites.', 'Oufit Added to favorites') } else { AddFavouriteOutfitOE(a) } } function AddFavouriteOutfitOE(a) { MM.showMessage("There was an error adding this outfit to your favorites.", "Error Adding to favorites") } function AddFavouriteCookieOC(a) { } function AddFavouriteCookieOE(a) { } function OnCompleteC(a, b) { if (a == "login") { window.location = "/Login?" + window.location } else { b.RecordRatingComplete(a) } } function OnErrorC(a) { } function FlashNewOutfit() { }; var AddToCanvas = Class.create({ initialize: function () { this.cookie = new CookieJar({ path: '/' }) }, AddToCanvasByID: function (a) { ret = Avenue7_Presentation.ProductService.GetProductDetailsForAddToCanvas(a, this.AddToCanvasOC, this.AddToCanvasOE, this); return false }, AddToCanvas: function (a, b, c) { try { var d = this.cookie.get("AddToCanvas"); if (d != null && d != "") { for (var i = 0; i < d.length; i++) { if (d[i].id == a) { return; break } } } else d = []; var f = {}; f.id = a; f.Url = b; f.ImgP = c; d.push(f); this.cookie.put("AddToCanvas", d) } catch (e) { MM.showMessage("There was an error adding this item to the outfit designer.", "Add to designer") } }, AddToCanvasOC: function (a, b) { try { var c = a.evalJSON(); b.AddToCanvas(c.ID, c.imageFile, c.ImageP) } catch (e) { MM.showMessage("There was an error adding this item to the outfit designer.", "Add to designer") } }, AddToCanvasOE: function (a) { MM.showMessage("There was an error adding this item to the outfit designer.", "Add to designer") } }); ProductPopup = Class.create(); ProductPopup.prototype = { initialize: function () { Event.observe($$('body')[0], 'click', this.hideOverlay.bindAsEventListener(this)); Event.observe($$('body')[0], 'keypress', this.OnKeyPress.bindAsEventListener(this)); this.templateProduct = new Template('<div class="popupContent"><p><a class="popupLink" href="#{productURL}">See more details...</a></p>' + '<ul class="popupLinks">' + '<li><a class="popupLink" id="aFav">Add to my favorites</a></li> ' + '<li><a class="popupLink" id="aAdd">Add item to Designer</a> </li>' + '</ul></div>' + '<div style="float:right"><a id="close"><img src="../../../App_Themes/Av7/images/all-lang/outfit_creator/button_close.gif" alt="Close"></a></div>' + '<div class="clearer"></div>'); this.RegisterDefaultEvents() }, RegisterDefaultEvents: function () { $$('a[GSwidget=Popup]').each(function (s) { Event.observe($(s), 'click', this.overlay.bindAsEventListener(this)) } .bind(this)) }, overlay: function (a) { if ($('divPopup')) $('divPopup').remove(); this.El = Event.element(a); this.Data = $(Event.element(a).parentNode).readAttribute('GSwidgetParams').evalJSON(); this.PopupcontainerDiv = new Element('div', { id: 'divPopup', style: 'position:absolute;', className: 'av7popup' }).update('<div class="popOverLoadingTempDiv">loading ...<div>'); this.PopupcontainerDiv.update(this.templateProduct.evaluate(this.Data)); if (!a) var a = window.event; a.cancelBubble = true; if (a.stopPropagation) a.stopPropagation(); $(this.El).parentNode.parentNode.appendChild(this.PopupcontainerDiv); var b = $(this.El).cumulativeOffset(); var c = $(this.El).getDimensions(); var d = $(this.El).cumulativeScrollOffset(); var e = document.viewport.getScrollOffsets(); var f = $(this.El).positionedOffset().left + c.width / 2 - $('divPopup').getWidth(); var g = b.top - d.top + e.top + c.height / 3; this.PopupcontainerDiv.setStyle({ top: g + "px", left: f + "px" }); this.PopupcontainerDiv.show(); Event.observe("aFav", 'click', this.AddToFavourites.bindAsEventListener(this)); Event.observe("aAdd", 'click', this.AddToCanvas.bindAsEventListener(this)); return false }, overlayForFL: function (a, b) { if ($('divPopup')) $('divPopup').remove(); this.Data = $(a).readAttribute('GSwidgetParams').evalJSON(); this.PopupcontainerDiv = new Element('div', { id: 'divPopup', style: 'position:absolute;', className: 'av7popup' }).update('<div class="popOverLoadingTempDiv">loading ...<div>'); this.PopupcontainerDiv.update(this.templateProduct.evaluate(this.Data)); if (!b) var b = window.event; b.cancelBubble = true; if (b.stopPropagation) b.stopPropagation(); document.body.appendChild(this.PopupcontainerDiv); var c = getElementXYPos(a); var d = c.x + $(a).getWidth() / 2 - $('divPopup').getWidth(); var f = c.y; if (Prototype.Browser.IE) { f = f + $(a).getHeight() / 2 } else { f = f - 70 } this.PopupcontainerDiv.setStyle({ top: f + "px", left: d + "px" }); this.PopupcontainerDiv.show(); Event.observe("aFav", 'click', this.AddToFavourites.bindAsEventListener(this)); Event.observe("aAdd", 'click', this.AddToCanvas.bindAsEventListener(this)); try { Event.stop(b) } catch (e) { } try { if (IsOwner == "true") $($("aFav").parentNode).hide() } catch (e) { } return false }, AddToFavourites: function () { AddToFavourites_onclick(this.Data.itemGuid) }, AddToCanvas: function () { var a = new AddToCanvas(); a.AddToCanvas(this.Data.itemID, this.Data.imageFile, this.Data.imageProp) }, OnFailure: function (a, b) { }, hideOverlay: function () { if ($('divPopup')) $('divPopup').remove() }, OnKeyPress: function (a) { a = a || window.event; var b = a.which || a.keyCode; if (b == 27) this.hideOverlay() } }; function getElementXYPos(a) { var b = []; if (a.getBoundingClientRect) { var c = a.getBoundingClientRect(); var d = document; var e = Math.max(d.documentElement.scrollTop, d.body.scrollTop); var f = Math.max(d.documentElement.scrollLeft, d.body.scrollLeft); if (Prototype.Browser.IE) { c.left -= 2; c.top -= 2 } b.x = c.left + f; b.y = c.top + e } else { var g = []; g.x = a.offsetLeft; g.y = a.offsetTop; var h = a.offsetParent; var i = Prototype.Browser.WebKit; var j = this.RetrieveStyleAttributeDetails(a, "position") == "absolute"; if (h != a) { while (h) { g.x += h.offsetLeft; g.y += h.offsetTop; if (i && !j && this.RetrieveStyleAttributeDetails(h, "position") == "absolute") { j = true } h = h.offsetParent } } if (i && j) { g.x -= document.body.offsetLeft; g.y -= document.body.offsetTop } h = node.parentNode; while (h && h.tagName != "HTML" && h.tagName != "BODY") { if (this.RetrieveStyleAttributeDetails(h, "display") != "inline") { g.x -= h.scrollLeft; g.y -= h.scrollTop } h = h.parentNode } b = g } return b } function RetrieveStyleAttributeDetails(a, b) { if (a.style && a.style[attribute]) { return a.style[attribute] } else { if (a.currentStyle) { return a.currentStyle[attribute] } else { if (document.defaultView && document.defaultView.getComputedStyle) { attribute = attribute.replace(/([A-Z])/g, "-$1"); attribute = attribute.toLowerCase(); var s = document.defaultView.getComputedStyle(a, ""); return s && s.getattributeertyValue(attribute) } else { return null } } } }