').css('line-height', $(window).height() + "px")
.appendTo($("body"));
}
var img = $('
');
img.appendTo(imgContainer);
showArrows();
closeBtn.appendTo(imgContainer);
showLoader(true);
img.load(function () {
showLoader(false);
});
img.error(function () {
showLoader(false);
img.attr("src", $(src).attr("src"));
});
bindMouse($(".lightbox-wrapper .arrow").add(img).add(imgContainer));
}
function reload() {
images = $(".lightbox");
}
function move(index) {
if (index < 0 || index >= images.length) {
return;
}
showError(false);
current = index;
$(".lightbox-wrapper .lightbox-image:not(.active)").remove();
var active = $(".lightbox-wrapper .active");
var target = $('
');
active.after(target);
showArrows();
showLoader(true);
bindMouse($(".lightbox-wrapper").add(target));
target.load(function () {
showLoader(false);
active.removeClass("active");
target.addClass("active");
});
target.error(function () {
showLoader(false);
active.removeClass("active");
target.addClass("active");
target.attr("src", $(images[current]).attr("src"));
});
}
function showArrows() {
if ($(".lightbox-wrapper .arrow").length === 0) {
$(".lightbox-wrapper").append($('
').css("top", $(window).height() / 2 - 40));
$(".lightbox-wrapper").append($('
').css("top", $(window).height() / 2 - 40));
}
if (current === 0) {
$(".lightbox-wrapper .arrow.left").addClass("disabled");
} else {
$(".lightbox-wrapper .arrow.left").removeClass("disabled");
}
if (current === images.length - 1) {
$(".lightbox-wrapper .arrow.right").addClass("disabled");
} else {
$(".lightbox-wrapper .arrow.right").removeClass("disabled");
}
}
function showError(enable) {
if (enable) {
$(".lightbox-wrapper").append($('
The requested content cannot be loaded.
Please try again later.
')
.css({ "top": $(window).height() / 2 - 60, "left": $(window).width() / 2 - 170 }));
} else {
$(".lightbox-wrapper .lightbox-error").remove();
}
}
function showLoader(enable) {
if (!enable) {
$(".lightbox-wrapper .loading").remove();
}
else {
$('
').css({ "top": $(window).height() / 2 - 16, "left": $(window).width() / 2 - 16 }).appendTo($(".lightbox-wrapper"));
}
}
var close = function () {
$(".lightbox-wrapper").remove();
};
function bindMouse(img) {
img.unbind("wheel").mousewheel(function (event, delta) {
delta = delta > 0 ? 1 : -1;
move(current + delta);
event.preventDefault();
});
img.mousedown(function (e) {
// close on middle button click
if (e.which === 2) {
close();
}
e.preventDefault();
});
}
function getFullImgSrc(src) {
var fileName = src.substring(0, src.lastIndexOf('.'));
var ext = src.substring(src.lastIndexOf('.'));
src = fileName + "-large" + ext;
return src;
}
});
})(jQuery);
jQuery(function () {
'use strict';
new ThemeLightbox().init();
});
(function($) {
'use strict';
// transition && transitionEnd && browser prefix
$.support.transition = (function() {
var thisBody = document.body || document.documentElement,
thisStyle = thisBody.style,
support = thisStyle.transition !== undefined ||
thisStyle.WebkitTransition !== undefined ||
thisStyle.MozTransition !== undefined ||
thisStyle.MsTransition !== undefined ||
thisStyle.OTransition !== undefined;
return support && {
event: (function() {
var e = "transitionend";
if ($.browser.opera) {
var version = parseFloat($.browser.version);
e = version >= 12 ? (version < 12.50 ? "otransitionend" : "transitionend") : "oTransitionEnd";
} else if ($.browser.webkit) {
e = "webkitTransitionEnd";
}
return e;
})(),
prefix: (function() {
var result;
$.each($.browser, function(key, value) {
if (key === "version") {
return true;
}
return (result = {
opera: "-o-",
mozilla: "-moz-",
webkit: "-webkit-",
msie: "-ms-"
}[key]) ? false : true;
});
return result || "";
})()
};
})();
window.BackgroundHelper = function () {
var slides = [];
var direction = "next";
var motion = "horizontal";
var width = 0;
var height = 0;
var multiplier = 1;
var transitionDuration = "";
this.init = function(motionType, dir, duration) {
direction = dir;
motion = motionType;
slides = [];
width = 0;
height = 0;
multiplier = 1;
transitionDuration = duration;
};
this.processSlide = function(element, modify) {
this.updateSize(element, null);
var pos = [];
var bgPosition = element.css("background-position");
var positions = bgPosition.split(",");
$.each(positions, function (i) {
var position = $.trim(this);
var point = position.split(" ");
if (point.length > 1) {
var x = parseInt(point[0], 10);
var y = parseInt(point[1], 10);
pos.push({ x: x, y: y });
}
});
slides.push({
"images": element.css("background-image"),
"sizes": element.css("background-size"),
"positions": pos
});
if (modify)
element.css("background-image", "none");
};
this.updateSize = function (element, initialSize) {
width = element.outerWidth(false);
height = element.outerHeight();
if (initialSize && parseInt(initialSize.width, 10) !== 0) {
multiplier = width / initialSize.width;
if (motion === "fade") {
$.each(element.children(), function (i) {
$(this).css("background-position", getCssPositions(slides[i].positions, { x: 0, y: 0 }));
});
}
}
};
this.setBackground = function(element, items) {
var bg = [];
var sizes = [];
$.each(items, function (i, o) {
bg.push(o.images);
sizes.push(o.sizes);
});
element.css({
"background-image": bg.join(", "),
"background-size": sizes.join(", "),
"background-repeat": "no-repeat"
});
};
this.setPosition = function(element, items) {
var pos = [];
$.each(items, function(i, o) {
pos.push(o.positions);
});
element.css({
"background-position": pos.join(", ")
});
};
this.current = function(index) {
return slides[index] || null;
};
this.next = function(index) {
var next;
if (direction === "next") {
next = (index + 1) % slides.length;
} else {
next = index - 1;
if (next < 0) {
next = slides.length - 1;
}
}
return slides[next];
};
this.items = function(prev, next, move) {
var prevItem = { x: 0, y: 0 };
var nextItem = { x: 0, y: 0 };
var isDirectionNext = direction === "next";
if (motion === "horizontal") {
nextItem.x = isDirectionNext ? width : -width;
nextItem.y = 0;
if (move) {
prevItem.x += isDirectionNext ? -width : width;
nextItem.x += isDirectionNext ? -width : width;
}
} else if (motion === "vertical") {
nextItem.x = 0;
nextItem.y = isDirectionNext ? height : -height;
if (move) {
prevItem.y += isDirectionNext ? -height : height;
nextItem.y += isDirectionNext ? -height : height;
}
}
var result = [ ];
if (!!prev) {
result.push({ images: prev.images, positions: getCssPositions(prev.positions, prevItem), sizes: prev.sizes });
}
if (!!next) {
result.push({ images: next.images, positions: getCssPositions(next.positions, nextItem), sizes: next.sizes });
}
if (direction === "next") {
result.reverse();
}
return result;
};
this.transition = function(container, on) {
container.css($.support.transition.prefix + "transition", on ? transitionDuration + " ease-in-out background-position" : "");
};
function getCssPositions(positions, offset) {
var result = [];
if (positions === undefined) {
return "";
}
offset.x = offset.x || 0;
offset.y = offset.y || 0;
for (var i = 0; i < positions.length; i++) {
result.push((positions[i].x * multiplier + offset.x) + "px " + (positions[i].y * multiplier + offset.y) + "px");
}
return result.join(", ");
}
};
var Slider = function (element, settings) {
var interval = null;
var active = false;
var children = element.find(".active").parent().children();
var last = false;
var running = false;
this.settings = $.extend({ }, {
"animation": "horizontal",
"direction": "next",
"speed": 600,
"pause": 2500,
"auto": true,
"repeat": true,
"navigator": null,
"clickevents": true,
"hover": true,
"helper": null
}, settings);
this.move = function (direction, next) {
var activeItem = element.find(".active"),
nextItem = next || activeItem[direction](),
innerDirection = this.settings.direction === "next" ? "forward" : "back",
reset = direction === "next" ? "first" : "last",
moving = interval,
slider = this, tmp;
active = true;
if (moving) { this.stop(true); }
if (!nextItem.length) {
nextItem = element.find(".slide-item")[reset]();
if (!this.settings.repeat) { last = true; active = false; return; }
}
if ($.support.transition) {
nextItem.addClass(this.settings.direction);
tmp = nextItem.get(0).offsetHeight;
activeItem.addClass(innerDirection);
nextItem.addClass(innerDirection);
element.trigger("beforeSlide", children.length);
element.one($.support.transition.event, function () {
nextItem.removeClass(slider.settings.direction)
.removeClass(innerDirection)
.addClass("active");
activeItem.removeClass("active")
.removeClass(innerDirection);
active = false;
setTimeout(function () {
element.trigger("afterSlide", children.length);
}, 0);
});
} else {
element.trigger("beforeSlide", children.length);
activeItem.removeClass("active");
nextItem.addClass("active");
active = false;
element.trigger("afterSlide", children.length);
}
this.navigate(nextItem);
if (moving) { this.start(); }
};
this.navigate = function (position) {
var index = children.index(position);
$(this.settings.navigator).children().removeClass("active").eq(index).addClass("active");
};
this.to = function (index) {
var activeItem = element.find(".active"),
children = activeItem.parent().children(),
activeIndex = children.index(activeItem),
slider = this;
if (index > (children.length - 1) || index < 0) {
return;
}
if (active) {
return element.one("afterSlide", function () {
slider.to(index);
});
}
if (activeIndex === index) {
return;
}
this.move(index > activeIndex ? "next" : "prev", $(children[index]));
};
this.next = function () {
if (!active) {
if (last) { this.stop(); return; }
this.move("next");
}
};
this.prev = function () {
if (!active) {
if (last) { this.stop(); return; }
this.move("prev");
}
};
this.start = function (force) {
if (!!force) {
setTimeout($.proxy(this.next, this), 10);
}
interval = setInterval($.proxy(this.next, this), this.settings.pause);
running = true;
};
this.stop = function (pause) {
clearInterval(interval);
interval = null;
running = !!pause;
active = false;
};
this.active = function () {
return running;
};
this.moving = function () {
return active;
};
this.navigate(children.filter(".active"));
if (this.settings.clickevents) {
$(this.settings.navigator).on("click", "a", { slider: this }, function (event) {
var activeIndex = children.index(children.filter(".active"));
var index = $(this).parent().children().index($(this));
if (activeIndex !== index) {
event.data.slider.to(index);
}
event.preventDefault();
});
}
if (this.settings.hover) {
var slider = this;
element.add(this.settings.navigator)
.add(element.siblings(".shapes")).hover(function () {
if (element.is(":visible") && !last) { slider.stop(true); }
}, function () {
if (element.is(":visible") && !last) { slider.start(); }
});
}
};
$.fn.slider = function (arg) {
return this.each(function () {
var element = $(this),
data = element.data("slider"),
options = typeof arg === "object" && arg;
if (!data) {
data = new Slider(element, options);
element.data("slider", data);
}
if (typeof arg === "string" && data[arg]) {
data[arg]();
} else if (data.settings.auto && element.is(":visible")) {
data.start();
}
});
};
})(jQuery);
jQuery(function ($) {
"use strict";
if (!$.browser.msie || parseInt($.browser.version, 10) > 8)
return;
var path = "";
var scripts = $("script[src*='script.js']");
if (scripts.length > 0) {
var src = scripts.last().attr('src');
path = src.substr(0, src.indexOf("script.js"));
}
processHeaderMultipleBg(path);
});
var processHeaderMultipleBg = (function ($) {
"use strict";
return (function (path) {
var header = $(".header");
var bgimages = "".split(",");
var bgpositions = "".split(",");
for (var i = bgimages.length - 1; i >= 0; i--) {
var bgimage = $.trim(bgimages[i]);
if (bgimage === "")
continue;
if (path !== "") {
bgimage = bgimage.replace(/(url\(['"]?)/i, "$1" + path);
}
header.append("
");
}
header.css('background-image', "url('images/header.png')".replace(/(url\(['"]?)/i, "$1" + path));
header.css('background-position', "center top");
});
})(jQuery);