var SKY = {}; SKY.namespace = function() { var i = arguments, m = null, r, l, o, v = function(z) { return z == "SKY" ? 1 : 0 }; for (r = 0; r < i.length; r += 1) { o = ("" + i[r]).split("."); m = SKY; for (l = v(o[0]); l < o.length; l += 1) { m[o[l]] = m[o[l]] || {}; m = m[o[l]] } } return m }; SKY.bind = function(i, m) { return function() { return m.apply(i, arguments) } };
    
        (function(i) {
            i.fn.lavaLamp = function(b) {
                b = i.extend({ fx: "swing", speed: 500, click: function() { return true }, startItem: "no", autoReturn: true, returnDelay: 0, setOnClick: true, homeTop: 0, homeLeft: 0, homeWidth: 0, homeHeight: 0, returnHome: false, autoInterval: 5E3 }, b || {}); return this.each(function() {
                    function g(c, d, e) { if (b.setOnClick) { i(q).removeClass("selectedLava"); i(c).addClass("selectedLava"); q = c } return b.click.apply(c, [d, c, e]) } function f(c) {
                        c || (c = q); var d = 0, e = 0; if (!i.browser.msie) {
                            d = (n.outerWidth() - n.innerWidth()) /
2; e = (n.outerHeight() - n.innerHeight()) / 2
                        } n.stop().animate({ left: c.offsetLeft - d, top: c.offsetTop - e, width: c.offsetWidth, height: c.offsetHeight }, b.speed, b.fx)
                    } function r() { if (t) { clearTimeout(t); t = null } p() } function p() { t = setTimeout(m, b.autoInterval) } function m() { var c = (a.index(q) + 1) % a.length; g(a[c], null, true); f(); p() } var k = location.pathname + location.search + location.hash, l = {}, o, n, u, q, t; if (b.homeTop || b.homeLeft) {
                        u = i('<li class="homeLava selectedLava"></li>').css({ left: b.homeLeft, top: b.homeTop, width: b.homeWidth,
                            height: b.homeHeight, position: "absolute"
                        }); i(this).prepend(u)
                    } var a = i("li", this); if (b.startItem == "no") l = i('li a[href$="' + k + '"]', this).parent("li"); if (l.length == 0 && b.startItem == "no" && location.hash) l = i('li a[href$="' + location.hash + '"]', this).parent("li"); if (l.length == 0 || b.startItem != "no") { if (b.startItem == "no") b.startItem = 0; l = i(a[b.startItem]) } q = i("li.selectedLava", this)[0] || i(l).addClass("selectedLava")[0]; a.mouseover(function() { if (i(this).hasClass("homeLava")) q = i(this)[0]; f(this) }); n = i('<li class="backLava"><div class="leftLava"></div><div class="bottomLava"></div><div class="cornerLava"></div></li>').appendTo(this);
                    i(this).mouseout(function() { if (b.autoReturn) if (b.returnHome && u) f(u[0]); else if (b.returnDelay) { o && clearTimeout(o); o = setTimeout(f, b.returnDelay + b.speed) } else f() }); a.click(function(c) { r(); g(this, c, false); c.preventDefault() }); b.homeTop || b.homeLeft ? n.css({ left: b.homeLeft, top: b.homeTop, width: b.homeWidth, height: b.homeHeight }) : n.css({ left: q.offsetLeft, top: q.offsetTop, width: q.offsetWidth, height: q.offsetHeight }); b.autoInterval && p()
                })
            } 
        })(jQuery);
        (function() {
            var i = SKY.namespace("SKY.IKON"), b = function(g, f, r, p) {
                this.images = f; this.isFocused = true; this.inactivityShows = 0; var m = this; this.initializeData(); this.options = p || {}; jQuery.extend(this.options, { click: SKY.bind(this, this.click), startItem: 0, fadeTime: 700 }); this.slidemenu = g; this.selectedImage = this.images.children("li:eq(" + this.options.startItem + ")"); this.selectedImage.addClass("selected"); this.images.children("li:not(:eq(" + this.options.startItem + "))").hide(); this.menuItems =
$("li", this.slidemenu); this.slidemenu.lavaLamp(this.options); this.shadow = r; this.changeSelectedClass(this.selectedImage); this.noOfAds = this.images.children().length; this.logData = []; this.images.children("li").each(function(k) { m.logData[k] = { noOfTimesShownAuto: 0, noOfTimesShownManual: 0, isFirstViewInThisSession: true, isCurrentViewManual: false, isCurrentViewAuto: false, sendIt: true, slotNumber: k, brandedSearchId: $("img", $(this)).attr("id").substring(14)} }); this.selectedImage.removeClass("firstproduct"); this.shadow.removeClass("noshow");
                this.logData[0].isCurrentViewAuto = true; this.logData[0].noOfTimesShownAuto = 1; this.startTime = (new Date).getTime(); this.inactivityShows += 1; r.click(SKY.bind(this, function() {
                    if (!this.shadow.hasClass("nolink")) {
                        var k = this.images.children("li").index(this.selectedImage[0]); $.post("/brandedsearchlog", { brandedSearchID: this.logData[k].brandedSearchId, slotId: this.logData[k].slotNumber, isInitialViewUnique: false, isInitialViewAuto: false, isInitialViewManual: false, isViewManual: "", isViewAuto: "", isClick: true,
                            viewTime: 0
                        }); window.open(this.selectedImage.children("a").attr("href"), "featuredagent")
                    } 
                }))
            }; b.prototype = { click: function(g, f, r) {
                var p = this.images.children("li").index(this.selectedImage), m = this.menuItems.index(f); if (p !== m) {
                    var k = this.selectedImage, l = this.images.children("li:eq(" + m + ")"); k.removeClass("selected"); l.addClass("selected").fadeIn(this.fadeTime, SKY.bind(this, function() { if (k[0] != l[0]) { this.setupNewImage(r, m); this.logChange(this.logData[p]); k.hide() } })); this.changeSelectedClass(l); this.selectedImage =
l
                } 
            }, logChange: function(g) {
                var f = (new Date).getTime() - this.startTime; this.startTime = (new Date).getTime(); if (f > 5E3) f = 5E3; else if (f < 0) f = 0; if (g.brandedSearchId !== "" && g.sendIt) {
                    $.post("/brandedsearchlog", { brandedSearchID: g.brandedSearchId, slotId: g.slotNumber, isInitialViewUnique: g.isFirstViewInThisSession, isInitialViewAuto: g.isCurrentViewAuto && g.noOfTimesShownAuto === 1, isInitialViewManual: g.isCurrentViewManual && g.noOfTimesShownManual === 1, isViewManual: g.isCurrentViewManual, isViewAuto: g.isCurrentViewAuto,
                        isClick: false, viewTime: Math.round(f / 1E3)
                    }); g.isFirstViewInThisSession = false; g.sendIt = false
                } 
            }, changeSelectedClass: function(g) { g.children("a").length === 0 ? this.shadow.addClass("nolink") : this.shadow.removeClass("nolink") }, setupNewImage: function(g, f) {
                if (this.isFocused && this.inactivityShows / this.noOfAds < 2) {
                    this.logData[f].sendIt = true; if (g === true) { this.logData[f].isCurrentViewManual = false; this.logData[f].isCurrentViewAuto = true; this.logData[f].noOfTimesShownAuto += 1; this.inactivityShows++ } else {
                        this.logData[f].isCurrentViewManual =
true; this.logData[f].isCurrentViewAuto = false; this.logData[f].noOfTimesShownManual += 1; this.inactivityShows = 0
                    } 
                } else this.logData[f].sendIt = false
            }, onWindowFocus: function() { if (this.isFocused === false) this.inactivityShows = 0; this.isFocused = true }, beforeUnload: function() { this.logChange(this.logData[this.images.children("li").index(this.selectedImage[0])]) }, onWindowBlur: function() { this.isFocused = false; this.logChange(this.logData[this.images.children("li").index(this.selectedImage[0])]) }, resetInactivity: function() {
                this.inactivityShows =
0
            }, resetInactivityIfInFocus: function() { if (this.isFocused) this.inactivityShows = 0 }, initializeData: function() { var g = this; window.onbeforeunload = function() { g.beforeUnload() }; var f = $("body"); f.mousemove(SKY.bind(this, this.resetInactivityIfInFocus)); f.mousedown(SKY.bind(this, this.resetInactivity)); f.keydown(SKY.bind(this, this.resetInactivity)); window.onfocus = function() { g.onWindowFocus() }; window.onblur = function() { g.onWindowBlur() } } 
            }; i.PropertyPlayer = b
        })();
