/*! backstretch - v2.0.3 - 2012-11-30 * http://srobbin.com/jquery-plugins/backstretch/ * copyright (c) 2012 scott robbin; licensed mit */ (function(e, t, n) { "use strict"; e.fn.backstretch = function(r, s) { return (r === n || r.length === 0) && e.error("no images were supplied for backstretch"), e(t).scrolltop() === 0 && t.scrollto(0, 0), this.each(function() { var t = e(this), n = t.data("backstretch"); n && (s = e.extend(n.options, s), n.destroy(!0)), n = new i(this, r, s), t.data("backstretch", n) }) }, e.backstretch = function(t, n) { return e("body").backstretch(t, n).data("backstretch") }, e.expr[":"].backstretch = function(t) { return e(t).data("backstretch") !== n }, e.fn.backstretch.defaults = { centeredx: !0, centeredy: !0, duration: 5e3, fade: 0 }; var r = { wrap: { left: 0, top: 0, overflow: "hidden", margin: 0, padding: 0, height: "100%", width: "100%", zindex: -999999 }, img: { position: "absolute", display: "none", margin: 0, padding: 0, border: "none", width: "auto", height: "auto", maxwidth: "none", zindex: -999999 } }, i = function(n, i, o) { this.options = e.extend({}, e.fn.backstretch.defaults, o || {}), this.images = e.isarray(i) ? i : [i], e.each(this.images, function() { e("")[0].src = this }), this.isbody = n === document.body, this.$container = e(n), this.$wrap = e('
').css(r.wrap).appendto(this.$container), this.$root = this.isbody ? s ? e(t) : e(document) : this.$container; if (!this.isbody) { var u = this.$container.css("position"), a = this.$container.css("zindex"); this.$container.css({ position: u === "static" ? "relative" : u, zindex: a === "auto" ? 0 : a, background: "none" }), this.$wrap.css({ zindex: -999998 }) } this.$wrap.css({ position: this.isbody && s ? "fixed" : "absolute" }), this.index = 0, this.show(this.index), e(t).on("resize.backstretch", e.proxy(this.resize, this)).on("orientationchange.backstretch", e.proxy(function() { this.isbody && t.pageyoffset === 0 && (t.scrollto(0, 1), this.resize()) }, this)) }; i.prototype = { resize: function() { try { var e = { left: 0, top: 0 }, n = this.isbody ? this.$root.width() : this.$root.innerwidth(), r = n, i = this.isbody ? t.innerheight ? t.innerheight : this.$root.height() : this.$root.innerheight(), s = r / this.$img.data("ratio"), o; s >= i ? (o = (s - i) / 2, this.options.centeredy && (e.top = "-" + o + "px")) : (s = i, r = s * this.$img.data("ratio"), o = (r - n) / 2, this.options.centeredx && (e.left = "-" + o + "px")), this.$wrap.css({ width: n, height: i }).find("img:not(.deleteable)").css({ width: r, height: s }).css(e) } catch (u) {} return this }, show: function(t) { if (math.abs(t) > this.images.length - 1) return; this.index = t; var n = this, i = n.$wrap.find("img").addclass("deleteable"), s = e.event("backstretch.show", { relatedtarget: n.$container[0] }); return clearinterval(n.interval), n.$img = e("").css(r.img).bind("load", function(t) { var r = this.width || e(t.target).width(), o = this.height || e(t.target).height(); e(this).data("ratio", r / o), e(this).fadein(n.options.speed || n.options.fade, function() { i.remove(), n.paused || n.cycle(), n.$container.trigger(s, n) }), n.resize() }).appendto(n.$wrap), n.$img.attr("src", n.images[t]), n }, next: function() { return this.show(this.index < this.images.length - 1 ? this.index + 1 : 0) }, prev: function() { return this.show(this.index === 0 ? this.images.length - 1 : this.index - 1) }, pause: function() { return this.paused = !0, this }, resume: function() { return this.paused = !1, this.next(), this }, cycle: function() { return this.images.length > 1 && (clearinterval(this.interval), this.interval = setinterval(e.proxy(function() { this.paused || this.next() }, this), this.options.duration)), this }, destroy: function(n) { e(t).off("resize.backstretch orientationchange.backstretch"), clearinterval(this.interval), n || this.$wrap.remove(), this.$container.removedata("backstretch") } }; var s = function() { var e = navigator.useragent, n = navigator.platform, r = e.match(/applewebkit\/([0-9]+)/), i = !!r && r[1], s = e.match(/fennec\/([0-9]+)/), o = !!s && s[1], u = e.match(/opera mobi\/([0-9]+)/), a = !!u && u[1], f = e.match(/msie ([0-9]+)/), l = !!f && f[1]; return !((n.indexof("iphone") > -1 || n.indexof("ipad") > -1 || n.indexof("ipod") > -1) && i && i < 534 || t.operamini && {}.tostring.call(t.operamini) === "[object operamini]" || u && a < 7458 || e.indexof("android") > -1 && i && i < 533 || o && o < 6 || "palmgetresource" in t && i && i < 534 || e.indexof("meego") > -1 && e.indexof("nokiabrowser/8.5.0") > -1 || l && l <= 6) }() })(jquery, window);