var ad = { adSplash: { adID: null, sizeID: null, keyword: null, createAd: function(c, b, a) { this.adID = c; this.sizeID = b; if (a) { this.keyword = a.keyword ? a.keyword : "" } document.write('<div id="aje_' + this.adID + '"></div>') }, generateScript: function() { if (this.adID != null) { var a = ""; a += '<script  type="text/javascript" language="JavaScript">var aj_server ="http://rotator.adjuggler.com/servlet/ajrotator/";var aj_tagver = "1.0";var aj_zone = "adsplash";var aj_adspot = "' + this.adID + '";var aj_page = "0";var aj_dim = "' + this.sizeID + '";var aj_ch = "";var aj_ct = "";var aj_kw = "' + this.keyword + '";var aj_pv = true;var aj_click = "";<\/script>'; a += '<script id="aje_scr_' + this.adID + '" type="text/javascript" language="JavaScript" src="http://img1.cdn.adjuggler.com/banners/async-ajtg.js"><\/script>'; $("#adSplashContainer").attr("id", "aje_tmp_" + this.adID); document.write(a) } } } }; var api = { search: function(g, d, b, e) { e = e || {}; defaults = { lang: "en-ca", page: 1, pageSize: 24, sortDir: "asc", format: "json", urlType: "friendly" }; e = $.extend(defaults, e); var c = this, h = (e.lang.toLowerCase() == "en-ca") ? "/en-CA" : "/fr-CA", a = (e.urlType.toLowerCase() == "phsyical") ? "/projects/api/search.aspx?" : h + "/api/search/products()?", f = "&lang=" + e.lang + "&format=" + e.format + ((e.cat) ? "&categoryid=" + e.cat : "") + ((e.keyword) ? "&query=" + escape(e.keyword) : "") + ((e.facets) ? "&include=facets" : "") + ((e.facetpath) ? "&facetpath=" + escape(e.facetpath) : ""), i = "&page=" + e.page + "&pageSize=" + e.pageSize + "&sortdir=" + e.sortDir + ((e.sortBy) ? "&sortby=" + e.sortBy : ""); this.keyword = d; this.page = e.page; this.pageSize = e.pageSize; this.sortDir = e.sortDir; this.sortBy = (e.sortBy) ? e.sortBy : null; this.facetPath = (e.facetpath) ? e.facetpath : null; this.args = e; this.gotoPage = function(j, n, m, l, k) { i = "&page=" + ((n) ? n : this.page) + "&pageSize=" + ((m) ? m : this.pageSize) + "&sortdir=" + ((k) ? k : this.sortDir) + ((l) ? "&sortby=" + l : ((this.sortBy) ? "&sortby=" + this.sortBy : "")) + ((e.format == "jsonp") ? "&jsoncallback=?" : ""); $.getJSON(a + f + i, null, function(p, o) { j(p, o) }) }; this.gotoPage(b); return this }, product: function(f, b, d) { d = d || {}; defaults = { reviews: false, lang: "en-ca", include: null, format: "json" }; d = $.extend(defaults, d); var e = (d.reviews) ? "reviews" : "product", c = "/" + d.lang + "/api/" + e + "/" + f + ".aspx?", a = ((d.include) ? "include=" + d.include : "") + ((d.format == "jsonp") ? "&format=jsonp&jsoncallback=?" : "&format=" + d.format); $.getJSON(c + a, null, function(h, g) { b(h, g, d) }) } }; var api2 = { search: function(a) { var c = { cat: null, kw: null, upc: null, lang: "en", page: 1, pageSize: 24, sortDir: "asc", sortBy: null, format: "json", path: "", filter: "", include: null, requestObj: {}, cb: null, onStart: function() { }, jsonCallback: "", domain: "", singleCall: true }, b = 0, d = 0; a = $.extend(true, c, a); a = $.extend(true, a, a.requestObj); this.update = function(f) { b++; a = $.extend(true, a, f); a.requestObj = a; var e = a.domain + "/api/v2/" + (a.format == "jsonp" ? "json" : a.format) + "/search" + (a.upc ? "/upc/" + a.upc : "") + "?" + (a.lang.toLowerCase() == "fr" || a.lang.toLowerCase() == "fr-ca" ? "lang=fr&" : "") + (a.cat ? "categoryid=" + a.cat + "&" : "") + (a.query ? "query=" + a.query + "&" : "") + ("page=" + a.page + "&") + ("pagesize=" + a.pageSize + "&") + (a.sortBy ? "sortby=" + a.sortBy + "&" : "") + (a.sortDir ? "sortdir=" + a.sortDir + "&" : "") + (a.filter ? "filter=" + a.filter + "&" : "") + (a.path ? "path=" + escape(a.path) + "&" : "") + (a.include ? "include=" + a.include + "&" : "") + (a.format.toLowerCase() == "jsonp" ? "callback=" + (a.jsonCallback ? a.jsonCallback : "?") : ""); a.onStart(); if (a.jsonCallback) { window[a.jsonCallback] = "" } $.ajax({ dataType: a.format.toLowerCase(), data: null, jsonp: "callback", url: e, success: function(h, g) { d++; if ((b == d) || !a.singleCall) { a.cb(h, g) } } }) }; this.update(); this.getRQ = function() { return a.requestObj }; return this } }; var util = { uagent: navigator.userAgent.toLowerCase(), browser: { isIE: function(a) { a = a || {}; if (/MSIE (\d+\.\d+);/i.test(util.uagent)) { if ((Number(a.ver) == 6 && Number(RegExp.$1) == 6) || !a.ver) { return true } } return false } }, device: { isApple: function(a) { a = a || {}; if (a.devices) { var c = String(a.devices).split(","); for (var b in c) { if (util.uagent.search(c[b]) > -1) { return true } } } else { if (util.uagent.search(/ipod|ipad|iphone/) > -1) { return true } } return false }, isAndroid: function(a) { a = a || {}; if (util.uagent.search(/android/) > -1) { return true } return false }, isBlackberry: function(a) { a = a || {}; if (util.uagent.search(/blackberry/) > -1) { return true } return false }, isWindowsPhone: function(a) { a = a || {}; if (util.uagent.search(/windows phone/) > -1) { return true } return false }, isTouchEnabled: function(a) { a = a || {}; return ("ontouchstart" in document.documentElement) } }, view: { getSize: function() { var b = 0, a = 0; if (typeof ($(window).width()) == "number") { b = $(window).width(); a = $(window).height() } else { if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { b = document.documentElement.clientWidth; a = document.documentElement.clientHeight } } return { width: b, height: a} }, getScrollY: function() { var a = 0; if (typeof (window.pageYOffset) == "number") { a = window.pageYOffset } else { if (document.body && document.body.scrollTop) { a = document.body.scrollTop } else { if (document.documentElement && document.documentElement.scrollTop) { a = document.documentElement.scrollTop } } } return a }, getDocSize: function() { return { width: Math.max($(document).width(), $(window).width(), document.documentElement.clientWidth), height: Math.max($(document).height(), $(window).height(), document.documentElement.clientHeight)} } }, url: { qs: function(a) { var b = location.search.match(new RegExp("[?&]" + a + "=([^&]*)(&?)", "i")); return b ? b[1] : b }, prodImage: function(c, a) { a = a || {}; var b = (a.size) ? String(a.size) : false; b = b ? (b.search("x") > -1 ? b : b + "x" + b) : "55x55"; return c ? (a.host ? a.host : "") + "/multimedia/products/" + b + "/" + c.substr(0, 3) + "/" + c.substr(0, 5) + "/" + c + ".jpg" : "" } }, countdown: function(g, i) { i = i || {}; var f = this; var c = 1000, k = 60 * c, a = 60 * k, e = 24 * a; var b = new Date(); var j = g - b.getTime(); var d = (i.onTick) ? i.onTick : function(l) { }; var h = (i.onFinish) ? i.onFinish : function(l) { }; this.days = this.hours = this.mins = this.secs = 0; this.start = function() { if (j < 1) { return h(this) } var l = j; this.days = Math.floor(l / e); this.hours = Math.floor((l -= (e * this.days)) / a); this.mins = Math.floor((l -= (a * this.hours)) / k); this.secs = Math.floor((l -= (k * this.mins)) / c); d(this); j -= 1000; setTimeout(arguments.callee, 1000) } }, cookie: { getCookie: function(b) { var c, a, e, d = document.cookie.split(";"); for (c = 0; c < d.length; c++) { a = d[c].substr(0, d[c].indexOf("=")); e = d[c].substr(d[c].indexOf("=") + 1); a = a.replace(/^\s+|\s+$/g, ""); if (a == b) { return unescape(e) } } }, createCookie: function(c, d, e) { if (e) { var b = new Date(); b.setTime(b.getTime() + (e * 24 * 60 * 60 * 1000)); var a = "; expires=" + b.toGMTString() } else { var a = "" } document.cookie = c + "=" + d + a + "; path=/" }, eraseCookie: function(a) { createCookie(a, "", -1) } } }; var track = { ab_icmp: function(g) { var c = { cookiename: "", duration: 30, variations: [] }; g = $.extend(true, c, g); var d = window.location.toString(); if (!util.url.qs("ICMP")) { var b; if (util.cookie.getCookie(g.cookiename)) { b = util.cookie.getCookie(g.cookiename) } else { var a = Math.floor(Math.random() * 100), h = 0; for (var f = 0; f < g.variations.length; f++) { var e = g.variations[f]; if (a < h + e.ratio) { b = e.icmp; util.cookie.createCookie(g.cookiename, b, g.duration); break } else { h += e.ratio } } } var j = (g.url) ? g.url : d; if (b) { window.location = j + ((j.search(/\?/) < 0) ? "?" : "&") + "ICMP=" + b } } return b } }; var ui = { lightbox: { init: function(c, a) { a = a || {}; var b = this, d = new ui.pageDimmer.init(); d.click(function() { b.hide() }); this.lightboxdiv = $('<div class="ui-lightbox2"></div>').append($('<div class="content"></div>')).append($('<div class="controls"></div>').append($('<a class="close" href="#"></a>').html("close").click(function() { b.hide(); return false })).append($('<a class="prev advance" href="#"></a>').html("previous").click(function() { b.gotoIndex("prev"); return false })).append($('<a class="next advance" href="#"></a>').html("next").click(function() { b.gotoIndex("next"); return false }))).appendTo($("body")); if (c.length < 2 || a.disableControls) { this.lightboxdiv.find(a.disableControls ? ".controls" : ".controls .advance").remove() } a.id && this.lightboxdiv.attr("id", a.id); a.cssClass && this.lightboxdiv.addClass(a.cssClass); this.current = 1; c.each(function(f) { var g = $(this), e = g.attr("href"); g.attr("href", "#").click(function() { var h = util.view.getSize().height - b.lightboxdiv.outerHeight() + b.lightboxdiv.innerHeight(), k = util.view.getSize().width - b.lightboxdiv.outerWidth() + b.lightboxdiv.innerWidth(), l = 100, j = 100; var n = function(s, r, o, p) { p = p || {}; o = o > l ? o : l; r = r > j ? r : j; var q = { top: (h - o) / 2 < 10 ? 10 + util.view.getScrollY() : (h - o) / 2 + util.view.getScrollY(), left: (k - r) / 2 < 10 ? 10 : (k - r) / 2, width: r, height: o }; if (s && !a.disableAnimation) { b.lightboxdiv.find(".content").empty().andSelf().show().animate(q, 400, function() { $(this).find(".content").hide().html(s).fadeIn(); p.callback && p.callback() }) } else { b.lightboxdiv.show().css(q).find(".content").html(s ? s : ""); p.callback && p.callback() } a.positionControls && a.positionControls(q); d.show() }; !b.lightboxdiv.is(":visible") && n(null, 100, 100); if (e.match(/([^\/\\]+)\.(jpg|jpeg|gif|png)$/i)) { $("<img></img>").one("load", function() { n($(this), $(this).attr("width"), $(this).attr("height")) }).attr("src", e).each(function() { this.complete && $(this).trigger("load") }) } else { if (e.match(/(^#.{1,})/i)) { n($(e).html(), $(e).width(), $(e).height()) } else { if (e.match(/([^\/\\]+)\.(swf)/i)) { var i = ($(this).attr("data-size")) ? $(this).attr("data-size").split("x")[0] : 100, m = ($(this).attr("data-size")) ? $(this).attr("data-size").split("x")[1] : 100; n($('<div id="flashdiv"></div>'), i, m, { callback: function() { swfobject.embedSWF(e, "flashdiv", i, m, "9.0.0", null, null, { wmode: "transparent" }) } }) } } } b.current = f + 1; return false }) }); this.hide = function() { this.lightboxdiv.hide().find(".content").html(""); d.hide() }; this.gotoIndex = function(e) { e == "next" ? $(c[this.current == 1 ? c.length - 1 : this.current - 2]).trigger("click") : e == "prev" && $(c[this.current == c.length ? 0 : this.current]).trigger("click"); if (e < c.length) { $(c[e]).trigger("click") } }; return this } }, SlideShow: { init: function(e, b, a) { var c = this, d = { startingSlide: 1, wrapSlides: true, defaultTransition: ui.transition.none, controls: ui.controls.simple, controlPanel: $('<div class="pnl-controls"></div>').prependTo($(e)) }; a = $.extend(d, a); this.current = 0; this.transition = a.defaultTransition; this.slides = ($.isArray(b)) ? b : (function() { var f = new Array; $(b).children().each(function() { f.push(new ui.SlideShow.slide($(this))) }); return f })(); this.total = this.slides.length; this.next = function() { if (this.current < this.total) { this.gotoSlide(this.current + 1) } else { if (a.wrapSlides) { this.gotoSlide(1) } } }; this.prev = function() { if (this.current > 1) { this.gotoSlide(this.current - 1) } else { if (a.wrapSlides) { this.gotoSlide(this.total) } } }; this.gotoSlide = function(h, g) { g = g || {}; if (this.current != h) { var f = this.slides[h - 1]; var i = (!f.transition) ? this.transition : f.transition; i.exec(this.slides, (this.current < 1) ? 1 : this.current - 1, h - 1, g); this.current = h; this.controls.update() } }; this.controls = new a.controls(a.controlPanel, this); this.start = function() { this.gotoSlide(a.startingSlide) } }, slide: function(b, a) { a = a || {}; this.interval = null; this.transition = a.transition; this.onReady = function() { }; this.ready = function(c) { this.onReady = c }; this.obj = b } }, timer: {}, progessIndicator: {}, transition: { none: { exec: function(f, a, b) { var d = f[b]; var e = f[a]; $(e.obj).hide(); $(d.obj).show(0, function() { d.onReady() }) } } }, controls: { none: function() { return null }, simple: function(c, b, a) { this.update = function() { }; $(c).append($('<a href="#" class="btnPrev">prevous</a>').click(function() { b.prev() })).append($('<a href="#" class="btnNext">next</a>').click(function() { b.next() })) } }, slideshow: function() { this.divid = ""; this.slides = []; this.params = []; this.controls = []; this.numSlides = 0; this.progressBar = null; this.globalTimer = null; this.interval = []; this.curr = { paused: false, currSlide: 0, prevSlide: 0, timer: null }; this.utils = { tmpNavItem: 0 }; this.init = function(g, e, c, f, a) { this.divid = g; this.slides = e; this.controls = c; this.params = f; this.bubbles = a; var b = { overflow: "hidden", width: this.params.width, position: "relative" }; this.prepareSlides(); this.prepareControls(); this.controls.enableTracking ? this.activateTracking() : false; var d = { width: this.numSlides * this.params.width, left: 0, position: "relative" }; $("#" + this.divid).css(b); $("#" + this.divid + " .slides").css(d); this.buildNavigation(); this.globalTimer = new ui.GlobalTimer(); this.globalTimer.start(); this.start(); return this }; this.prepareControls = function() { this.ensureDefaults(); this.params.previous.id ? this.addControl("previous") : false; this.params.pause.id ? this.addControl("pause") : false; this.params.next.id ? this.addControl("next") : false; this.controls.enableProgressBar ? this.addControl("progressBar") : false; this.controls.enableBubbles ? this.prepareBubbles() : false; (this.params.slideDate == null) && (this.params.slideDate = "unknown") }; this.ensureDefaults = function() { if (this.controls.enableProgressBar == undefined) { this.controls.enableProgressBar = true } if (this.controls.enableBubbles == undefined) { this.controls.enableBubbles = true } if (this.controls.enableTracking == undefined) { this.controls.enableTracking = true } if (this.controls.enableProgressBuffer == undefined) { this.controls.enableProgressBuffer = true } }; this.start = function(a) { obj = this; go = function() { obj.go() }; this.timer = setTimeout(go, a ? a : this.getTimeout()) }; this.addControl = function(b) { var a = ""; switch (b) { case "progressBar": tempHtml = '<div id="' + this.params.progressBar.id + '"></div>'; $("#" + this.divid + " .slideshowControls").append(tempHtml); this.progressBar = new ui.ProgressBar(); this.progressBar.init("#" + this.params.progressBar.id, this.params.interval); this.progressBar.reset(this.getTimeout()); break; case "previous": a = '<a id="' + this.params.previous.id + '">' + this.params.previous.html + "</a>"; break; case "next": a = '<a id="' + this.params.next.id + '">' + this.params.next.html + "</a>"; break; case "pause": a = '<a id="' + this.params.pause.id + '">' + this.params.pause.onPlayHtml + "</a>"; break; default: break } if (a != "") { $("#" + this.divid + " .slideshowControls").append(a) } }; this.prepareSlides = function() { var a = 0; var c = this.slides; var b = this; slideCss = { width: this.params.width, height: this.params.height, display: "block", cssFloat: "left", position: "relative" }; $.each(this.slides, function(e, d) { if (d.customInterval) { b.interval[a] = d.customInterval } else { b.interval[a] = b.params.interval } $("#" + d.id).css(slideCss); a++ }); this.numSlides = a }; this.buildNavigation = function() { sh = this; $(this.params.navigation).children().each(function(a) { $(this).click(function() { var b = $(this).index(); sh.pause(); sh.flip(b); return false }); $(this).mouseenter(function() { var b = $(this).index(); $(this).find(".tooltip").fadeIn() }); $(this).mouseleave(function() { var b = $(this).index(); $(this).find(".tooltip").stop(true, true); $(this).find(".tooltip").fadeOut() }) }) }; this.flip = function(b) { this.curr.prevSlide = this.curr.currSlide; if (b != undefined) { this.curr.currSlide = b } else { this.curr.currSlide++ } if (this.curr.currSlide >= (this.numSlides)) { this.curr.currSlide = 0 } this.globalTimer.reset(); if (this.progressBar) { this.progressBar.reset(this.getTimeout()) } if (this.curr.paused) { this.globalTimer.stop(); if (this.progressBar) { this.progressBar.stop() } } $(this.params.navigation); var a = this.curr.currSlide * this.params.width; this.defaultTransition(this.divid, a) }; this.defaultTransition = function(b, a) { sh = this; $("#" + this.divid + " .slides").fadeOut(sh.params.transitionSpeed / 2, function() { $("#" + b + " .slides").css("left", a * -1); $("#" + sh.divid + " .slides").fadeIn(sh.params.transitionSpeed / 2) }) }; this.getTimeout = function() { return this.interval[this.curr.currSlide] }; this.pause = function() { clearTimeout(this.timer); this.curr.paused = true; $("#" + this.params.pause.id).html(this.params.pause.onPauseHtml); if (this.progressBar) { this.progressBar.stop() } this.globalTimer.stop() }; this.resume = function() { var a = this.getTimeout() - this.globalTimer.timer; if (a < this.params.buffer) { a = this.params.buffer; if (this.progressBar) { this.progressBar.bumpProgress(a) } } this.curr.paused = false; this.start(a); $("#" + this.params.pause.id).html(this.params.pause.onPlayHtml); if (this.progressBar) { this.progressBar.resume(a) } this.globalTimer.start() }; this.prev = function() { var a = ((this.curr.currSlide - 1) < 0) ? this.numSlides - 1 : this.curr.currSlide - 1; this.pause(); this.flip(a) }; this.next = function() { this.pause(); this.flip() }; this.go = function() { clearTimeout(this.timer); if (!this.curr.paused) { this.flip() } obj = this; go = function() { obj.go() }; this.timer = setTimeout(go, this.getTimeout()) }; this.prepareBubbles = function() { sh = this; $("#" + this.divid + " .bubble").each(function() { var b = null, a = $(this); a.wrapInner('<div class="bubbleInsert" />'); a.wrapInner('<div class="bubbleContent" />'); a.prepend('<div class="indicator"></div>'); a.mouseenter(function() { clearTimeout(b); a.css("z-index", "2000"); $(".bubbleContent", this).show("fast"); if (a.attr("id") != null && a.attr("id").length > 0) { this.trackEvent(sh.params.trackingPrefix + sh.params.slideDate + "_S" + (a.parent().index() + 1) + "_bubble_" + a.attr("id")) } else { this.trackEvent(sh.params.trackingPrefix + sh.params.slideDate + "_S" + (a.parent().index() + 1) + "_bubble_" + a.parent().attr("id")) } sh.pause() }); a.mouseleave(function() { bubble = this; var c = function() { $(".bubbleContent", bubble).hide("fast", function() { $(bubble).css("z-index", "1000") }) }; b = setTimeout(c, sh.params.bubbleBuffer) }) }) }; this.activateTracking = function() { sh = this; $("#" + this.divid + " .slides .trackable").each(function() { $(this).click(function() { if ($(this).attr("id") && $(this).attr("href")) { sh.trackEvent(sh.params.trackingPrefix + sh.params.slideDate + "_S" + ($(this).closest("li").index() + 1) + "_" + $(this).attr("id"), $(this).attr("href")); return false } }) }) }; this.trackEvent = function(b, a) { trackEvent.event("event.link", { lid: b }); if (a && a != "#") { window.location = a } } }, ProgressBar: function() { this.divId = ""; this.time = 0; this.rollerWidth = 0; this.init = function(a) { this.divId = a; $(this.divId).html('<div id="roller"></div>'); this.rollerWidth = $(this.divId + " #roller").width() }; this.reset = function(b) { var a = { width: 0 }; this.stop(); this.time = b; $(this.divId + " #roller").css("width", "auto"); $(this.divId + " #roller").animate(a, this.time, "linear") }; this.stop = function() { $(this.divId + " #roller").stop(false, false) }; this.resume = function(b) { var a = { width: 0 }; $(this.divId + " #roller").animate(a, b, "linear") }; this.bumpProgress = function(a) { var b = this.rollerWidth / this.time * a; $(this.divId + " #roller").width(b) } }, GlobalTimer: function() { this.timer = 0; this.looper = null; this.interval = 1000; this.start = function() { clearTimeout(this.looper); var b = this; var a = function() { b.updateTimer() }; this.looper = setTimeout(a, this.interval) }; this.stop = function() { clearTimeout(this.looper) }; this.reset = function() { clearTimeout(this.looper); this.timer = 0; this.start() }; this.updateTimer = function() { this.timer += this.interval; var b = this; var a = function() { b.updateTimer() }; this.looper = setTimeout(a, this.interval) } }, TabControl: function(g, a, c) { if ($(g).data("ref")) { return false } c = c || {}; var f = this; var d = (c.tabs) ? c.tabs : $(g).find(".ui-tabcontrol-tabs"); var e = (c.contents) ? c.contents : $(g).find(".ui-tabcontrol-contents"); var b = d.find(".selected"); this.index = (b.length > 0) ? b.index() + 1 : 1; this.index = (c.index) ? c.index : this.index; this.total = d.children().length; this.contents = e; this.tabs = d; this.gotoTab = function(h) { if (h > 0 && h < this.total + 1) { d.children().removeClass("selected hover").eq(h - 1).addClass("selected"); e.children().removeClass("selected").eq(h - 1).addClass("selected"); this.index = h; if (a) { a(f, f.index) } return true } else { return false } }; this.gotoTab(this.index); this.next = function() { this.gotoTab((this.index == this.total) ? 1 : this.index + 1) }; this.previous = function() { this.gotoTab((this.index == 1) ? this.total : this.index - 1) }; d.each(function() { $(this).children().each(function(h, i) { $(this).find("a").click(function() { f.gotoTab(h + 1); return false }); $(this).hover(function() { if (!$(this).hasClass("selected")) { $(this).addClass("hover") } }, function() { if (!$(this).hasClass("selected")) { $(this).removeClass("hover") } }) }) }); e.find(".ui-tabcontrol-next").click(function() { f.next() }).end().find(".ui-tabcontrol-previous").click(function() { f.previous() }); $(g).data("ref", this); return this }, pageDimmer: { init: function(a) { a = a || {}; var b = this, c = $('<div class="ui-page-dim"></div>').click(function() { b.hide(); return false }).appendTo($("body")); if (a.id) { c.attr("id", a.id) } if (a.cssClass) { c.addClass(a.cssClass) } this.show = function() { c.width($(document).width()).height($(document).height()).show() }; this.hide = function() { c.hide() }; this.click = function(d) { c.click(function() { d() }) }; return this } }, equaliseByRow: function(j, h) { var e = 0, g = 0, d = { container: "prod-orient-ver", rowItemClass: "content", currentIndex: 0, rowMaxItems: null, rowEndClass: "last", setQL: false, setQLClass: "featureproduct" }; h = $.extend(d, h); var c = j.find("." + h.rowItemClass); if (h.rowMaxItems == null) { j.find("." + h.container).each(function(i, l) { if ($(l).attr("class").search(h.rowEndClass) > 0) { h.rowMaxItems = i + 1; return false } }); ((h.rowMaxItems == null) && (h.rowMaxItems = c.length)) } if (h.currentIndex < c.length) { for (var f = h.currentIndex; ((f < c.length) && (f < (h.currentIndex + h.rowMaxItems))); f++) { g = c.eq(f).height(); if (h.setQL == true) { var a = c.eq(f).parent(), b = 0; if ((typeof a.attr("class") === "string") && a.attr("class").search(h.setQLClass) != -1) { if (typeof h.setQLPadding !== "number") { b = ((a.find(".top:first").height()) + (a.find(".bottom:first").height())) } else { b = h.setQLPadding } g = g + b } } e = (g > e) ? g : e } for (var f = h.currentIndex; ((f < c.length) && (f < (h.currentIndex + h.rowMaxItems))); f++) { var k = e; if (h.setQL == true) { var a = c.eq(f).parent(), b = 0; if ((typeof a.attr("class") === "string") && a.attr("class").search(h.setQLClass) != -1) { if (typeof h.setQLPadding !== "number") { b = ((a.find(".top:first").height()) + (a.find(".bottom:first").height())) } else { b = h.setQLPadding } k = e - b } } c.eq(f).height(k) } c = null; h.currentIndex = h.currentIndex + h.rowMaxItems; this.equaliseByRow(j, h) } } }; var validation = {}; var widget = { socialBookmark: function(d) { var e = this, g = { container: $('<div id="socialbookmark">'), socialmedia: "fb_like, twitter", url: null, title: null, description: "", lang: "en", fb_like_args: { width: 300, height: 35, layout: "button_count", show_face: true, action: "like", font: "tahoma", colorscheme: "light", markup: $('<div id="fblink">'), ref: null }, fb_share_args: { type: "button", markup: $('<a name="fb_share">'), button_copy: { en: null, fr: null} }, twitter_args: { type: "horizontal", markup: $('<a class="twitter-share-button">'), button_copy: { en: null, fr: null }, account: null} }; d = $.extend(true, g, d); var a = new Array(), f = new Array(); if (d.socialmedia.search(/fb_like/) > -1) { var c = d.fb_like_args; f.push(c.markup); c.markup.html('<iframe src="http://www.facebook.com/plugins/like.php?locale=' + (d.lang != "fr" ? "en_CA" : "fr_CA") + "&amp;href=" + encodeURIComponent(d.url).replace(/%2F/g, "/") + "&amp;layout=" + c.layout + (c.ref ? "&amp;ref=" + c.ref : "") + "&amp;show_faces=" + c.show_face + "&amp;width=" + c.width + "&amp;action=" + c.action + "&amp;font=" + c.font + "&amp;colorscheme=" + c.colorscheme + "&amp;height=" + c.height + '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' + c.width + "px; height:" + c.height + 'px;" allowTransparency="true"></iframe>') } if (d.socialmedia.search(/fb_share/) > -1) { var c = d.fb_share_args; var b = c.markup; if (c.button_copy[d.lang] != null) { b.html(c.button_copy[d.lang]) } f.push(b); if (c.type != "link") { b.attr({ type: c.type, share_url: d.url }); a.push("http://static.ak.fbcdn.net/connect.php/js/FB.Share") } else { b.attr({ href: "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(d.url) + ((d.title != null) ? "&t=" + encodeURIComponent(d.title) : "") }) } } if (d.socialmedia.search(/twitter/) > -1) { var c = d.twitter_args; var b = c.markup; if (c.button_copy[d.lang] != null) { b.html(c.button_copy[d.lang]) } f.push(b); b.attr({ "data-count": c.type, "data-url": d.url, "data-lang": d.lang }); if (d.title) { b.attr("data-text", d.title) } if (c.counturl) { b.attr("data-counturl", c.counturl) } if (c.account) { b.attr("data-via", c.account) } a.push("http://platform.twitter.com/widgets.js") } this.generateMarkup = function() { $(f).each(function() { d.container.append(this) }) }; this.generateScript = function() { $(a).each(function() { $.getScript(this) }) }; this.generateMarkup(); this.generateScript(); return this } }; var widget2 = { socialBookmark: function(c) { var d = this, f = { container: $('<div id="socialbookmark">'), socialmedia: "fb_like, twitter", url: null, title: null, description: "", lang: "en", google_plus_args: { markup: $('<div style="float:left; width:66px;">'), ref: null }, add_this_args: { type: "button", markup: $('<div class="addthis_toolbox addthis_default_style">'), button_copy: { en: null, fr: null}} }; c = $.extend(true, f, c); var a = new Array(), e = new Array(); if (!($.browser.msie && ($.browser.version.slice(0, 3) == "6.0" || $.browser.version.slice(0, 3) == "7.0"))) { if (c.socialmedia.search(/google_plus/) > -1) { var b = c.google_plus_args; e.push(b.markup); b.markup.html('<div class="plusOneBox"><g:plusone count="true" size="medium"></g:plusone></div>'); a.push("https://apis.google.com/js/plusone.js") } } if (c.socialmedia.search(/add_this/) > -1) { var b = c.add_this_args; e.push(b.markup); b.markup.html('<a class="addthis_button_facebook_like" style="width:75px;"></a><a class="addthis_button_tweet" style="width:75px;" tw:count="horizontal"></a>'); a.push("http://s7.addthis.com/js/250/addthis_widget.js#username=graceying") } this.generateMarkup = function() { $(e).each(function() { c.container.append(this) }) }; this.generateScript = function() { $(a).each(function() { $.getScript(this) }) }; this.generateMarkup(); this.generateScript(); return this } }; if (typeof (jQuery) != "undefined") { (function(a) { a.fn.Bubble = function(b) { var d = { hoverFade: true, opacity: 0.5, speedIn: "fast", speedOut: "fast", tracking: true, date: "", padding: 50 }; b = a.extend(d, b); var c = this, e = a(c).find(".ui-indicator"), f = a.browser.msie; (f) ? c.show() : c.fadeIn("slow"); return c.each(function() { obj = a(this); obj.addClass("ui-bubble"); obj.wrapInner('<div class="ui-bubbleInsert" />'); obj.wrapInner('<div class="ui-bubbleContent" />'); obj.prepend('<div class="ui-indicator"/>'); obj.hover(function() { _this = a(this); var m = (_this.position()).left, j = (_this.position()).top, h = _this.parent().width(), l = _this.parent().height(), g = _this.find(".ui-bubbleContent"), k = g.width(), i = g.height(); if ((m + k + b.padding) > h) { g.css("left", (-1 * k)) } if ((j + i + b.padding) > l - b.padding) { g.css("top", (-1 * i)) } _this.css("z-index", "2000").find(".ui-bubbleContent").fadeIn(b.speedIn); if (b.tracking) { if (_this.attr("id") != null && _this.attr("id").length > 0) { trackEvent.event("event.link", { lid: _this.parent().attr("id") + "_" + b.date + "_bubble_" + _this.attr("id") }) } else { trackEvent.event("event.link", { lid: _this.parent().attr("id") + "_" + b.date + "_bubble_" + _this.parent().attr("id") }) } } if (b.hoverFade) { _this.addClass("hover"); c.each(function() { var n = a(this); if (!n.hasClass("hover")) { (f) ? n.stop().hide() : n.stop().animate({ opacity: b.opacity }, b.speedOut) } }) } }, function() { var g = a(this); g.css("z-index", "170").find(".ui-bubbleContent").fadeOut(b.speedOut); if (b.hoverFade) { (f) ? c.removeClass("hover").stop().show() : c.removeClass("hover").stop().animate({ opacity: 1 }, b.speedIn) } }) }) } })(jQuery); (function(a) { a.fn.buildMenu = function(d) { var g = { hideFlag: "hide-menu", delayIn: 25, delayOut: 10, sensitivity: 7 }, d = a.extend(g, d), f = function(h) { a(".hover,.hover-link", a(h).parent().find("ul:visible").hide().andSelf()).removeClass("hover hover-link"); a(".ul-column").find("li").removeClass("hover hover-link") }, e = function() { f(this); a("> a", a(this).addClass("hover")).addClass("hover-link"); !a(this).hasClass(d.hideFlag) && a(this).find("> ul").show() }, b = function() { a(this).parent(".node-0").length > 0 && f(this) }, c = { sensitivity: d.sensitivity, interval: d.delayIn, over: e, timeout: d.delayOut, out: b }; configMmain = { sensitivity: d.sensitivity, interval: 100, over: e, timeout: d.delayOut, out: b }; return this.each(function() { obj = a(this); obj.find('li:has(ul):not([class*="' + d.hideFlag + '"]) > a').addClass("tree"); obj.addClass("node-0").find("> li > ul").addClass("node-1").andSelf().find("li").hoverIntent(c); obj.addClass("node-0").find(" > li").hoverIntent(configMmain); return this }) } })(jQuery); (function(a) { a.fn.hoverIntent = function(k, j) { var l = { sensitivity: 7, interval: 100, timeout: 0 }; l = a.extend(l, j ? { over: k, out: j} : k); var n, m, h, d; var e = function(f) { n = f.pageX; m = f.pageY }; var c = function(g, f) { f.hoverIntent_t = clearTimeout(f.hoverIntent_t); if ((Math.abs(h - n) + Math.abs(d - m)) < l.sensitivity) { a(f).unbind("mousemove", e); f.hoverIntent_s = 1; return l.over.apply(f, [g]) } else { h = n; d = m; f.hoverIntent_t = setTimeout(function() { c(g, f) }, l.interval) } }; var i = function(g, f) { f.hoverIntent_t = clearTimeout(f.hoverIntent_t); f.hoverIntent_s = 0; return l.out.apply(f, [g]) }; var b = function(q) { var o = (q.type == "mouseover" ? q.fromElement : q.toElement) || q.relatedTarget; while (o && o != this) { try { o = o.parentNode } catch (q) { o = this } } if (o == this) { return false } var g = jQuery.extend({}, q); var f = this; if (f.hoverIntent_t) { f.hoverIntent_t = clearTimeout(f.hoverIntent_t) } if (q.type == "mouseover") { h = g.pageX; d = g.pageY; a(f).bind("mousemove", e); if (f.hoverIntent_s != 1) { f.hoverIntent_t = setTimeout(function() { c(g, f) }, l.interval) } } else { a(f).unbind("mousemove", e); if (f.hoverIntent_s == 1) { f.hoverIntent_t = setTimeout(function() { i(g, f) }, l.timeout) } } }; return this.mouseover(b).mouseout(b) } })(jQuery); (function(a) { a.fn.buildAccordion = function(b) { var d = { hideRest: true, accordClass: "ui-accord", accordHead: "ui-accord-head", accordContent: "ui-accord-content", accordSection: "ui-accord-section", accordSelectedCSS: "selected" }; var b = a.extend(d, b); var c = a(this); c.addClass(b.accordClass).find("." + b.accordHead).click(function() { if (b.hideRest) { a(this).parents("." + b.accordClass).find("." + b.accordSection).removeClass(b.accordSelectedCSS).find("." + b.accordContent).hide() } if (a(this).parent().hasClass(b.accordSelectedCSS)) { a(this).next(":visible").hide().parent().removeClass(b.accordSelectedCSS) } else { a(this).next(":hidden").show().parent().addClass(b.accordSelectedCSS) } }).next().addClass(b.accordContent).hide(); return false } })(jQuery) };
