﻿

/**
* jQuery Galleriffic plugin
*
* Copyright (c) 2008 Trent Foley (http://trentacular.com)
* Licensed under the MIT License:
*   http://www.opensource.org/licenses/mit-license.php
*
* Much thanks to primary contributer Ponticlaro (http://www.ponticlaro.com)
*/
(function (a) { var b = {}; var c = 0; a.galleriffic = { version: "2.0.1", normalizeHash: function (a) { return a.replace(/^.*#/, "").replace(/\?.*$/, "") }, getImage: function (c) { if (!c) return undefined; c = a.galleriffic.normalizeHash(c); return b[c] }, gotoImage: function (b) { var c = a.galleriffic.getImage(b); if (!c) return false; var d = c.gallery; d.gotoImage(c); return true }, removeImageByHash: function (b, c) { var d = a.galleriffic.getImage(b); if (!d) return false; var e = d.gallery; if (c && c != e) return false; return e.removeImageByIndex(d.index) } }; var d = { delay: 3e3, numThumbs: 20, preloadAhead: 40, enableTopPager: false, enableBottomPager: true, maxPagesToShow: 7, imageContainerSel: "", captionContainerSel: "", controlsContainerSel: "", loadingContainerSel: "", renderSSControls: true, renderNavControls: true, playLinkText: "Play", pauseLinkText: "Pause", prevLinkText: "Previous", nextLinkText: "Next", nextPageLinkText: "Next ›", prevPageLinkText: "‹ Prev", enableHistory: false, enableKeyboardNavigation: true, autoStart: false, syncTransitions: false, defaultTransitionDuration: 1e3, onSlideChange: undefined, onTransitionOut: undefined, onTransitionIn: undefined, onPageTransitionOut: undefined, onPageTransitionIn: undefined, onImageAdded: undefined, onImageRemoved: undefined }; a.fn.galleriffic = function (e) { a.extend(this, { version: a.galleriffic.version, isSlideshowRunning: false, slideshowTimeout: undefined, clickHandler: function (b, c) { this.pause(); if (!this.enableHistory) { var d = a.galleriffic.normalizeHash(a(c).attr("href")); a.galleriffic.gotoImage(d); b.preventDefault() } }, appendImage: function (a) { this.addImage(a, false, false); return this }, insertImage: function (a, b) { this.addImage(a, false, true, b); return this }, addImage: function (d, e, f, g) { var h = typeof d === "string" ? a(d) : d; var i = h.find("a.thumb"); var j = i.attr("href"); var k = i.attr("title"); var l = h.find(".caption").remove(); var m = i.attr("name"); c++; if (!m || b["" + m]) { m = c } if (!f) g = this.data.length; var n = { title: k, slideUrl: j, caption: l, hash: m, gallery: this, index: g }; if (f) { this.data.splice(g, 0, n); this.updateIndices(g) } else { this.data.push(n) } var o = this; if (!e) { this.updateThumbs(function () { var a = o.find("ul.thumbs"); if (f) a.children(":eq(" + g + ")").before(h); else a.append(h); if (o.onImageAdded) o.onImageAdded(n, h) }) } b["" + m] = n; i.attr("rel", "history").attr("href", "#" + m).removeAttr("name").click(function (a) { o.clickHandler(a, this) }); return this }, removeImageByIndex: function (a) { if (a < 0 || a >= this.data.length) return false; var b = this.data[a]; if (!b) return false; this.removeImage(b); return true }, removeImageByHash: function (b) { return a.galleriffic.removeImageByHash(b, this) }, removeImage: function (a) { var c = a.index; this.data.splice(c, 1); delete b["" + a.hash]; this.updateThumbs(function () { var b = f.find("ul.thumbs").children(":eq(" + c + ")").remove(); if (f.onImageRemoved) f.onImageRemoved(a, b) }); this.updateIndices(c); return this }, updateIndices: function (a) { for (i = a; i < this.data.length; i++) { this.data[i].index = i } return this }, initializeThumbs: function () { this.data = []; var b = this; this.find("ul.thumbs > li").each(function (c) { b.addImage(a(this), true, false) }); return this }, isPreloadComplete: false, preloadInit: function () { if (this.preloadAhead == 0) return this; this.preloadStartIndex = this.currentImage.index; var a = this.getNextIndex(this.preloadStartIndex); return this.preloadRecursive(this.preloadStartIndex, a) }, preloadRelocate: function (a) { this.preloadStartIndex = a; return this }, preloadRecursive: function (a, b) { if (a != this.preloadStartIndex) { var c = this.getNextIndex(this.preloadStartIndex); return this.preloadRecursive(this.preloadStartIndex, c) } var d = this; var e = b - a; if (e < 0) e = this.data.length - 1 - a + b; if (this.preloadAhead >= 0 && e > this.preloadAhead) { setTimeout(function () { d.preloadRecursive(a, b) }, 500); return this } var f = this.data[b]; if (!f) return this; if (f.image) return this.preloadNext(a, b); var g = new Image; g.onload = function () { f.image = this; d.preloadNext(a, b) }; g.alt = f.title; g.src = f.slideUrl; return this }, preloadNext: function (a, b) { var c = this.getNextIndex(b); if (c == a) { this.isPreloadComplete = true } else { var d = this; setTimeout(function () { d.preloadRecursive(a, c) }, 100) } return this }, getNextIndex: function (a) { var b = a + 1; if (b >= this.data.length) b = 0; return b }, getPrevIndex: function (a) { var b = a - 1; if (b < 0) b = this.data.length - 1; return b }, pause: function () { this.isSlideshowRunning = false; if (this.slideshowTimeout) { clearTimeout(this.slideshowTimeout); this.slideshowTimeout = undefined } if (this.$controlsContainer) { this.$controlsContainer.find("div.ss-controls a").removeClass().addClass("play").attr("title", this.playLinkText).attr("href", "#play").html(this.playLinkText) } return this }, play: function () { this.isSlideshowRunning = true; if (this.$controlsContainer) { this.$controlsContainer.find("div.ss-controls a").removeClass().addClass("pause").attr("title", this.pauseLinkText).attr("href", "#pause").html(this.pauseLinkText) } if (!this.slideshowTimeout) { var a = this; this.slideshowTimeout = setTimeout(function () { a.ssAdvance() }, this.delay) } return this }, toggleSlideshow: function () { if (this.isSlideshowRunning) this.pause(); else this.play(); return this }, ssAdvance: function () { if (this.isSlideshowRunning) this.next(true); return this }, next: function (a, b) { this.gotoIndex(this.getNextIndex(this.currentImage.index), a, b); return this }, previous: function (a, b) { this.gotoIndex(this.getPrevIndex(this.currentImage.index), a, b); return this }, nextPage: function (a, b) { var c = this.getCurrentPage(); var d = this.getNumPages() - 1; if (c < d) { var e = c * this.numThumbs; var f = e + this.numThumbs; this.gotoIndex(f, a, b) } return this }, previousPage: function (a, b) { var c = this.getCurrentPage(); if (c > 0) { var d = c * this.numThumbs; var e = d - this.numThumbs; this.gotoIndex(e, a, b) } return this }, gotoIndex: function (b, c, d) { if (!c) this.pause(); if (b < 0) b = 0; else if (b >= this.data.length) b = this.data.length - 1; var e = this.data[b]; if (!d && this.enableHistory) a.historyLoad(String(e.hash)); else this.gotoImage(e); return this }, gotoImage: function (a) { var b = a.index; if (this.onSlideChange) this.onSlideChange(this.currentImage.index, b); this.currentImage = a; this.preloadRelocate(b); this.refresh(); return this }, getDefaultTransitionDuration: function (a) { if (a) return this.defaultTransitionDuration; return this.defaultTransitionDuration / 2 }, refresh: function () { var a = this.currentImage; if (!a) return this; var b = a.index; if (this.$controlsContainer) { this.$controlsContainer.find("div.nav-controls a.prev").attr("href", "#" + this.data[this.getPrevIndex(b)].hash).end().find("div.nav-controls a.next").attr("href", "#" + this.data[this.getNextIndex(b)].hash) } var c = this.$imageContainer.find("span.current").addClass("previous").removeClass("current"); var d = 0; if (this.$captionContainer) { d = this.$captionContainer.find("span.current").addClass("previous").removeClass("current") } var e = this.syncTransitions && a.image; var f = true; var g = this; var h = function () { f = false; c.remove(); if (d) d.remove(); if (!e) { if (a.image && a.hash == g.data[g.currentImage.index].hash) { g.buildImage(a, e) } else { if (g.$loadingContainer) { g.$loadingContainer.show() } } } }; if (c.length == 0) { h() } else { if (this.onTransitionOut) { this.onTransitionOut(c, d, e, h) } else { c.fadeTo(this.getDefaultTransitionDuration(e), 0, h); if (d) d.fadeTo(this.getDefaultTransitionDuration(e), 0) } } if (e) this.buildImage(a, e); if (!a.image) { var i = new Image; i.onload = function () { a.image = this; if (!f && a.hash == g.data[g.currentImage.index].hash) { g.buildImage(a, e) } }; i.alt = a.title; i.src = a.slideUrl } this.relocatePreload = true; return this.syncThumbs() }, buildImage: function (a, b) { var c = this; var d = this.getNextIndex(a.index); var e = this.$imageContainer.append('<span class="image-wrapper current"><a class="advance-link" rel="history" href="#' + this.data[d].hash + '" title="' + a.title + '"> </a></span>').find("span.current").css("opacity", "0"); e.find("a").append(a.image).click(function (a) { c.clickHandler(a, this) }); var f = 0; if (this.$captionContainer) { f = this.$captionContainer.append('<span class="image-caption current"></span>').find("span.current").css("opacity", "0").append(a.caption) } if (this.$loadingContainer) { this.$loadingContainer.hide() } if (this.onTransitionIn) { this.onTransitionIn(e, f, b) } else { e.fadeTo(this.getDefaultTransitionDuration(b), 1); if (f) f.fadeTo(this.getDefaultTransitionDuration(b), 1) } if (this.isSlideshowRunning) { if (this.slideshowTimeout) clearTimeout(this.slideshowTimeout); this.slideshowTimeout = setTimeout(function () { c.ssAdvance() }, this.delay) } return this }, getCurrentPage: function () { return Math.floor(this.currentImage.index / this.numThumbs) }, syncThumbs: function () { var a = this.getCurrentPage(); if (a != this.displayedPage) this.updateThumbs(); var b = this.find("ul.thumbs").children(); b.filter(".selected").removeClass("selected"); b.eq(this.currentImage.index).addClass("selected"); return this }, updateThumbs: function (a) { var b = this; var c = function () { if (a) a(); b.rebuildThumbs(); if (b.onPageTransitionIn) b.onPageTransitionIn(); else b.show() }; if (this.onPageTransitionOut) { this.onPageTransitionOut(c) } else { this.hide(); c() } return this }, rebuildThumbs: function () { var b = this.data.length > this.numThumbs; if (this.enableTopPager) { var c = this.find("div.top"); if (c.length == 0) c = this.prepend('<div class="top pagination"></div>').find("div.top"); else c.empty(); if (b) this.buildPager(c) } if (this.enableBottomPager) { var d = this.find("div.bottom"); if (d.length == 0) d = this.append('<div class="bottom pagination"></div>').find("div.bottom"); else d.empty(); if (b) this.buildPager(d) } var e = this.getCurrentPage(); var f = e * this.numThumbs; var g = f + this.numThumbs - 1; if (g >= this.data.length) g = this.data.length - 1; var h = this.find("ul.thumbs"); h.find("li").each(function (b) { var c = a(this); if (b >= f && b <= g) { c.show() } else { c.hide() } }); this.displayedPage = e; h.removeClass("noscript"); return this }, getNumPages: function () { return Math.ceil(this.data.length / this.numThumbs) }, buildPager: function (a) { var b = this; var c = this.getNumPages(); var d = this.getCurrentPage(); var e = d * this.numThumbs; var f = this.maxPagesToShow - 1; var g = d - Math.floor((this.maxPagesToShow - 1) / 2) + 1; if (g > 0) { var h = c - g; if (h < f) { g = g - (f - h) } } if (g < 0) { g = 0 } if (d > 0) { var i = e - this.numThumbs; a.append('<a rel="history" href="#' + this.data[i].hash + '" title="' + this.prevPageLinkText + '">' + this.prevPageLinkText + "</a>") } if (g > 0) { this.buildPageLink(a, 0, c); if (g > 1) a.append('<span class="ellipsis">…</span>'); f-- } while (f > 0) { this.buildPageLink(a, g, c); f--; g++ } if (g < c) { var j = c - 1; if (g < j) a.append('<span class="ellipsis">…</span>'); this.buildPageLink(a, j, c) } var k = e + this.numThumbs; if (k < this.data.length) { a.append('<a rel="history" href="#' + this.data[k].hash + '" title="' + this.nextPageLinkText + '">' + this.nextPageLinkText + "</a>") } a.find("a").click(function (a) { b.clickHandler(a, this) }); return this }, buildPageLink: function (a, b, c) { var d = b + 1; var e = this.getCurrentPage(); if (b == e) a.append('<span class="current">' + d + "</span>"); else if (b < c) { var f = b * this.numThumbs; a.append('<a rel="history" href="#' + this.data[f].hash + '" title="' + d + '">' + d + "</a>") } return this } }); a.extend(this, d, e); if (this.enableHistory && !a.historyInit) this.enableHistory = false; if (this.imageContainerSel) this.$imageContainer = a(this.imageContainerSel); if (this.captionContainerSel) this.$captionContainer = a(this.captionContainerSel); if (this.loadingContainerSel) this.$loadingContainer = a(this.loadingContainerSel); this.initializeThumbs(); if (this.maxPagesToShow < 3) this.maxPagesToShow = 3; this.displayedPage = -1; this.currentImage = this.data[0]; var f = this; if (this.$loadingContainer) this.$loadingContainer.hide(); if (this.controlsContainerSel) { this.$controlsContainer = a(this.controlsContainerSel).empty(); if (this.renderSSControls) { if (this.autoStart) { this.$controlsContainer.append('<div class="ss-controls"><a href="#pause" class="pause" title="' + this.pauseLinkText + '">' + this.pauseLinkText + "</a></div>") } else { this.$controlsContainer.append('<div class="ss-controls"><a href="#play" class="play" title="' + this.playLinkText + '">' + this.playLinkText + "</a></div>") } this.$controlsContainer.find("div.ss-controls a").click(function (a) { f.toggleSlideshow(); a.preventDefault(); return false }) } if (this.renderNavControls) { this.$controlsContainer.append('<div class="nav-controls"><a class="prev" rel="history" title="' + this.prevLinkText + '">' + this.prevLinkText + '</a><a class="next" rel="history" title="' + this.nextLinkText + '">' + this.nextLinkText + "</a></div>").find("div.nav-controls a").click(function (a) { f.clickHandler(a, this) }) } } var g = !this.enableHistory || !location.hash; if (this.enableHistory && location.hash) { var h = a.galleriffic.normalizeHash(location.hash); var j = b[h]; if (!j) g = true } if (g) this.gotoIndex(0, false, true); if (this.enableKeyboardNavigation) { a(document).keydown(function (a) { var b = a.charCode ? a.charCode : a.keyCode ? a.keyCode : 0; switch (b) { case 32: f.next(); a.preventDefault(); break; case 33: f.previousPage(); a.preventDefault(); break; case 34: f.nextPage(); a.preventDefault(); break; case 35: f.gotoIndex(f.data.length - 1); a.preventDefault(); break; case 36: f.gotoIndex(0); a.preventDefault(); break; case 37: f.previous(); a.preventDefault(); break; case 39: f.next(); a.preventDefault(); break } }) } if (this.autoStart) this.play(); setTimeout(function () { f.preloadInit() }, 1e3); return this } })(jQuery)

/**
* jQuery Opacity Rollover plugin
*
* Copyright (c) 2009 Trent Foley (http://trentacular.com)
* Licensed under the MIT License:
*   http://www.opensource.org/licenses/mit-license.php
*/
; (function ($) {
    var defaults = {
        mouseOutOpacity: 0.67,
        mouseOverOpacity: 1.0,
        fadeSpeed: 'fast',
        exemptionSelector: '.selected'
    };

    $.fn.opacityrollover = function (settings) {
        // Initialize the effect
        $.extend(this, defaults, settings);

        var config = this;

        function fadeTo(element, opacity) {
            var $target = $(element);

            if (config.exemptionSelector)
                $target = $target.not(config.exemptionSelector);

            $target.fadeTo(config.fadeSpeed, opacity);
        }

        this.css('opacity', this.mouseOutOpacity)
			.hover(
				function () {
				    fadeTo(this, config.mouseOverOpacity);
				},
				function () {
				    fadeTo(this, config.mouseOutOpacity);
				});

        return this;
    };
})(jQuery);

