(function (f) {
function c(h) {
var i = h.skinDir + "/" + h.skin,
l = j[i];
if (l) l.loaded ? a.call(this, h, l.html) : l.queue.push({
c: this,
s: h
});
else {
j[i] = {
loaded: false,
queue: [{
c: this,
s: h
}]
};
f.ajax({
url: i + ".html",
dataType: "text",
success: function (m) {
var p = j[i];
p.loaded = true;
p.html = m;
for (m = 0; m < p.queue.length; m++) a.call(p.queue[m].c, p.queue[m].s, p.html)
},
dataFilter: function (m) {
return m = m.substring(m.indexOf("<body>") + 6, m.lastIndexOf("</body>"))
},
error: function () {
if (h.error) {
var m = f.Event("tn3_error");
m.description = "tn3 skin load error";
h.error(m)
}
}
})
}
return this
}
function a(h, i) {
this.each(function () {
for (var l = f(this), m, p, q = i.indexOf("<img src="); q != -1;) {
q += 10;
p = i.indexOf('"', q);
m = h.skinDir + "/" + i.substring(q, p);
i = i.substr(0, q) + m + i.substr(p);
q = i.indexOf("<img src=", q)
}
l.append(i);
l.data("tn3").init(l, h.fullOnly)
})
}
function d(h) {
var i = [],
l = h.children(".tn3.album"),
m, p;
if (l.length > 0) l.each(function (q) {
m = f(this);
i[q] = {
title: m.find(":header").html()
};
f.extend(i[q], e(m));
if (p = b(m)) {
i[q].imgs = p;
if (!i[q].thumb) i[q].thumb = i[q].imgs[0].thumb
}
});
else if (p = b(h)) i[0] = {
imgs: p
};
return i
}
function b(h) {
var i = [],
l, m;
l = h.find("li");
if (l.length > 0) l.each(function (p) {
m = f(this);
$firsta = m.find("a:not(.tn3 > a)").filter(":first");
i[p] = {
title: m.find(":header").filter(":first").html()
};
if ($firsta.length > 0) {
i[p].img = $firsta.attr("href");
i[p].thumb = $firsta.find("img").attr("src")
} else i[p].img = m.find("img").filter(":first").attr("src");
f.extend(i[p], e(m))
});
else {
l = h.find("img");
l.each(function (p) {
m = f(this);
$at = m.parent("a");
i[p] = $at.length == 0 ? {
title: m.attr("title"),
img: m.attr("src")
} : {
title: m.attr("title"),
img: $at.attr("href"),
thumb: m.attr("src")
}
})
}
if (i.length == 0) return null;
return i
}
function e(h) {
var i = {};
h = h.children(".tn3");
var l;
f.each(h, function () {
l = f(this);
i[l.attr("class").substr(4)] = l.html()
});
return i
}
function g(h) {
f('a[href^="#tn3-' + h + '"]').click(function (i) {
var l = n[h];
i = f(i.currentTarget).attr("href");
i = i.substr(i.indexOf("-", 5) + 1);
i = i.split("-");
switch (i[0]) {
case "next":
l.cAlbum != null && l.show("next", i[1] == "fs");
break;
case "prev":
l.cAlbum != null && l.show("prev", i[1] == "fs");
break;
default:
l.cAlbum != parseInt(i[0]) ? l.showAlbum(parseInt(i[0]), parseInt(i[1]), i[2] == "fs") : l.show(parseInt(i[1]), i[2] == "fs")
}
})
}
function k() {
if (n.length == 0) {
var h = f(".tn3gallery");
h.length > 0 && h.tn3({})
}
}
if (/1\.(0|1|2|3|4)\.(0|1)/.test(f.fn.jquery) || /^1.1/.test(f.fn.jquery) || /^1.2/.test(f.fn.jquery) || /^1.3/.test(f.fn.jquery)) alert("tn3gallery requires jQuery v1.4.2 or later! You are using v" + f.fn.jquery);
else {
var j = {},
n = [];
f.fn.tn3 = function (h) {
f.each(["skin", "startWithAlbums", "external"], function (l, m) {
var p = m.split(".");
if (p.length > 1 && h[p[0]]) delete h[p[0]][p[1]];
else delete h[m]
});
h = f.extend(true, {}, f.fn.tn3.config, h);
if (h.skin != null) if (typeof h.skin == "object") {
h.skinDir += "/" + h.skin[0];
if (h.cssID == null) h.cssID = h.skin[0];
h.skin = h.skin[1]
} else h.skinDir += "/" + h.skin;
else {
h.skin = "tn3";
h.skinDir += "/tn3";
var i = true
}
if (h.cssID == null) h.cssID = h.skin == null ? "tn3" : h.skin;
this.each(function () {
var l = f(this);
h.fullOnly ? l.hide() : l.css("visibility", "hidden");
var m = h.data ? h.data : d(l);
m = n.push(new f.fn.tn3.Gallery(m, h)) - 1;
l.data("tn3", n[m]);
for (var p = 0; p < f.fn.tn3.plugins.length; p++) f.fn.tn3.plugins[p].init(l, h);
l.empty();
g(m)
});
i ? a.call(this, h, h.skinDefault) : c.call(this, h);
return this
};
f.fn.tn3.plugins = [];
f.fn.tn3.plugIn = function (h, i) {
f.fn.tn3.plugins.push({
id: h,
init: i
})
};
f.fn.tn3.version = "1.2.0.45";
f.fn.tn3.config = {
data: null,
skin: null,
skinDir: "skins",
skinDefault: '<div class="tn3-gallery"><div class="tn3-image"><div class="tn3-text-bg"><div class="tn3-image-title"></div><div class="tn3-image-description"></div></div><div class="tn3-next tn3_v tn3_o"></div><div class="tn3-prev tn3_v tn3_o"></div><div class="tn3-preloader tn3_h tn3_v"><img src="preload.gif"/></div><div class="tn3-timer"></div></div><div class="tn3-controls-bg tn3_rh"><div class="tn3-sep1"></div><div class="tn3-sep2"></div><div class="tn3-sep3"></div></div><div class="tn3-thumbs"></div><div class="tn3-fullscreen"></div><div class="tn3-show-albums"></div><div class="tn3-next-page"></div><div class="tn3-prev-page"></div><div class="tn3-play"></div><div class="tn3-count"></div><div class="tn3-albums"><div class="tn3-inalbums"><div class="tn3-album"></div></div><div class="tn3-albums-next"></div><div class="tn3-albums-prev"></div><div class="tn3-albums-close"></div></div></div>',
cssID: null
};
f.fn.tn3.translations = {};
f.fn.tn3.translate = function (h, i) {
if (i) f.fn.tn3.translations[h] = i;
else {
var l = f.fn.tn3.translations[h];
return l ? l : h
}
};
f(function () {
setTimeout(k, 1)
})
}
})(jQuery);
(function (f) {
f.fn.tn3utils = U = {};
U.shuffle = function (c) {
var a, d, b = c.length;
if (b) for (; --b;) {
d = Math.floor(Math.random() * (b + 1));
a = c[d];
c[d] = c[b];
c[b] = a
}
};
f.extend(f.easing, {
def: "easeOutQuad",
swing: function (c, a, d, b, e) {
return f.easing[f.easing.def](c, a, d, b, e)
},
linear: function (c, a, d, b, e) {
return b * a / e + d
},
easeInQuad: function (c, a, d, b, e) {
return b * (a /= e) * a + d
},
easeOutQuad: function (c, a, d, b, e) {
return -b * (a /= e) * (a - 2) + d
},
easeInOutQuad: function (c, a, d, b, e) {
if ((a /= e / 2) < 1) return b / 2 * a * a + d;
return -b / 2 * (--a * (a - 2) - 1) + d
},
easeInCubic: function (c, a, d, b, e) {
return b * (a /= e) * a * a + d
},
easeOutCubic: function (c, a, d, b, e) {
return b * ((a = a / e - 1) * a * a + 1) + d
},
easeInOutCubic: function (c, a, d, b, e) {
if ((a /= e / 2) < 1) return b / 2 * a * a * a + d;
return b / 2 * ((a -= 2) * a * a + 2) + d
},
easeInQuart: function (c, a, d, b, e) {
return b * (a /= e) * a * a * a + d
},
easeOutQuart: function (c, a, d, b, e) {
return -b * ((a = a / e - 1) * a * a * a - 1) + d
},
easeInOutQuart: function (c, a, d, b, e) {
if ((a /= e / 2) < 1) return b / 2 * a * a * a * a + d;
return -b / 2 * ((a -= 2) * a * a * a - 2) + d
},
easeInQuint: function (c, a, d, b, e) {
return b * (a /= e) * a * a * a * a + d
},
easeOutQuint: function (c, a, d, b, e) {
return b * ((a = a / e - 1) * a * a * a * a + 1) + d
},
easeInOutQuint: function (c, a, d, b, e) {
if ((a /= e / 2) < 1) return b / 2 * a * a * a * a * a + d;
return b / 2 * ((a -= 2) * a * a * a * a + 2) + d
},
easeInSine: function (c, a, d, b, e) {
return -b * Math.cos(a / e * (Math.PI / 2)) + b + d
},
easeOutSine: function (c, a, d, b, e) {
return b * Math.sin(a / e * (Math.PI / 2)) + d
},
easeInOutSine: function (c, a, d, b, e) {
return -b / 2 * (Math.cos(Math.PI * a / e) - 1) + d
},
easeInExpo: function (c, a, d, b, e) {
return a == 0 ? d : b * Math.pow(2, 10 * (a / e - 1)) + d
},
easeOutExpo: function (c, a, d, b, e) {
return a == e ? d + b : b * (-Math.pow(2, -10 * a / e) + 1) + d
},
easeInOutExpo: function (c, a, d, b, e) {
if (a == 0) return d;
if (a == e) return d + b;
if ((a /= e / 2) < 1) return b / 2 * Math.pow(2, 10 * (a - 1)) + d;
return b / 2 * (-Math.pow(2, -10 * --a) + 2) + d
},
easeInCirc: function (c, a, d, b, e) {
return -b * (Math.sqrt(1 - (a /= e) * a) - 1) + d
},
easeOutCirc: function (c, a, d, b, e) {
return b * Math.sqrt(1 - (a = a / e - 1) * a) + d
},
easeInOutCirc: function (c, a, d, b, e) {
if ((a /= e / 2) < 1) return -b / 2 * (Math.sqrt(1 - a * a) - 1) + d;
return b / 2 * (Math.sqrt(1 - (a -= 2) * a) + 1) + d
},
easeInElastic: function (c, a, d, b, e) {
c = 1.70158;
var g = 0,
k = b;
if (a == 0) return d;
if ((a /= e) == 1) return d + b;
g || (g = e * 0.3);
if (k < Math.abs(b)) {
k = b;
c = g / 4
} else c = g / (2 * Math.PI) * Math.asin(b / k);
return -(k * Math.pow(2, 10 * (a -= 1)) * Math.sin((a * e - c) * 2 * Math.PI / g)) + d
},
easeOutElastic: function (c, a, d, b, e) {
c = 1.70158;
var g = 0,
k = b;
if (a == 0) return d;
if ((a /= e) == 1) return d + b;
g || (g = e * 0.3);
if (k < Math.abs(b)) {
k = b;
c = g / 4
} else c = g / (2 * Math.PI) * Math.asin(b / k);
return k * Math.pow(2, -10 * a) * Math.sin((a * e - c) * 2 * Math.PI / g) + b + d
},
easeInOutElastic: function (c, a, d, b, e) {
c = 1.70158;
var g = 0,
k = b;
if (a == 0) return d;
if ((a /= e / 2) == 2) return d + b;
g || (g = e * 0.3 * 1.5);
if (k < Math.abs(b)) {
k = b;
c = g / 4
} else c = g / (2 * Math.PI) * Math.asin(b / k);
if (a < 1) return -0.5 * k * Math.pow(2, 10 * (a -= 1)) * Math.sin((a * e - c) * 2 * Math.PI / g) + d;
return k * Math.pow(2, -10 * (a -= 1)) * Math.sin((a * e - c) * 2 * Math.PI / g) * 0.5 + b + d
},
easeInBack: function (c, a, d, b, e, g) {
if (g == undefined) g = 1.70158;
return b * (a /= e) * a * ((g + 1) * a - g) + d
},
easeOutBack: function (c, a, d, b, e, g) {
if (g == undefined) g = 1.70158;
return b * ((a = a / e - 1) * a * ((g + 1) * a + g) + 1) + d
},
easeInOutBack: function (c, a, d, b, e, g) {
if (g == undefined) g = 1.70158;
if ((a /= e / 2) < 1) return b / 2 * a * a * (((g *= 1.525) + 1) * a - g) + d;
return b / 2 * ((a -= 2) * a * (((g *= 1.525) + 1) * a + g) + 2) + d
},
easeInBounce: function (c, a, d, b, e) {
return b - f.easing.easeOutBounce(c, e - a, 0, b, e) + d
},
easeOutBounce: function (c, a, d, b, e) {
return (a /= e) < 1 / 2.75 ? b * 7.5625 * a * a + d : a < 2 / 2.75 ? b * (7.5625 * (a -= 1.5 / 2.75) * a + 0.75) + d : a < 2.5 / 2.75 ? b * (7.5625 * (a -= 2.25 / 2.75) * a + 0.9375) + d : b * (7.5625 * (a -= 2.625 / 2.75) * a + 0.984375) + d
},
easeInOutBounce: function (c, a, d, b, e) {
if (a < e / 2) return f.easing.easeInBounce(c, a * 2, 0, b, e) * 0.5 + d;
return f.easing.easeOutBounce(c, a * 2 - e, 0, b, e) * 0.5 + b * 0.5 + d
}
})
})(jQuery);
(function (f) {
f.fn.tn3.Gallery = function (c, a) {
this.data = c;
this.config = f.extend(true, {}, f.fn.tn3.Gallery.config, a);
this.initialized = false;
this.t = f.fn.tn3.translate;
this.loader = new f.fn.tn3.External(a.external, this)
};
f.fn.tn3.Gallery.config = {
cssID: "tn3",
active: [],
inactive: [],
iniAlbum: 0,
iniImage: 0,
imageClick: "next",
startWithAlbums: false,
autoplay: false,
delay: 7E3,
timerMode: "bar",
timerSteps: 300,
timerStepChar: "•",
isFullScreen: false,
fullOnly: false,
width: null,
height: null,
mouseWheel: true,
keyNavigation: "fullscreen",
timerOverStop: true,
responsive: false,
image: {},
thumbnailer: {}
};
f.fn.tn3.Gallery.prototype = {
config: null,
$c: null,
$tn3: null,
data: null,
thumbnailer: null,
imager: null,
cAlbum: null,
timer: null,
items: null,
initialized: null,
n: null,
albums: null,
loader: null,
fso: null,
timerSize: null,
special: null,
areHidden: false,
$inImage: null,
isPlaying: false,
cparent: null,
init: function (c, a) {
this.$c = c;
if (!(this.loader.reqs > 0 || this.data.length == 0 || a)) {
this.trigger("init_start");
this.config.fullOnly && this.$c.show();
this.$c.css("visibility", "visible");
this.$tn3 = this.$c.find("." + this.config.cssID + "-gallery");
var d = this.config.initValues = {
width: this.$tn3.width(),
height: this.$tn3.height()
};
this.$tn3.css("float", "left");
d.wDif = this.$tn3.outerWidth(true) - d.width;
d.hDif = this.$tn3.outerHeight(true) - d.height;
//this.replaceMenu("tn3gallddery.com", "http://tn3gallery.com");
var b = this;
this.timer = new f.fn.tn3.Timer(this.$c, this.config.delay, this.config.timerSteps);
this.$c.bind("timer_end", function () {
b.show("next")
});
this.special = {
rv: [],
rh: [],
v: [],
h: [],
vi: [],
hi: [],
o: []
};
this.parseLayout();
this.center();
f.each(this.items, function (e, g) {
switch (e) {
case "next":
g.click(function (j) {
b.show("next");
j.stopPropagation()
});
g.attr("title", b.t("Next Image"));
break;
case "prev":
g.click(function (j) {
b.show("prev");
j.stopPropagation()
});
g.attr("title", b.t("Previous Image"));
break;
case "next-page":
g.click(function () {
b.items.thumbs && b.thumbnailer.next(true)
});
g.attr("title", b.t("Next Page"));
break;
case "prev-page":
g.click(function () {
b.items.thumbs && b.thumbnailer.prev(true)
});
g.attr("title", b.t("Previous Page"));
break;
case "thumbs":
b.config.thumbnailer.cssID = b.config.cssID;
b.config.thumbnailer.initValues = {
width: g.width(),
height: g.height()
};
b.config.thumbnailer.initValues.vertical = g.width() <= g.height();
g.bind("tn_click", function (j) {
b.show(j.n)
}).bind("tn_over", function () {
b.timer.pause(true)
}).bind("tn_out", function () {
b.timer.pause(false)
}).bind("tn_error", function (j) {
b.trigger("error", j)
});
break;
case "image":
b.config.image.cssID = b.config.cssID;
b.config.image.initValues = {
width: g.width(),
height: g.height()
};
g.bind("img_click", function (j) {
switch (b.config.imageClick) {
case "next":
b.show("next");
break;
case "fullscreen":
b.fullscreen();
break;
case "url":
if (j = b.data[b.cAlbum].imgs[j.n].url) window.location = j
}
}).bind("img_load_start", function () {
b.items.preloader && b.items.preloader.show()
}).bind("img_load_end", function (j) {
b.n = j.n;
b.items.thumbs && b.thumbnailer.thumbClick(j.n);
b.items.preloader && b.items.preloader.hide();
b.items.timer && b.items.timer.hide();
b.$inImage && b.$inImage.hide()
}).bind("img_transition", function (j) {
b.setTextValues(false, "image");
b.$inImage && b.imager.cached[j.n].isImage && b.$inImage.fadeIn(300);
b.items.count && b.items.count.text(b.n + 1 + "/" + b.data[b.cAlbum].imgs.length);
b.isPlaying && b.timer.start();
b.special.o.length > 0 && b.hideElements()
}).bind("img_enter", function () {
b.items.timer && b.config.timerOverStop && b.timer.pause(true);
b.special.o.length > 0 && b.showElements(300)
}).bind("img_leave", function () {
b.items.timer && b.config.timerOverStop && b.timer.pause(false);
b.special.o.length > 0 && b.hideElements(300)
}).bind("img_resize", function (j) {
if (b.$inImage) {
b.$inImage.width(j.w).height(j.h).css("left", j.left).css("top", j.top);
b.center();
b.imager.bindMouseEvents(b.$inImage)
}
}).bind("img_error", function (j) {
b.trigger("error", j)
});
break;
case "preloader":
g.hide();
break;
case "timer":
var k = g.width() > g.height() ? "width" : "height";
b.$c.bind("timer_tick", function (j) {
if (b.config.timerMode == "char") {
for (var n = b.config.timerStepChar; --j.tick;) n += b.config.timerStepChar;
b.items.timer.html(n)
} else b.items.timer[k](b.timerSize / j.totalTicks * j.tick);
b.trigger(j.type, j)
}).bind("timer_start", function (j) {
b.timerSize = b.$inImage[k]();
b.items.timer.fadeIn(300);
b.trigger(j.type, j)
}).bind("timer_end timer_stop", function (j) {
b.items.timer.hide();
b.trigger(j.type, j)
});
g.hide();
break;
case "play":
g.click(function (j) {
var n = {
id: "play",
execute: true
};
b.trigger("control", n);
if (b.isPlaying) {
if (n.execute) {
b.timer.stop();
g.removeClass(b.config.cssID + "-play-active");
g.attr("title", b.t("Start Slideshow"))
}
b.isPlaying = false
} else {
if (n.execute) {
b.timer.start();
g.addClass(b.config.cssID + "-play-active");
g.attr("title", b.t("Stop Slideshow"))
}
b.isPlaying = true
}
j.stopPropagation()
});
g.attr("title", b.t("Start Slideshow"));
b.config.autoplay && g.click();
break;
case "albums":
b.albums = new f.fn.tn3.Albums(b.data, g, b.config.cssID);
g.hide();
g.bind("albums_binit", function (j) {
b.trigger(j.type, j)
}).bind("albums_click", function (j) {
b.showAlbum(j.n);
b.trigger(j.type, j)
}).bind("albums_init", function (j) {
b.timer.pause(true);
b.trigger(j.type, j)
}).bind("albums_error", function (j) {
b.trigger("error", j)
}).bind("albums_close", function () {
b.timer.pause(false)
});
break;
case "albums-next":
b.albums && b.albums.setControl("next", g);
g.attr("title", b.t("Next Album Page"));
break;
case "albums-prev":
b.albums && b.albums.setControl("prev", g);
g.attr("title", b.t("Previous Album Page"));
break;
case "albums-close":
b.albums && b.albums.setControl("close", g);
g.attr("title", b.t("Close"));
break;
case "show-albums":
g.click(function (j) {
b.items.albums && b.albums.show(0, b.cAlbum, false, true);
j.stopPropagation()
});
g.attr("title", b.t("Album List"));
break;
case "fullscreen":
g.click(function (j) {
var n = {
id: "fullscreen",
execute: true
};
b.trigger("control", n);
n.execute && b.fullscreen();
j.stopPropagation()
});
g.attr("title", b.t("Maximize"))
}
});
if (this.config.width !== null || this.config.height !== null) {
if (this.config.width == null) this.config.width = this.config.initValues.width;
if (this.config.height == null) this.config.height = this.config.initValues.height;
this.resize(this.config.width, this.config.height)
}
d = Math.min(this.config.iniAlbum, this.data.length - 1);
this.initialized = true;
this.config.startWithAlbums && this.data.length > 1 && this.items.albums ? this.albums.show() : this.showAlbum(d, this.config.iniImage);
this.config.isFullScreen && this.onFullResize(f(window).width(), f(window).height());
this.trigger("init")
}
},
parseLayout: function () {
var c = this.items = {},
a = this.config,
d = a.active,
b = a.inactive,
e = a.cssID.length + 1,
g = this,
k, j;
this.$c.find("div[class^='" + a.cssID + "-']").each(function () {
k = f(this);
j = k.attr("class").split(" ")[0].substr(e);
if (f.inArray(j, b) != -1) k.remove();
else if (d.length == 0 || f.inArray(j, d) != -1) c[j] = k;
else j != "gallery" && k.remove();
if (k.parent().hasClass(a.cssID + "-image")) {
if (!g.$inImage) {
g.$inImage = k.parent().append('<div class="tn3-in-image"></div>').find(":last");
if (f.browser.msie) {
var h = f("<div />");
h.css("background-color", "#fff").css("opacity", 0).css("width", "100%").css("height", "100%");
h.appendTo(g.$inImage)
}
g.$inImage.css("position", "absolute").width(c.image.width()).height(c.image.height())
}
k.appendTo(g.$inImage)
}
this.className.indexOf("tn3_") != -1 && g.addSpecial(j, this.className)
});
$cm = this.$c;
f.each(["albums", "album", "album-next", "album-prev", "show-albums", "timer"], function (h, i) {
delete c[i];
$cm.find("." + a.cssID + "-" + i).remove()
});
var n = f('<div title="Powered by TN3 Gallery"></div>');
/* n.css("position", "absolute").css("background-image", "url('" + this.config.skinDir + "/tn3.png')").css("background-position", "-258px -7px").css("bottom", "14px").css("right", "53px").css("cursor", "pointer").width(40).height(18);
n.appendTo(this.$c.find("." + a.cssID + "-gallery"));
n.click(function () {
window.location = "http://tn3gallery.com"
}).hover(function () {
f(this).css("background-position", "-258px -45px")
}, function () {
f(this).css("background-position", "-258px -7px")
})*/
},
addSpecial: function (c, a) {
for (var d = a.split(" "), b, e = 0; e < d.length; e++) {
b = d[e].split("_");
if (b[0] == "tn3") {
this.special[b[1]].push(c);
if (b[1] == "rh" || b[1] == "rv") this.config.initValues[c] = {
w: this.items[c].width(),
h: this.items[c].height()
}
}
}
},
initHover: function (c, a) {
var d = this;
c.hover(function () {
c.addClass(d.config.cssID + "-" + a + "-over")
}, function () {
c.removeClass(d.config.cssID + "-" + a + "-over")
})
},
setTextValues: function (c, a) {
var d, b, e, g = a + "-";
for (e in this.items) if (e.indexOf(g) == 0) {
d = e.substr(g.length);
if (d != "info" && d != "prev" && d != "next") {
b = a == "image" ? this.data[this.cAlbum].imgs[this.n] : this.data[this.cAlbum];
if (!b || b[d] == undefined) {
b = {};
b[d] = ""
} else b[d] = f.trim(b[d]);
d = {
field: d,
text: b[d],
data: b
};
this.trigger("set_text", d);
if (c || d.text == undefined || d.text.length == 0) {
this.items[e].html("");
this.items[e].hide()
} else {
this.items[e].html(d.text);
this.items[e].show()
}
}
}
},
show: function (c, a) {
this.timer.stop();
this.imager && this.imager.show(c);
a && this.fullscreen()
},
setAlbumData: function (c, a) {
if (a) this.trigger("error", {
description: a
});
else {
for (var d = 0, b = c.length; d < b; d++) this.data.push(c[d]);
this.$c && this.init(this.$c, this.config.fullOnly)
}
},
setImageData: function (c, a, d) {
if (d) this.trigger("error", {
description: d
});
else {
this.items.preloader && this.items.preloader.hide();
c = {
data: c
};
this.trigger("image_data", c);
this.data[a].imgs = c.data;
if (this.cAlbum == a) this.rebuild(c.data, a == 0 ? this.config.iniImage : 0)
}
},
showAlbum: function (c, a, d) {
if (this.initialized) {
if (c > this.data.length) return;
this.timer.stop();
this.cAlbum = c;
this.albums && this.albums.hide();
if (this.data[this.cAlbum].imgs === undefined) if (this.loader) {
this.loader.getImages(this.data[this.cAlbum].adata, this.cAlbum);
this.items.preloader && this.items.preloader.show()
} else this.trigger("error", {
description: "Wrong album id"
});
else this.rebuild(this.data[this.cAlbum].imgs, a)
} else {
this.config.iniAlbum = c;
this.config.iniImage = a;
this.init(this.$c, false)
}
d && this.fullscreen()
},
rebuild: function (c, a) {
if (this.items.thumbs) if (this.thumbnailer) this.thumbnailer.rebuild(c);
else this.thumbnailer = new f.fn.tn3.Thumbnailer(this.items.thumbs, c, this.config.thumbnailer);
if (this.items.image) if (this.imager) this.imager.rebuild(c);
else this.imager = new f.fn.tn3.Imager(this.items.image, c, this.config.image);
this.setTextValues(true, "image");
this.setTextValues(false, "album");
this.show(a == null ? 0 : a);
this.trigger("rebuild", {
album: this.cAlbum
})
},
showElements: function (c) {
if (this.areHidden) {
var a = this,
d;
f.each(this.special.o, function (b, e) {
d = a.items[e];
d.show();
if (c && f.support.opacity) {
d.stop(true);
d.css("opacity", 0);
d.animate({
opacity: 1
}, {
duration: c,
queue: false
})
}
});
this.areHidden = false
}
},
hideElements: function (c) {
if (!this.areHidden) {
var a = this,
d;
f.each(this.special.o, function (b, e) {
d = a.items[e];
if (c && f.support.opacity) {
d.stop(true);
d.animate({
opacity: 0
}, {
duration: c,
complete: function () {
d.hide()
},
queue: false
})
} else d.hide()
});
this.areHidden = true
}
},
setData: function (c) {
if (this.items.thumbs) this.thumbnailer.data = c;
if (this.items.imager) this.imager.data = c
},
fullscreen: function () {
if (this.config.isFullScreen) {
f(window).unbind("resize", this.onFullResize);
f.tn3unblock();
this.config.width !== null || this.config.height !== null ? this.resize(this.config.width, this.config.height) : this.resize(this.config.initValues.width, this.config.initValues.height);
if (this.items.fullscreen) {
this.items.fullscreen.removeClass(this.config.cssID + "-fullscreen-active");
this.items.fullscreen.attr("title", this.t("Maximize"))
}
this.config.fullOnly && this.$c.hide();
this.config.isFullScreen = false;
this.trigger("fullscreen", {
fullscreen: false
});
this.config.keyNavigation == "fullscreen" && f(document).unbind("keyup", this.listenKeys)
} else {
f.tn3block({
message: this.$tn3,
cssID: this.config.cssID
});
f(window).bind("resize", f.proxy(this.onFullResize, this));
this.config.fullOnly && this.$c.show();
this.config.isFullScreen = true;
if (this.items.fullscreen) {
this.items.fullscreen.addClass(this.config.cssID + "-fullscreen-active");
this.items.fullscreen.attr("title", this.t("Minimize"))
}
this.onFullResize();
this.trigger("fullscreen", {
fullscreen: true
})
}
},
listenKeys: function (c) {
if (c.keyCode == 70) this.items.fullscreen.click();
else if (this.items.albums && this.albums.enabled) {
var a = 0;
switch (c.keyCode) {
case 27:
this.albums.hide();
break;
case 39:
a = "r";
break;
case 37:
a = "l";
break;
case 38:
a = "u";
break;
case 40:
a = "d";
break;
case 32:
a = "p"
}
a && this.albums.select(a)
} else switch (c.keyCode) {
case 27:
this.config.isFullScreen && this.fullscreen();
break;
case 39:
this.show("next");
break;
case 37:
this.show("prev");
break;
case 38:
this.items.albums && this.albums.show(0, this.cAlbum, false, true);
break;
case 32:
this.items.play.click()
}
},
onFullResize: function () {
var c = f(window),
a = c.width();
c = c.height();
a -= this.config.initValues.wDif;
c -= this.config.initValues.hDif;
this.resize(a, c)
},
resize: function (c, a) {
this.$tn3.width(c).height(a);
var d = c - this.config.initValues.width,
b = a - this.config.initValues.height,
e, g, k = this;
if (this.items.image) {
e = this.config.image.initValues.width + d;
g = this.config.image.initValues.height + b;
if (this.imager) this.imager.setSize(e, g);
else {
this.items.image.width(e).height(g);
this.$inImage.width(e).height(g)
}
}
if (this.items.thumbs) {
e = this.config.thumbnailer.initValues.width + d;
g = this.config.thumbnailer.initValues.height + b;
if (this.thumbnailer) this.thumbnailer.setSize(e, g);
else this.config.thumbnailer.initValues.vertical ? this.items.thumbs.height(g) : this.items.thumbs.width(e)
}
if (this.items.albums) {
e = this.albums.initValues.width + d;
g = this.albums.initValues.height + b;
this.albums.changeSize(d, b)
}
f.each(this.special.rh, function (j, n) {
k.items[n].width(k.config.initValues[n].w + d)
});
f.each(this.special.rv, function (j, n) {
k.items[n].height(k.config.initValues[n].h + b)
});
this.center()
},
center: function () {
var c, a = this,
d = a.items.image.position();
f.each(this.special.v, function (b, e) {
c = a.items[e];
c.css("top", (c.parent().height() - c.height()) / 2)
});
f.each(this.special.h, function (b, e) {
c = a.items[e];
c.css("left", (c.parent().width() - c.width()) / 2)
});
f.each(this.special.vi, function (b, e) {
c = a.items[e];
c.css("top", d.top + (a.items.image.height() - c.height()) / 2)
});
f.each(this.special.hi, function (b, e) {
c = a.items[e];
c.css("left", d.left + (a.items.image.width() - c.width()) / 2)
})
},
trigger: function (c, a) {
var d = f.Event("tn3_" + c),
b;
for (b in a) d[b] = a[b];
if (a && a.type != undefined) d.type = "tn3_" + c;
d.source = this;
this.$c.trigger(d);
this.config[c] && this.config[c].call(this, d);
for (b in a) a[b] = d[b]
},
initMouseWheel: function () {
var c = this,
a = function (d) {
c.show((d.originalEvent.detail ? -d.originalEvent.detail : d.originalEvent.wheelDelta) > 0 ? "prev" : "next");
d.preventDefault()
};
this.$tn3.bind("mousewheel", a);
this.$tn3.bind("DOMMouseScroll", a)
},
/* replaceMenu: function (c, a) {
var d = '<div style="position:absolute;background-color:#fff;color: #000;padding:0px 4px 0px 4px;z-index:1010;font-family:sans-serif;font-size:12px;">© <a href="' + a + '">' + c + "</a></div>";
this.$tn3.bind("contextmenu", function (b) {
b.preventDefault()
}).bind("mousedown", function (b) {
if (b.which == 3) {
var e = f("body").append(d).find("div:last");
e.css("left", b.pageX).css("top", b.pageY);
e.find("a").mouseup(function (g) {
window.location = a;
e.unbind(g)
});
f("body").mouseup(function (g) {
e.remove();
f("body").unbind(g)
})
}
})
}*/
}
})(jQuery);
(function (f) {
f.fn.tn3.Imager = function (c, a, d) {
this.$c = c;
this.data = a;
d.crop = false;
this.config = f.extend(true, {}, f.fn.tn3.Imager.config, d);
this.init()
};
f.fn.tn3.Imager.config = {
transitions: null,
defaultTransition: {
type: "slide"
},
random: false,
cssID: "tn3",
maxZoom: 1.4,
crop: false,
clickEvent: "click",
idleDelay: 3E3,
stretch: true,
dif: 0
};
f.fn.tn3.Imager.prototype = {
config: null,
$c: false,
data: false,
cached: null,
active: -1,
$active: false,
$buffer: false,
isInTransition: false,
ts: null,
cDim: null,
qid: null,
currentlyLoading: null,
side: null,
$ic: null,
$binder: null,
infoID: null,
lastEnter: false,
mouseCoor: {
x: 0,
y: 0
},
mouseIsOver: false,
init: function () {
this.$c.css("overflow", "hidden");
this.$c.css("position", "relative");
this.bindMouseEvents(this.$c);
this.cached = [];
this.ts = new f.fn.tn3.Transitions(this.config.transitions, this.config.defaultTransition, this.config.random, this, "onTransitionEnd")
},
bindMouseEvents: function (c) {
this.unbindMouseEvents();
var a = this;
c.hover(function () {
a.mouseIsOver = true;
a.enterLeave("enter");
a.startIdle();
f(document).mousemove(f.proxy(a.onMouseMove, a))
}, function () {
a.mouseIsOver = false;
a.enterLeave("leave");
a.stopIdle();
f(document).unbind("mousemove", a.onMouseMove)
});
c[this.config.clickEvent](function (d) {
a.active == -1 || a.isInTransition || d.target.tagName.toUpperCase() != "A" && a.trigger("click", {
n: a.active
})
});
this.$binder = c
},
unbindMouseEvents: function () {
this.$binder && this.$binder.unbind("mouseenter mouseleave " + this.config.clickEvent);
f(document).unbind("mousemove", this.onMouseMove);
this.stopIdle()
},
startIdle: function () {
this.stopIdle();
var c = this;
if (this.config.idleDelay > 0) this.infoID = setTimeout(function () {
c.enterLeave("leave");
c.stopIdle()
}, this.config.idleDelay)
},
onMouseMove: function (c) {
this.mouseCoor = {
x: c.pageX,
y: c.pageY
};
if (!this.isInTransition) {
this.infoID || this.enterLeave("enter");
this.startIdle()
}
},
stopIdle: function () {
clearTimeout(this.infoID);
this.infoID = null
},
enterLeave: function (c) {
this.lastEnter != c && this.trigger(c);
this.lastEnter = c
},
show: function (c) {
if (this.isInTransition) this.qid = c;
else {
this.qid = null;
if (c == "next") {
c = this.active + 1 < this.data.length ? this.active + 1 : 0;
this.side = "left"
} else if (c == "prev") {
c = this.active > 0 ? this.active - 1 : this.data.length - 1;
this.side = "right"
} else this.side = this.active > c ? "right" : "left";
if (this.data[c]) {
this.trigger("load_start", {
n: c
});
this.$buffer = this.$c.prepend('<div class="' + this.config.cssID + '-image-in" style="position:absolute;overflow:hidden;"></div>').find(":first");
if (this.cached[this.currentlyLoading] != undefined) this.cached[this.currentlyLoading].init = false;
if (this.cached[c] != undefined) if (this.cached[c].status == "loaded") this.initImage(c);
else {
this.cached[c].init = true;
this.currentlyLoading = c
} else this.startLoading(c, true)
}
}
},
startLoading: function (c, a) {
this.cached[c] = {
isImage: true,
status: "loading",
init: a
};
this.currentlyLoading = c;
if (this.data[c].content != undefined) {
this.cached[c].isImage = false;
this.onCacheLoad(f(this.data[c].content), c)
} else this.cached[c].loader = new f.fn.tn3.ImageLoader(this.data[c].img, this, this.onCacheLoad, [c])
},
onCacheLoad: function (c, a, d) {
this.cached[a].status = "loaded";
this.cached[a].$content = c;
d && this.trigger("error", {
description: d,
n: a
});
this.cached[a].init && this.initImage(a)
},
initImage: function (c) {
var a = this.cached[c].$content;
this.currentlyLoading = null;
this.active = c;
if (!this.cDim) this.cDim = {
w: this.$c.width(),
h: this.$c.height()
};
this.$buffer.width(this.cDim.w).height(this.cDim.h);
var d = f('<div class="' + this.config.cssID + '-full-image" style="position:absolute"></div>');
a.appendTo(d);
this.$buffer.append(d);
this.$buffer.data("ic", d);
this.$buffer.data("img", a);
this.resize(this.$buffer);
this.trigger("load_end", {
n: c,
content: a,
isImage: this.cached[c].isImage
});
if (this.$active != false) {
this.isInTransition = true;
this.unbindMouseEvents();
if (this.mouseIsOver) f(document).mousemove(f.proxy(this.onMouseMove, this));
else this.mouseCoor = {
x: 0,
y: 0
};
this.lastEnter = "leave";
this.ts.start(this.$active, this.$buffer, this.side)
} else {
this.$active = this.$buffer;
this.trigger("transition", {
n: this.active
})
}
this.cached[c + 1] == undefined && this.data[c + 1] != undefined && this.startLoading(c + 1, false)
},
setSize: function (c, a) {
this.isInTransition && this.ts.stop(this.$active, this.$buffer, this.ts.config);
this.$c.width(c).height(a);
this.cDim = {
w: this.$c.width(),
h: this.$c.height()
};
if (this.$active) {
this.$active.width(c).height(a);
this.resize(this.$active)
}
},
resize: function (c) {
if (c.data("img") == undefined) this.trigger("resize", {
w: this.cDim.w,
h: this.cDim.h,
left: 0,
top: 0
});
else this.cached[this.active].isImage ? this.resizeImage(c) : this.resizeContent(c)
},
resizeImage: function (c) {
$img = c.data("img");
$ic = c.data("ic");
$img.width("").height("");
c.data("scaled", false);
var a = $img.width(),
d = $img.height(),
b = 0,
e = 0,
g = {
w: a,
h: d,
left: 0,
top: 0
};
$img.attr("width", a).attr("height", d);
if ($img.get(0).tagName.toUpperCase() == "IMG" && (a != this.cDim.w || d != this.cDim.h)) {
b = this.cDim.w / a;
e = this.cDim.h / d;
b = this.config.crop ? Math.max(b, e) : Math.min(b, e);
b = Math.min(this.config.maxZoom, b);
a = g.w = Math.round(a * b) - this.config.dif;
d = g.h = Math.round(d * b) - this.config.dif;
if (this.cDim.w >= a) b = g.left = (this.cDim.w - a) / 2;
else {
b = -(a - this.cDim.w) * 0.5;
g.w = this.cDim.w
}
if (this.cDim.h > d) e = g.top = (this.cDim.h - d) / 2;
else {
e = -(d - this.cDim.h) * 0.5;
g.h = this.cDim.h
}
$img.attr("width", a).attr("height", d);
$ic.width(a).height(d);
c.data("scaled", true)
}
$ic.css("left", b).css("top", e);
this.bindMouseEvents($ic);
this.trigger("resize", g)
},
resizeContent: function (c) {
$ic = c.data("ic");
$img = c.data("img");
c.data("scaled", false);
var a = $img.width(),
d = $img.height(),
b = {
w: a,
h: d,
left: 0,
top: 0
};
if (this.config.stretch) {
$ic.width(this.cDim.w).height(this.cDim.h);
$img.width(this.cDim.w).height(this.cDim.h);
c.data("scaled", true)
} else {
b.left = (this.cDim.w - a) * 0.5;
b.top = (this.cDim.h - d) * 0.5;
$ic.css("left", b.left).css("top", b.top)
}
this.bindMouseEvents($ic);
this.trigger("resize", b)
},
onTransitionEnd: function () {
this.$active.remove();
this.$active = this.$buffer;
this.isInTransition = false;
this.trigger("transition", {
n: this.active
});
this.bindMouseEvents(this.$binder);
var c = this.$binder.offset();
this.mouseIsOver = false;
if (this.mouseCoor.x >= c.left && this.mouseCoor.x <= c.left + this.$binder.width()) if (this.mouseCoor.y >= c.top && this.mouseCoor.y <= c.top + this.$binder.height()) {
this.lastEnter = "leave";
this.enterLeave("enter");
this.startIdle();
this.mouseIsOver = true;
f(document).mousemove(f.proxy(this.onMouseMove, this))
}
this.qid != null && this.show(this.qid)
},
trigger: function (c, a) {
var d = f.Event("img_" + c),
b;
for (b in a) d[b] = a[b];
d.source = this;
this.$c.trigger(d);
this.config[c] && this.config[c].call(this, d)
},
destroy: function () {
this.isInTransition && this.ts.stop(this.$active, this.$buffer);
this.$active && this.$active.remove();
this.$buffer.remove()
},
rebuild: function (c) {
this.quid = null;
this.isInTransition && this.ts.stop(this.$active, this.$buffer);
this.$buffer && this.$buffer.remove();
this.cached = [];
this.data = c;
this.loader && this.loader.cancel()
}
}
})(jQuery);
(function (f) {
f.fn.tn3.Thumbnailer = function (c, a, d) {
this.$c = c;
this.data = a;
this.config = f.extend({}, f.fn.tn3.Thumbnailer.config, d);
f(window).resize(f.proxy(this.onWinResize, this));
this.init()
};
f.fn.tn3.Thumbnailer.config = {
overMove: true,
buffer: 20,
speed: 8,
slowdown: 50,
shaderColor: "#000000",
shaderOpacity: 0.5,
shaderDuration: 300,
shaderOut: 300,
useTitle: false,
seqLoad: true,
align: 1,
mode: "thumbs",
cssID: "tn3"
};
f.fn.tn3.Thumbnailer.prototype = {
config: null,
$c: null,
$oc: null,
$ul: null,
data: null,
active: -1,
listSize: 0,
containerSize: 0,
containerPadding: 0,
noBufSize: 0,
containerOffset: 0,
mcoor: "mouseX",
edge: "left",
size: "width",
outerSize: "outerWidth",
mouseX: 0,
mouseY: 0,
intID: false,
pos: 0,
difference: 0,
cnt: 1,
thumbCount: -1,
initialized: false,
clickWhenReady: -1,
loaders: null,
lis: null,
isVertical: null,
marginDif: 0,
nloaded: 0,
firstToLoad: 0,
init: function () {
this.$c.css("position", "absolute").css("cursor", "progress");
this.lis = [];
this.loaders = [];
this.initialized = false;
this.$oc = f("<div />");
this.$ul = f("<ul />");
this.$oc.appendTo(this.$c);
this.$oc.css("position", "absolute").css("overflow", "hidden").width(this.$c.width()).height(this.$c.height());
this.$ul.appendTo(this.$oc);
this.$ul.css("position", "relative").css("margin", "0px").css("padding", "0px").css("border-width", "0px").css("width", "12000px").css("list-style", "none");
if (this.isVertical == null) {
this.isVertical = this.$c.width() < this.$c.height();
if (this.isVertical = false) {
this.mcoor = "mouseY";
this.edge = "top";
this.size = "height";
this.outerSize = "outerHeight"
} else {
this.mcoor = "mouseX";
this.edge = "left";
this.size = "width";
this.outerSize = "outerWidth"
}
this.containerSize = this.$oc[this.size]();
this.noBufSize = this.containerSize - 2 * this.config.buffer;
this.containerOffset = this.$oc.offset()[this.edge];
this.containerPadding = parseInt(this.$c.css("padding-" + this.edge))
}
this.listSize = 0;
if (navigator.userAgent.indexOf("MSIE") != -1) this.config.seqLoad = false;
this.data.length > 0 && this.loadNextThumb()
},
loadNextThumb: function () {
this.thumbCount++;
var c = this.$ul.append("<li></li>").find(":last");
if (this.config.mode == "thumbs") {
var a = this.data[this.thumbCount].thumb;
if (a) {
this.loaders.push(new f.fn.tn3.ImageLoader(a, this, this.onLoadThumb, [c, this.thumbCount]));
!this.config.seqLoad && this.thumbCount < this.data.length - 1 && this.loadNextThumb();
return
} else this.config.mode = "bullets"
}
this.config.mode == "numbers" && c.text(this.thumbCount + 1);
this.onLoadThumb(null, c, this.thumbCount)
},
onLoadThumb: function (c, a, d, b) {
this.lis[d] = {
li: a
};
a.addClass(this.config.cssID + "-thumb");
a.css("float", this.isVertical ? "none" : "left");
if (c) {
var e = this.lis[d].thumb = a.append(c).find(":last");
this.lis[d].pos = a.position()[this.edge]
}
this.config.useTitle && a.attr("title", this.data[d].title);
if (this.config.mode == "thumbs") {
this.lis[d].shade = a.prepend("<div/>").find(":first");
this.lis[d].shade.css("background-color", this.config.shaderColor).css("width", e.width()).css("height", e.height()).css("position", "absolute")
}
this.initThumb(d);
a.css("opacity", 0);
a.animate({
opacity: 1
}, 1E3);
this.listSize += a[this.outerSize](true);
if (!this.initialized) {
this.firstToLoad = d;
this.initialized = true;
this.initMouse(true)
}
b && this.trigger("error", {
description: b,
n: d
});
this.trigger("thumbLoad", {
n: d
});
this.nloaded++;
if (this.nloaded < this.data.length) {
if (this.config.seqLoad || this.config.mode != "thumbs") this.loadNextThumb()
} else {
if (c) this.loaders = null;
if (!this.config.seqLoad) for (c = 0; c < this.lis.length; c++) this.lis[c].pos = this.lis[c].li.position()[this.edge];
this.thumbsLoaded()
}
if (this.clickWhenReady == d) {
this.clickWhenReady = -1;
this.thumbClick(d)
}
},
initThumb: function (c) {
var a = this.lis[c];
if (a.li) {
a.li.removeClass().addClass(this.config.cssID + "-thumb");
if (a.shade) {
a.shade.stop();
a.shade.css("opacity", this.config.shaderOpacity)
}
var d = this;
a.li.click(function () {
d.thumbClick(c);
d.trigger("click", {
n: c
});
return false
});
this.config.mode != "thumbs" && a.li.hover(function () {
d.mouseOver(c)
}, function () {
d.mouseOver(-1)
})
}
},
lastOver: -1,
mouseOver: function (c) {
if (c != this.lastOver) {
if (this.lastOver != -1 && this.lastOver != this.active) {
a = this.lis[this.lastOver];
a.li.removeClass(this.config.cssID + "-thumb-over");
if (a.shade) {
a.shade.stop();
a.shade.animate({
opacity: this.config.shaderOpacity
}, {
duration: this.config.shaderOut,
easing: "easeOutCubic",
queue: false
})
}
this.trigger("thumbOut", {
n: c
})
}
this.lastOver = c;
if (!(c == -1 || c == this.active)) {
var a = this.lis[c];
a.li.addClass(this.config.cssID + "-thumb-over");
if (a.shade) {
a.shade.stop();
a.shade.animate({
opacity: 0
}, {
duration: this.config.shaderDuration,
easing: "easeOutCubic",
queue: false
})
}
this.trigger("thumbOver", {
n: c
})
}
}
},
next: function (c) {
if (c) this.listSize > this.containerSize && this.move(this.$ul.position()[this.edge] - this.containerSize);
else {
c = this.active + 1;
if (this.active == -1 || this.active + 1 == this.data.length) c = 0;
this.thumbClick(c)
}
},
prev: function (c) {
if (c) this.listSize > this.containerSize && this.move(this.$ul.position()[this.edge] + this.containerSize);
else {
c = this.active - 1;
if (this.active == -1 || this.active == 0) c = this.data.length - 1;
this.thumbClick(c)
}
},
move: function (c) {
var a = {};
a[this.edge] = Math.min(0, Math.max(c, -(this.listSize - this.containerSize)));
this.$ul.stop();
this.$ul.animate(a, 300)
},
thumbClick: function (c) {
if (this.active == -1) {
if (this.thumbCount <= c || this.lis.length <= c || this.lis[c] == null) {
this.clickWhenReady = c;
return
}
} else if (c == this.active) return;
else this.initThumb(this.active);
if (c == "next") c = this.active + 1 < this.data.length ? this.active + 1 : 0;
else if (c == "prev") c = this.active > 0 ? this.active - 1 : this.data.length - 1;
var a = this.lis[c];
a.li.addClass(this.config.cssID + "-thumb-selected").unbind("click mouseenter mouseleave");
a.shade && a.shade.animate({
opacity: 0
}, this.config.shaderDuration);
this.active = c;
this.centerActive()
},
centerActive: function (c) {
if (this.active != -1) {
var a = this.lis[this.active].li,
d = this.$ul.position()[this.edge] + a.position()[this.edge],
b = a[this.outerSize]() / 2;
if (d + b > this.containerSize || d + b < 0) {
a = 10 - a.position()[this.edge] + this.containerSize / 2 - b;
a = Math.min(0, a);
a = Math.max(a, -this.listSize + this.containerSize);
d = {};
d[this.edge] = a;
c ? this.$ul.css(d) : this.$ul.animate(d, 200)
}
}
},
thumbsLoaded: function () {
this.$c.css("cursor", "auto");
this.$ul.css("width", this.listSize + "px");
this.centerList();
this.trigger("load")
},
centerList: function (c) {
if (this.listSize < this.containerSize) {
var a = {};
a[this.edge] = this.config.align ? this.config.align == 1 ? (this.containerSize - this.listSize) / 2 : this.containerSize - this.listSize : 0;
c || this.config.mode != "thumbs" ? this.$ul.css(a) : this.$ul.animate(a, 300)
} else {
this.centerActive(c);
if (this.$ul.position()[this.edge] > 0) this.$ul.css(this.edge, 0);
else this.$ul.position()[this.edge] + this.listSize < this.containerSize && this.$ul.css(this.edge, -(this.listSize - this.containerSize))
}
},
initMouse: function (c) {
if (this.config.mode == "thumbs") {
c = c ? "bind" : "unbind";
this.$oc[c]("mouseenter", f.proxy(this.mouseenter, this));
this.$oc[c]("mouseleave", f.proxy(this.mouseleave, this))
}
},
mouseenter: function () {
this.trigger("over");
clearInterval(this.intID);
var c = this;
this.$ul.stop();
this.$c.mousemove(this.mcoor == "mouseX" ?
function (a) {
c.mouseX = a.pageX - c.containerOffset
} : function (a) {
c.mouseY = a.pageY - c.containerOffset
});
this.marginDif = parseInt(this.lis[this.firstToLoad].li.css("margin-" + this.edge));
if (isNaN(this.marginDif)) this.marginDif = 0;
c.intID = this.listSize > this.containerSize && this.config.overMove ? setInterval(function () {
c.slide.call(c)
}, 10) : setInterval(function () {
c.mouseTrack.call(c)
}, 10)
},
mouseleave: function () {
this.trigger("out");
this.$c.unbind("mousemove");
clearInterval(this.intID);
var c = this;
this.intID = setInterval(function () {
c.slideOut.call(c)
}, 10);
this.mouseOver(-1)
},
slide: function () {
this.cnt = 1;
var c = this[this.mcoor];
if (c <= this.config.buffer) this.pos = 0;
else if (c >= this.containerSize - this.config.buffer) this.pos = this.containerSize - this.listSize - 1;
else {
var a = this.containerSize * (c - this.config.buffer);
a /= this.noBufSize;
this.pos = a * (1 - this.listSize / this.containerSize)
}
for (a = this.lis.length - 1; a > -1; a--) {
var d = c - this.prevdx;
if (d >= this.lis[a].pos && d < this.lis[a].pos + this.lis[a].li.width()) {
this.mouseOver(a);
break
}
}
c = this.prevdx - this.marginDif;
this.difference = c - this.pos;
c = Math.round(c - this.difference / this.config.speed);
if (this.prevdx != c) {
this.$ul.css(this.edge, c);
this.prevdx = c
}
},
prevdx: 0,
mouseTrack: function () {
for (var c = this[this.mcoor], a = this.lis.length - 1; a > -1; a--) {
var d = c - this.$ul.position()[this.edge];
if (d >= this.lis[a].pos && d < this.lis[a].pos + this.lis[a].li.width()) {
this.mouseOver(a);
break
}
}
},
slideOut: function () {
if (this.config.slowdown != 0 && this.difference != 0) {
var c = this.$ul.position()[this.edge];
this.difference = c - this.pos;
this.$ul.css(this.edge, c - this.difference / (this.config.speed * this.cnt));
this.cnt *= 1 + 4 / this.config.slowdown;
if (this.cnt >= 40) {
this.difference = 0;
this.cnt = 1
}
} else {
clearInterval(this.intID);
this.intID = null
}
},
trigger: function (c, a) {
var d = f.Event("tn_" + c),
b;
for (b in a) d[b] = a[b];
d.source = this;
this.$c.trigger(d);
this.config[c] && this.config[c].call(this, d)
},
destroy: function () {
clearInterval(this.intID);
this.$c.empty()
},
rebuild: function (c) {
clearInterval(this.intID);
this.$c.empty();
this.data = c;
this.active = this.thumbCount = -1;
this.nloaded = 0;
this.initMouse(false);
this.loaders !== null && f.each(this.loaders, function (a, d) {
d.cancel()
});
this.init()
},
setSize: function (c, a) {
if (this.config.mode == "thumbs") {
this.isVertical ? this.$c.height(a) : this.$c.width(c);
this.$oc.width(this.$c.width()).height(this.$c.height());
this.containerSize = this.$oc[this.size]();
this.noBufSize = this.containerSize - 2 * this.config.buffer;
this.containerOffset = this.$oc.offset()[this.edge];
this.initMouse(true);
this.loaders === null && this.centerList(true)
}
},
onWinResize: function () {
this.containerOffset = this.$oc.offset()[this.edge]
}
}
})(jQuery);
(function (f) {
f.fn.tn3.altLink = null;
f.fn.tn3.ImageLoader = function (c, a, d, b) {
this.$img = f(new Image);
b.unshift(this.$img);
this.altLink = f.fn.tn3.altLink;
a = {
url: c,
context: a,
callback: d,
args: b
};
this.$img.bind("load", a, this.load);
this.$img.bind("error", a, f.proxy(this.error, this));
this.$img.attr("src", c)
};
f.fn.tn3.ImageLoader.prototype = {
$img: null,
altLink: null,
load: function (c) {
c.data.callback.apply(c.data.context, c.data.args);
c.data.args[0].unbind("load").unbind("error")
},
error: function (c) {
if (this.altLink) {
this.altLink = null;
this.$img.attr("src", f.fn.tn3.altLink + c.data.url)
} else {
c.data.args.push("image loading error: " + c.data.url);
c.data.callback.apply(c.data.context, c.data.args);
this.$img.unbind("load").unbind("error")
}
},
cancel: function () {
this.$img.unbind("load").unbind("error")
}
}
})(jQuery);
(function (f) {
f.fn.tn3.Timer = function (c, a, d) {
this.$target = c;
this.duration = a;
this.tickint = d
};
f.fn.tn3.Timer.prototype = {
$target: null,
duration: null,
id: null,
runs: false,
counter: null,
countDuration: null,
tickid: null,
ticks: null,
tickint: 500,
start: function () {
if (!this.runs) {
this.runs = true;
this.startCount(this.duration);
this.trigger("timer_start")
}
},
startCount: function (c) {
this.clean();
this.countDuration = c;
this.counter = +new Date;
var a = this;
this.id = setTimeout(function () {
a.clean.call(a);
a.runs = false;
a.trigger.call(a, "timer_end")
}, c);
var d = this.duration / this.tickint;
this.ticks = Math.round(c / d);
this.tickid = setInterval(function () {
a.ticks = Math.ceil((c - new Date + a.counter) / d);
a.ticks > 0 && a.trigger.call(a, "timer_tick", {
tick: a.ticks,
totalTicks: a.tickint
})
}, d);
this.trigger("timer_tick", {
tick: this.ticks,
totalTicks: this.tickint
})
},
stop: function () {
this.clean();
this.runs = false;
this.trigger("timer_stop")
},
clean: function () {
clearTimeout(this.id);
this.id = null;
clearInterval(this.tickid);
this.elapsed = this.tickid = null
},
elapsed: null,
pause: function (c) {
if (this.runs) {
if (c) {
this.clean();
var a = this.duration / this.tickint;
this.elapsed = Math.floor((+new Date - this.counter) / a) * a
} else {
if (this.elapsed == null) return;
this.startCount(this.countDuration - this.elapsed);
this.elapsed = null
}
this.trigger("timer_pause", {
pause: c
})
}
},
trigger: function (c, a) {
var d = f.Event(c),
b;
for (b in a) d[b] = a[b];
this.$target.trigger(d)
}
}
})(jQuery);
(function (f) {
var c = f.fn.tn3.Transitions = function (d, b, e, g, k) {
this.ts = d;
this.def = f.extend(true, {}, this[b.type + "Config"], b);
if (!d) this.ts = [this.def];
for (var j in this.ts) this.ts[j] = f.extend(true, {}, this[this.ts[j].type + "Config"], this.ts[j]);
this.random = e;
this.end = f.proxy(g, k)
},
a = c.prototype = {
ts: null,
def: {
type: "slide"
},
random: false,
gs: [],
end: null,
ct: null,
counter: -1,
setTransition: function () {
if (this.ts.length == 1) this.ct = this.ts[0];
else {
this.counter++;
if (this.counter == this.ts.length) this.counter = 0;
this.random && this.counter == 0 && f.fn.tn3utils.shuffle(this.ts);
this.ct = this.ts[this.counter]
}
},
start: function (d, b, e) {
this.setTransition();
if (this[this.ct.type + "Condition"] !== undefined && !this[this.ct.type + "Condition"](d, b, this.ct)) this.ct = this.def;
this[this.ct.type](d, b, this.ct, e)
},
stop: function (d, b) {
this[this.ct.type + "Stop"](d, b, this.ct)
},
makeGrid: function (d, b, e) {
var g = d.width(),
k = Math.round(g / b);
g = g - k * b;
var j = d.height(),
n = Math.round(j / e);
j = j - n * e;
var h, i, l, m, p, q = 0,
r = 0,
t = "url(" + d.find("img").attr("src") + ") no-repeat scroll -";
for (h = 0; h < b; h++) {
this.gs[h] = [];
m = g > h ? k + 1 : k;
for (i = 0; i < e; i++) {
l = d.append("<div></div>").find(":last");
p = j > i ? n + 1 : n;
l.width(m).height(p).css("background", t + q + "px -" + r + "px").css("left", q).css("top", r).css("position", "absolute");
this.gs[h].push(l);
r += p
}
q += m;
r = 0
}
d.find("img").remove()
},
stopGrid: function () {
for (var d = 0; d < this.gs.length; d++) for (var b = 0; b < this.gs[d].length; b++) {
this.gs[d][b].clearQueue();
this.gs[d][b].remove()
}
this.gs = []
},
flatSort: function (d) {
for (var b = [], e = 0; e < this.gs.length; e++) for (var g = 0; g < this.gs[e].length; g++) b.push(this.gs[e][g]);
d && b.reverse();
return b
},
randomSort: function () {
var d = this.flatSort();
f.fn.tn3utils.shuffle(d);
return d
},
diagonalSort: function (d, b) {
for (var e = [], g = d > 0 ? this.gs.length - 1 : 0, k = b > 0 ? 0 : this.gs[0].length - 1; this.gs[g];) {
e.push(this.addDiagonal([], g, k, d, b));
g -= d
}
g += d;
for (k += b; this.gs[g][k];) {
e.push(this.addDiagonal([], g, k, d, b));
k += b
}
return e
},
addDiagonal: function (d, b, e, g, k) {
d.push(this.gs[b][e]);
return this.gs[b + g] && this.gs[b + g][e + k] ? this.addDiagonal(d, b + g, e + k, g, k) : d
},
circleSort: function (d) {
var b = [],
e = this.gs.length,
g = this.gs[0].length,
k = [Math.floor(e / 2), Math.floor(g / 2)];
e = e * g;
g = [
[1, 0],
[0, 1],
[-1, 0],
[0, -1]
];
var j = 0,
n = 0,
h;
for (b.push(this.gs[k[0]][k[1]]); b.length < e;) {
for (h = 0; h <= j; h++) this.addGridPiece(b, k, g[n]);
if (n == g.length - 1) n = 0;
else n++;
j += 0.5
}
d && b.reverse();
return b
},
addGridPiece: function (d, b, e) {
b[0] += e[0];
b[1] += e[1];
this.gs[b[0]] && this.gs[b[0]][b[1]] && d.push(this.gs[b[0]][b[1]])
},
getSlidePositions: function (d, b) {
var e = {
dir: b
};
switch (b) {
case "left":
e.pos = d.outerWidth(true);
break;
case "right":
e.pos = -d.outerWidth(true);
e.dir = "left";
break;
case "top":
e.pos = -d.outerHeight(true);
break;
case "bottom":
e.pos = d.outerHeight(true);
e.dir = "top"
}
return e
},
animateGrid: function (d, b, e, g, k, j, n) {
var h = {
duration: g,
easing: e,
complete: function () {
f(this).remove()
}
};
for (e = 0; e < d.length; e++) {
g = f.easing[k](0, e, 0, j, d.length);
if (e == d.length - 1) {
var i = this;
h.complete = function () {
f(this).remove();
n.call(i)
}
}
if (f.isArray(d[e])) for (var l in d[e]) d[e][l].delay(g).animate(b[e], h);
else d[e].delay(g).animate(b[e], h)
}
},
getValueArray: function (d, b, e) {
var g = [],
k = f.isArray(b),
j = f.isArray(e),
n;
for (n = 0; n < d; n++) {
o = {};
o[k ? b[n % b.length] : b] = j ? e[n % e.length] : e;
g.push(o)
}
return g
}
};
c.defined = [];
c.define = function (d) {
for (var b in d) switch (b) {
case "type":
c.defined.push(d.type);
break;
case "config":
a[d.type + "Config"] = d.config;
break;
case "f":
a[d.type] = d.f;
break;
case "stop":
a[d.type + "Stop"] = d.stop;
break;
case "condition":
a[d.type + "Condition"] = d.condition;
break;
default:
a[b] = d[b]
}
};
c.define({
type: "none",
config: {},
f: function () {
this.end()
},
stop: function () {
this.end()
}
});
c.define({
type: "fade",
config: {
duration: 300,
easing: "easeInQuad"
},
f: function (d, b, e) {
var g = this;
d.animate({
opacity: 0
}, e.duration, e.easing, function () {
g.end()
})
},
stop: function (d) {
d.stop();
this.end()
}
});
c.define({
type: "slide",
config: {
duration: 300,
direction: "auto",
easing: "easeInOutCirc"
},
f: function (d, b, e, g) {
g = this.getSlidePositions(b, e.direction == "auto" ? g : e.direction);
var k = {},
j = {};
b.css(g.dir, g.pos);
k[g.dir] = 0;
b.animate(k, e.duration, e.easing, this.end);
j[g.dir] = -g.pos;
d.animate(j, e.duration, e.easing)
},
stop: function (d, b) {
b.stop();
d.stop();
d.css("left", 0).css("top", 0);
b.css("left", 0).css("top", 0);
this.end()
}
});
c.define({
type: "blinds",
config: {
duration: 240,
easing: "easeInQuad",
direction: "vertical",
parts: 12,
partDuration: 100,
partEasing: "easeInQuad",
method: "fade",
partDirection: "auto",
cross: true
},
f: function (d, b, e, g) {
e.direction == "horizontal" ? this.makeGrid(d, 1, e.parts) : this.makeGrid(d, e.parts, 1);
g = e.partDirection == "auto" ? g : e.partDirection;
d = this.flatSort(g == "left" || g == "top");
var k;
switch (e.method) {
case "fade":
k = this.getValueArray(d.length, "opacity", 0);
break;
case "scale":
k = this.getValueArray(d.length, g == "left" ? "width" : "height", "1px");
break;
case "slide":
b = this.getSlidePositions(b, g);
k = this.getValueArray(d.length, b.dir, e.cross ? [b.pos, -b.pos] : b.pos)
}
this.animateGrid(d, k, e.partEasing, e.partDuration, e.easing, e.duration, this.blindsStop)
},
stop: function () {
this.stopGrid();
this.end()
},
condition: function (d, b) {
return !d.data("scaled") || !b.data("scaled")
}
});
c.define({
type: "grid",
config: {
duration: 260,
easing: "easeInQuad",
gridX: 7,
gridY: 5,
sort: "diagonal",
sortReverse: false,
diagonalStart: "bl",
method: "fade",
partDuration: 300,
partEasing: "easeOutSine",
partDirection: "left"
},
f: function (d, b, e, g) {
this.makeGrid(d, e.gridX, e.gridY);
d = e.partDirection == "auto" ? g : e.partDirection;
var k, j;
if (e.sort == "diagonal") switch (e.diagonalStart) {
case "tr":
k = this.diagonalSort(1, 1);
break;
case "tl":
k = this.diagonalSort(-1, 1);
break;
case "br":
k = this.diagonalSort(1, -1);
break;
case "bl":
k = this.diagonalSort(-1, -1)
} else k = this[e.sort + "Sort"](e.sortReverse);
switch (e.method) {
case "fade":
j = this.getValueArray(k.length, "opacity", 0);
break;
case "scale":
j = this.getValueArray(k.length, d == "left" ? "width" : "height", "1px")
}
this.animateGrid(k, j, e.partEasing, e.partDuration, e.easing, e.duration, this.gridStop)
},
stop: function () {
this.stopGrid();
this.end()
},
condition: function (d, b) {
return !d.data("scaled") || !b.data("scaled")
}
})
})(jQuery);
(function (f) {
function c(h) {
var i = h && h.message !== undefined ? h.message : undefined;
h = f.extend({}, f.tn3block.defaults, h || {});
i = i === undefined ? h.message : i;
n && a({});
var l = h.baseZ,
m = f.browser.msie || h.forceIframe ? f('<iframe class="blockUI" style="z-index:' + l+++';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="' + h.iframeSrc + '"></iframe>') : f('<div class="blockUI" style="display:none"></div>'),
p = f('<div class="blockUI ' + h.cssID + '-overlay" style="z-index:' + l+++';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
l = f('<div class="blockUI ' + h.blockMsgClass + ' blockPage" style="z-index:' + l + ';display:none;position:fixed"></div>');
l.css("left", "0px").css("top", "0px");
if (!h.applyPlatformOpacityRules || !(f.browser.mozilla && /Linux/.test(navigator.platform))) p.css(h.overlayCSS);
p.css("position", "fixed");
if (f.browser.msie || h.forceIframe) m.css("opacity", 0);
var q = [m, p, l],
r = f("body");
f.each(q, function () {
this.appendTo(r)
});
q = k && (!f.boxModel || f("object,embed", null).length > 0);
if (j || q) {
h.allowBodyStretch && f.boxModel && f("html,body").css("height", "100%");
f.each([m, p, l], function (t, u) {
var s = u[0].style;
s.position = "absolute";
if (t < 2) {
s.setExpression("height", "Math.max(document.body.scrollHeight, document.body.offsetHeight)- (jQuery.boxModel?0:" + h.quirksmodeOffsetHack + ') + "px"');
s.setExpression("width", 'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
} else if (h.centerY) {
s.setExpression("top", '(document.documentElement.clientHeight || document.body.clientHeight) / 2- (this.offsetHeight / 2)+ (blah = document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop)+ "px"');
s.marginTop = 0
} else h.centerY || s.setExpression("top", '(document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')
})
}
if (i) {
i.data("blockUI.parent", i.parent());
l.append(i);
if (i.jquery || i.nodeType) f(i).show()
}
if ((f.browser.msie || h.forceIframe) && h.showOverlay) m.show();
h.showOverlay && p.show();
i && l.show();
h.onBlock && h.onBlock();
b(1, h);
n = i
}
function a(h) {
h = f.extend({}, f.tn3block.defaults, h || {});
b(0, h);
var i = f("body").children().filter(".blockUI").add("body > .blockUI");
d(i, h)
}
function d(h, i) {
h.each(function () {
this.parentNode && this.parentNode.removeChild(this)
});
n.data("blockUI.parent").append(n);
n = null;
typeof i.onUnblock == "function" && i.onUnblock.call(i.con)
}
function b(h, i) {
if (h || n)!i.bindEvents || h && !i.showOverlay || (h ? f(document).bind("mousedown mouseup keydown keypress", i, e) : f(document).unbind("mousedown mouseup keydown keypress", e))
}
function e(h) {
var i = h.data;
if (f(h.target).parents("div." + i.blockMsgClass).length > 0) return true;
return f(h.target).parents().children().filter("div.blockUI").length == 0
}
var g = document.documentMode || 0,
k = f.browser.msie && (f.browser.version < 8 && !g || g < 8),
j = f.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !g;
f.tn3block = function (h) {
c(h)
};
f.tn3unblock = function (h) {
a(h)
};
var n = undefined;
f.tn3block.defaults = {
message: "<h1>Please wait...</h1>",
overlayCSS: {},
iframeSrc: /^https/i.test(window.location.href || "") ? "javascript:false" : "about:blank",
forceIframe: false,
baseZ: 1E3,
allowBodyStretch: true,
bindEvents: true,
showOverlay: true,
applyPlatformOpacityRules: true,
onBlock: null,
onUnblock: null,
quirksmodeOffsetHack: 4,
blockMsgClass: "blockMsg",
cssID: "tn3"
}
})(jQuery);
(function (f) {
(f.fn.tn3.External = function (c, a) {
if (c) {
this.context = a;
this.reqs = c.length;
for (var d = 0; d < c.length; d++) new f.fn.tn3.External[c[d].origin](c[d], this)
}
}).prototype = {
context: null,
reqs: 0,
getImages: function (c, a) {
c.origin.getImages(c, a)
},
setAlbumData: function (c, a) {
this.reqs--;
this.context.setAlbumData.call(this.context, c, a)
},
setImageData: function (c, a, d) {
this.context.setImageData.call(this.context, c, a, d)
},
getAlbumData: function (c) {
return this.context.data[c]
}
}
})(jQuery);