Version Description
Download this release
Release Info
Developer | valiano |
Plugin | Unlimited Elements For Elementor (Free Widgets, Addons, Templates) |
Version | 1.4.99 |
Comparing to | |
See all releases |
Code changes from version 1.4.98 to 1.4.99
- assets_libraries/unitegallery/js/unitegallery.js +281 -95
- assets_libraries/unitegallery/js/unitegallery.min.js +3 -3
- assets_libraries/unitegallery/release_log.txt +554 -0
- inc_php/unitecreator_output.class.php +2 -1
- includes.php +1 -1
- provider/core/plugins/unlimited_elements/elementor/assets/uc_editor_admin.js +0 -1
- provider/core/plugins/unlimited_elements/elementor/elementor_integrate.class.php +8 -2
- provider/core/plugins/unlimited_elements/elementor/elementor_widget.class.php +1 -0
- provider/core/plugins/unlimited_elements/settings/general_settings_el.xml +21 -10
- provider/functions_wordpress.class.php +12 -3
- provider/provider_globals.class.php +2 -0
- provider/provider_params_processor.class.php +3 -1
- readme.txt +9 -1
- release_log.txt +7 -0
- unlimited_elements.php +1 -1
assets_libraries/unitegallery/js/unitegallery.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
//
|
2 |
-
|
3 |
|
4 |
//------ ug-common-libraries.js------
|
5 |
|
@@ -287,6 +286,55 @@ function UGFunctions(){
|
|
287 |
|
288 |
this.debugVar = "";
|
289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
this.z__________FULL_SCREEN___________ = function(){}
|
291 |
|
292 |
|
@@ -3825,7 +3873,7 @@ function UGThumbsStrip(){
|
|
3825 |
g_thumbs.setHtmlProperties();
|
3826 |
|
3827 |
initSizeParams();
|
3828 |
-
|
3829 |
fixSize();
|
3830 |
|
3831 |
positionThumbs();
|
@@ -3838,13 +3886,13 @@ function UGThumbsStrip(){
|
|
3838 |
g_touchThumbsControl = new UGTouchThumbsControl();
|
3839 |
g_touchThumbsControl.init(t);
|
3840 |
}
|
3841 |
-
|
3842 |
//init thumbs strip avia control
|
3843 |
if(g_options.strip_control_avia == true){
|
3844 |
g_aviaControl = new UGAviaControl();
|
3845 |
g_aviaControl.init(t);
|
3846 |
}
|
3847 |
-
|
3848 |
checkControlsEnableDisable();
|
3849 |
|
3850 |
g_thumbs.loadThumbsImages();
|
@@ -3873,7 +3921,8 @@ function UGThumbsStrip(){
|
|
3873 |
|
3874 |
if(g_sizes.stripActiveSize < 0)
|
3875 |
g_sizes.stripActiveSize = 0;
|
3876 |
-
|
|
|
3877 |
}
|
3878 |
|
3879 |
|
@@ -4112,11 +4161,11 @@ function UGThumbsStrip(){
|
|
4112 |
}
|
4113 |
|
4114 |
|
4115 |
-
|
4116 |
/**
|
4117 |
* check that the inner strip off the limits position, and reposition it if there is a need
|
4118 |
*/
|
4119 |
function checkAndRepositionInnerStrip(){
|
|
|
4120 |
if(isStripMovingEnabled() == false)
|
4121 |
return(false);
|
4122 |
|
@@ -4272,10 +4321,8 @@ function UGThumbsStrip(){
|
|
4272 |
g_thumbs.destroy();
|
4273 |
}
|
4274 |
|
4275 |
-
|
4276 |
function ____________GETTERS___________(){};
|
4277 |
|
4278 |
-
|
4279 |
/**
|
4280 |
* check if the inner width is more then strip width
|
4281 |
*/
|
@@ -4354,7 +4401,7 @@ function UGThumbsStrip(){
|
|
4354 |
* position inner strip on some pos according the orientation
|
4355 |
*/
|
4356 |
this.positionInnerStrip = function(pos, isAnimate){
|
4357 |
-
|
4358 |
if(isAnimate === undefined)
|
4359 |
var isAnimate = false;
|
4360 |
|
@@ -4601,6 +4648,7 @@ function UGThumbsStrip(){
|
|
4601 |
}
|
4602 |
|
4603 |
|
|
|
4604 |
/**
|
4605 |
* resize the panel according the orientation
|
4606 |
*/
|
@@ -4610,7 +4658,7 @@ function UGThumbsStrip(){
|
|
4610 |
|
4611 |
g_objStrip.width(newSize);
|
4612 |
g_sizes.stripActiveSize = newSize - g_options.strip_padding_left - g_options.strip_padding_right;
|
4613 |
-
|
4614 |
}else{
|
4615 |
g_objStrip.height(newSize);
|
4616 |
g_sizes.stripActiveSize = newSize - g_options.strip_padding_top - g_options.strip_padding_bottom;
|
@@ -4625,6 +4673,9 @@ function UGThumbsStrip(){
|
|
4625 |
alignInnerStrip();
|
4626 |
|
4627 |
scrollToSelectedThumb();
|
|
|
|
|
|
|
4628 |
}
|
4629 |
|
4630 |
|
@@ -12404,7 +12455,8 @@ function UGAviaControl(){
|
|
12404 |
strip_finalPos:0,
|
12405 |
handle_timeout:"",
|
12406 |
isStripMoving:false,
|
12407 |
-
isControlEnabled: true
|
|
|
12408 |
};
|
12409 |
|
12410 |
|
@@ -12422,12 +12474,31 @@ function UGAviaControl(){
|
|
12422 |
g_temp.isControlEnabled = false;
|
12423 |
}
|
12424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12425 |
/**
|
12426 |
* init function for avia controls
|
12427 |
*/
|
12428 |
this.init = function(objParent){
|
12429 |
-
g_parent = objParent;
|
12430 |
|
|
|
|
|
12431 |
g_objects = objParent.getObjects();
|
12432 |
|
12433 |
g_gallery = g_objects.g_gallery;
|
@@ -12436,8 +12507,21 @@ function UGAviaControl(){
|
|
12436 |
g_objStripInner = g_objects.g_objStripInner;
|
12437 |
g_options = g_objects.g_options;
|
12438 |
g_isVertical = g_objects.isVertical;
|
12439 |
-
|
12440 |
initEvents();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12441 |
}
|
12442 |
|
12443 |
/**
|
@@ -12451,6 +12535,35 @@ function UGAviaControl(){
|
|
12451 |
return(event.pageY);
|
12452 |
}
|
12453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12454 |
/**
|
12455 |
* handle avia strip control event on body mouse move
|
12456 |
*/
|
@@ -12467,30 +12580,7 @@ function UGAviaControl(){
|
|
12467 |
});
|
12468 |
|
12469 |
//on body move
|
12470 |
-
jQuery("body").mousemove(
|
12471 |
-
|
12472 |
-
if(g_temp.isControlEnabled == false)
|
12473 |
-
return(true);
|
12474 |
-
|
12475 |
-
//protection for touch devices, disable the avia events
|
12476 |
-
if(g_temp.touchEnabled == true){
|
12477 |
-
jQuery("body").off("mousemove");
|
12478 |
-
return(true);
|
12479 |
-
}
|
12480 |
-
|
12481 |
-
g_temp.isMouseInsideStrip = g_objStrip.ismouseover();
|
12482 |
-
var strip_touch_active = g_parent.isTouchMotionActive();
|
12483 |
-
|
12484 |
-
if(g_temp.isMouseInsideStrip == true && strip_touch_active == false){
|
12485 |
-
|
12486 |
-
var mousePos = getMousePos(event);
|
12487 |
-
|
12488 |
-
moveStripToMousePosition(mousePos);
|
12489 |
-
}else{
|
12490 |
-
stopStripMovingLoop();
|
12491 |
-
}
|
12492 |
-
|
12493 |
-
});
|
12494 |
|
12495 |
}
|
12496 |
|
@@ -12599,6 +12689,8 @@ function UGAviaControl(){
|
|
12599 |
return(false);
|
12600 |
}
|
12601 |
|
|
|
|
|
12602 |
var innerPos = g_parent.getInnerStripPos();
|
12603 |
|
12604 |
if(Math.floor(innerPos) == Math.floor(g_temp.strip_finalPos)){
|
@@ -12613,7 +12705,7 @@ function UGAviaControl(){
|
|
12613 |
dpos = diff;
|
12614 |
}
|
12615 |
else{
|
12616 |
-
|
12617 |
dpos = diff / 4;
|
12618 |
if(dpos > 0 && dpos < 1)
|
12619 |
dpos = 1;
|
@@ -12621,7 +12713,13 @@ function UGAviaControl(){
|
|
12621 |
|
12622 |
if(g_temp.strip_finalPos < innerPos)
|
12623 |
dpos = dpos * -1;
|
12624 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12625 |
var newPos = innerPos + dpos;
|
12626 |
|
12627 |
g_parent.positionInnerStrip(newPos);
|
@@ -12638,7 +12736,7 @@ function UGAviaControl(){
|
|
12638 |
return(false);
|
12639 |
|
12640 |
g_temp.isStripMoving = true;
|
12641 |
-
g_temp.handle_timeout = setInterval(moveStripStep,10);
|
12642 |
}
|
12643 |
|
12644 |
/**
|
@@ -12680,10 +12778,11 @@ function UGAviaControl(){
|
|
12680 |
|
12681 |
g_temp.is_strip_moving = true;
|
12682 |
g_temp.strip_finalPos = innerPos;
|
12683 |
-
|
12684 |
startStripMovingLoop();
|
12685 |
}
|
12686 |
|
|
|
12687 |
}
|
12688 |
//------ ug-slider.js------
|
12689 |
/**
|
@@ -14936,10 +15035,10 @@ function UGSlider(){
|
|
14936 |
setVideoPlayerPosition();
|
14937 |
|
14938 |
g_objVideoPlayer.show();
|
14939 |
-
|
14940 |
switch(objItem.type){
|
14941 |
case "youtube":
|
14942 |
-
g_objVideoPlayer.playYoutube(objItem.videoid);
|
14943 |
break;
|
14944 |
case "vimeo":
|
14945 |
g_objVideoPlayer.playVimeo(objItem.videoid);
|
@@ -18193,10 +18292,10 @@ function UGWistiaAPI(){
|
|
18193 |
/**
|
18194 |
* put the vimeo video
|
18195 |
*/
|
18196 |
-
this.putVideo = function(divID, videoID, width, height, isAutoplay){
|
18197 |
|
18198 |
if(isWistiaActive()){
|
18199 |
-
putVideoActually(divID, videoID, width, height, isAutoplay);
|
18200 |
return(true);
|
18201 |
}
|
18202 |
|
@@ -18206,7 +18305,7 @@ function UGWistiaAPI(){
|
|
18206 |
g_intHandle = setInterval(function(){
|
18207 |
|
18208 |
if(isWistiaActive()){
|
18209 |
-
putVideoActually(divID, videoID, width, height, isAutoplay);
|
18210 |
clearInterval(g_intHandle);
|
18211 |
}
|
18212 |
|
@@ -18844,6 +18943,7 @@ function UGYoutubeAPI(){
|
|
18844 |
this.isAPILoaded = false;
|
18845 |
var t = this, g_player = null, g_intHandle, g_isPlayerReady = false;
|
18846 |
var g_objThis = jQuery(this), g_prevState = -1, g_lastContainerID; //unstarted
|
|
|
18847 |
|
18848 |
var g_options = {
|
18849 |
video_youtube_showinfo: true
|
@@ -18859,23 +18959,28 @@ function UGYoutubeAPI(){
|
|
18859 |
/**
|
18860 |
* actually put the video
|
18861 |
*/
|
18862 |
-
function putVideoActually(divID, videoID, width, height, isAutoplay){
|
18863 |
|
18864 |
if(g_player && g_isPlayerReady){
|
18865 |
g_player.destroy();
|
18866 |
}
|
18867 |
-
|
18868 |
var playerVars = {
|
18869 |
-
controls:
|
18870 |
-
showinfo:g_options.video_youtube_showinfo,
|
|
|
18871 |
rel:0
|
18872 |
};
|
18873 |
-
|
18874 |
if(isAutoplay === true)
|
18875 |
playerVars.autoplay = 1;
|
18876 |
-
|
|
|
|
|
|
|
|
|
18877 |
g_isPlayerReady = false;
|
18878 |
-
|
18879 |
g_player = new YT.Player(divID, {
|
18880 |
height: height,
|
18881 |
width: width,
|
@@ -18914,10 +19019,10 @@ function UGYoutubeAPI(){
|
|
18914 |
/**
|
18915 |
* put the youtube video
|
18916 |
*/
|
18917 |
-
this.putVideo = function(divID, videoID, width, height, isAutoplay){
|
18918 |
|
18919 |
if(isYTActive()){
|
18920 |
-
putVideoActually(divID, videoID, width, height, isAutoplay);
|
18921 |
return(true);
|
18922 |
}
|
18923 |
|
@@ -18926,7 +19031,7 @@ function UGYoutubeAPI(){
|
|
18926 |
g_intHandle = setInterval(function(){
|
18927 |
|
18928 |
if(isYTActive()){
|
18929 |
-
putVideoActually(divID, videoID, width, height, isAutoplay);
|
18930 |
clearInterval(g_intHandle);
|
18931 |
}
|
18932 |
|
@@ -19493,11 +19598,14 @@ function UGVideoPlayer(){
|
|
19493 |
/**
|
19494 |
* play youtube inside the video, isAutoplay - true by default
|
19495 |
*/
|
19496 |
-
this.playYoutube = function(videoID, isAutoplay){
|
19497 |
-
|
19498 |
if(typeof isAutoplay == "undefined")
|
19499 |
var isAutoplay = true;
|
19500 |
|
|
|
|
|
|
|
19501 |
stopAndHidePlayers("youtube");
|
19502 |
|
19503 |
g_objYoutube.show();
|
@@ -19506,11 +19614,14 @@ function UGVideoPlayer(){
|
|
19506 |
if(objYoutubeInner.length == 0)
|
19507 |
g_objYoutube.append("<div id='"+g_temp.youtubeInnerID+"'></div>");
|
19508 |
|
|
|
|
|
|
|
19509 |
|
19510 |
if(g_youtubeAPI.isPlayerReady() == true && g_temp.standAloneMode == true)
|
19511 |
g_youtubeAPI.changeVideo(videoID, isAutoplay);
|
19512 |
else{
|
19513 |
-
g_youtubeAPI.putVideo(g_temp.youtubeInnerID, videoID, "100%", "100%", isAutoplay);
|
19514 |
}
|
19515 |
|
19516 |
g_activePlayerType = "youtube";
|
@@ -19634,9 +19745,9 @@ var g_ugWistiaAPI = new UGWistiaAPI();
|
|
19634 |
//save the gallery to common galleries array
|
19635 |
|
19636 |
if(typeof window.ugArrGalleriesObjects == "undefined")
|
19637 |
-
window.ugArrGalleriesObjects =
|
19638 |
|
19639 |
-
window.ugArrGalleriesObjects
|
19640 |
|
19641 |
var api = new UG_API(objGallery);
|
19642 |
|
@@ -20228,16 +20339,32 @@ function UniteGalleryMain(){
|
|
20228 |
* fill item by html child
|
20229 |
*/
|
20230 |
function fillItemByChild(objChild){
|
20231 |
-
|
20232 |
var isMobile = t.isMobileMode();
|
20233 |
|
20234 |
var tagname = objChild.prop("tagName").toLowerCase();
|
20235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20236 |
//handle link wrapper
|
20237 |
var itemLink = "";
|
20238 |
if(tagname == "a"){
|
20239 |
itemLink = objChild.attr("href");
|
20240 |
-
objChild = objChild.children();
|
20241 |
var tagname = objChild.prop("tagName").toLowerCase();
|
20242 |
}
|
20243 |
|
@@ -20248,10 +20375,14 @@ function UniteGalleryMain(){
|
|
20248 |
var objItem = {};
|
20249 |
objItem.type = itemType;
|
20250 |
|
|
|
20251 |
if(tagname == "img"){
|
20252 |
|
20253 |
//protection agains lasy load
|
20254 |
var lasyLoadSrc = objChild.data("lazyload-src");
|
|
|
|
|
|
|
20255 |
if(lasyLoadSrc && lasyLoadSrc != ""){
|
20256 |
objChild.attr("src", lasyLoadSrc);
|
20257 |
jQuery.removeData(objChild, "lazyload-src");
|
@@ -20260,6 +20391,7 @@ function UniteGalleryMain(){
|
|
20260 |
//src is thumb
|
20261 |
var urlImage = objChild.data("image");
|
20262 |
var urlThumb = objChild.data("thumb");
|
|
|
20263 |
|
20264 |
if(typeof(urlImage) == "undefined")
|
20265 |
urlImage = null;
|
@@ -20283,14 +20415,16 @@ function UniteGalleryMain(){
|
|
20283 |
|
20284 |
objItem.urlThumb = urlThumb;
|
20285 |
objItem.urlImage = urlImage;
|
20286 |
-
|
20287 |
objItem.title = objChild.attr("alt");
|
|
|
|
|
20288 |
|
20289 |
//always set thumb image to object
|
20290 |
objItem.objThumbImage = objChild;
|
20291 |
|
20292 |
objItem.objThumbImage.attr("src", objItem.urlThumb);
|
20293 |
-
|
20294 |
}else{
|
20295 |
|
20296 |
if(itemType == "image"){
|
@@ -20306,6 +20440,7 @@ function UniteGalleryMain(){
|
|
20306 |
objItem.urlImage = objChild.data("image");
|
20307 |
}
|
20308 |
|
|
|
20309 |
//trace(isMobile);
|
20310 |
|
20311 |
//check mobile version images
|
@@ -20366,8 +20501,11 @@ function UniteGalleryMain(){
|
|
20366 |
|
20367 |
switch(objItem.type){
|
20368 |
case "youtube":
|
20369 |
-
|
20370 |
-
|
|
|
|
|
|
|
20371 |
if(isImageMissing || isThumbMissing){
|
20372 |
|
20373 |
var objImages = g_ugYoutubeAPI.getVideoImages(objItem.videoid);
|
@@ -20459,8 +20597,14 @@ function UniteGalleryMain(){
|
|
20459 |
|
20460 |
for(var i=0;i<arrChildren.length;i++){
|
20461 |
var objChild = jQuery(arrChildren[i]);
|
20462 |
-
|
20463 |
var objItem = fillItemByChild(objChild);
|
|
|
|
|
|
|
|
|
|
|
|
|
20464 |
numIndex = g_arrItems.length;
|
20465 |
objItem.index = numIndex;
|
20466 |
|
@@ -20788,17 +20932,68 @@ function UniteGalleryMain(){
|
|
20788 |
|
20789 |
|
20790 |
/**
|
20791 |
-
* get
|
20792 |
*/
|
20793 |
-
function
|
20794 |
|
20795 |
-
|
20796 |
-
trace(window.ugArrGalleriesObjects);
|
20797 |
|
20798 |
-
|
|
|
20799 |
|
20800 |
-
|
|
|
|
|
|
|
|
|
20801 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20802 |
}
|
20803 |
|
20804 |
|
@@ -20818,16 +21013,18 @@ function UniteGalleryMain(){
|
|
20818 |
|
20819 |
switch(keyCode){
|
20820 |
case 39: //right key
|
20821 |
-
var isInsideScreen = t.isGalleryInsideScreen();
|
20822 |
|
20823 |
-
|
|
|
|
|
20824 |
t.nextItem();
|
20825 |
wasAction = true;
|
20826 |
}
|
20827 |
break;
|
20828 |
case 37: //left key
|
20829 |
-
var
|
20830 |
-
|
|
|
20831 |
t.prevItem();
|
20832 |
wasAction = true;
|
20833 |
}
|
@@ -20838,11 +21035,8 @@ function UniteGalleryMain(){
|
|
20838 |
}
|
20839 |
|
20840 |
//only first page gallery affected
|
20841 |
-
|
20842 |
if(wasAction == true){
|
20843 |
-
|
20844 |
-
//var isStopEvent = onKeyPress_isStopEventScanAllPageGalleries();
|
20845 |
-
|
20846 |
event.preventDefault();
|
20847 |
event.stopPropagation();
|
20848 |
event.stopImmediatePropagation();
|
@@ -21944,9 +22138,12 @@ function UniteGalleryMain(){
|
|
21944 |
*/
|
21945 |
this.isGalleryInsideScreen = function(){
|
21946 |
|
|
|
|
|
|
|
21947 |
if(!g_objSlider)
|
21948 |
return(false);
|
21949 |
-
|
21950 |
var isInside = g_functions.isElementInsideScreen(g_objWrapper);
|
21951 |
|
21952 |
return(isInside);
|
@@ -22039,17 +22236,6 @@ function UniteGalleryMain(){
|
|
22039 |
|
22040 |
}
|
22041 |
|
22042 |
-
/**
|
22043 |
-
* check if the lightbox opened
|
22044 |
-
*/
|
22045 |
-
this.isLightboxOpened = function(){
|
22046 |
-
|
22047 |
-
if(!g_objLightbox)
|
22048 |
-
return(false);
|
22049 |
-
|
22050 |
-
|
22051 |
-
|
22052 |
-
}
|
22053 |
|
22054 |
this.__________EXTERNAL_EVENTS_______ = function(){};
|
22055 |
|
1 |
+
//Unite Gallery, Version: 1.7.56, released 20 January 2022
|
|
|
2 |
|
3 |
//------ ug-common-libraries.js------
|
4 |
|
286 |
|
287 |
this.debugVar = "";
|
288 |
|
289 |
+
this.getvalopt = {
|
290 |
+
FORCE_BOOLEAN: "force_boolean",
|
291 |
+
FORCE_NUMERIC: "force_numeric",
|
292 |
+
TRIM: "trim"
|
293 |
+
};
|
294 |
+
|
295 |
+
this.z__________GENERAL___________ = function(){}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* get object property
|
299 |
+
*/
|
300 |
+
this.getVal = function(obj, name, defaultValue, opt){
|
301 |
+
|
302 |
+
if(!defaultValue)
|
303 |
+
var defaultValue = "";
|
304 |
+
|
305 |
+
var val = "";
|
306 |
+
|
307 |
+
if(!obj || typeof obj != "object")
|
308 |
+
val = defaultValue;
|
309 |
+
else if(obj.hasOwnProperty(name) == false){
|
310 |
+
val = defaultValue;
|
311 |
+
}else{
|
312 |
+
val = obj[name];
|
313 |
+
}
|
314 |
+
|
315 |
+
//sanitize
|
316 |
+
|
317 |
+
switch(opt){
|
318 |
+
case t.getvalopt.FORCE_BOOLEAN:
|
319 |
+
val = t.strToBool(val);
|
320 |
+
break;
|
321 |
+
case t.getvalopt.TRIM:
|
322 |
+
val = String(val);
|
323 |
+
val = jQuery.trim(val);
|
324 |
+
break;
|
325 |
+
case t.getvalopt.FORCE_NUMERIC:
|
326 |
+
val = jQuery.trim(val);
|
327 |
+
if(typeof val == "string"){
|
328 |
+
val.replace("px","");
|
329 |
+
val = Number(val);
|
330 |
+
}
|
331 |
+
break;
|
332 |
+
}
|
333 |
+
|
334 |
+
return(val);
|
335 |
+
}
|
336 |
+
|
337 |
+
|
338 |
this.z__________FULL_SCREEN___________ = function(){}
|
339 |
|
340 |
|
3873 |
g_thumbs.setHtmlProperties();
|
3874 |
|
3875 |
initSizeParams();
|
3876 |
+
|
3877 |
fixSize();
|
3878 |
|
3879 |
positionThumbs();
|
3886 |
g_touchThumbsControl = new UGTouchThumbsControl();
|
3887 |
g_touchThumbsControl.init(t);
|
3888 |
}
|
3889 |
+
|
3890 |
//init thumbs strip avia control
|
3891 |
if(g_options.strip_control_avia == true){
|
3892 |
g_aviaControl = new UGAviaControl();
|
3893 |
g_aviaControl.init(t);
|
3894 |
}
|
3895 |
+
|
3896 |
checkControlsEnableDisable();
|
3897 |
|
3898 |
g_thumbs.loadThumbsImages();
|
3921 |
|
3922 |
if(g_sizes.stripActiveSize < 0)
|
3923 |
g_sizes.stripActiveSize = 0;
|
3924 |
+
|
3925 |
+
|
3926 |
}
|
3927 |
|
3928 |
|
4161 |
}
|
4162 |
|
4163 |
|
|
|
4164 |
/**
|
4165 |
* check that the inner strip off the limits position, and reposition it if there is a need
|
4166 |
*/
|
4167 |
function checkAndRepositionInnerStrip(){
|
4168 |
+
|
4169 |
if(isStripMovingEnabled() == false)
|
4170 |
return(false);
|
4171 |
|
4321 |
g_thumbs.destroy();
|
4322 |
}
|
4323 |
|
|
|
4324 |
function ____________GETTERS___________(){};
|
4325 |
|
|
|
4326 |
/**
|
4327 |
* check if the inner width is more then strip width
|
4328 |
*/
|
4401 |
* position inner strip on some pos according the orientation
|
4402 |
*/
|
4403 |
this.positionInnerStrip = function(pos, isAnimate){
|
4404 |
+
|
4405 |
if(isAnimate === undefined)
|
4406 |
var isAnimate = false;
|
4407 |
|
4648 |
}
|
4649 |
|
4650 |
|
4651 |
+
|
4652 |
/**
|
4653 |
* resize the panel according the orientation
|
4654 |
*/
|
4658 |
|
4659 |
g_objStrip.width(newSize);
|
4660 |
g_sizes.stripActiveSize = newSize - g_options.strip_padding_left - g_options.strip_padding_right;
|
4661 |
+
|
4662 |
}else{
|
4663 |
g_objStrip.height(newSize);
|
4664 |
g_sizes.stripActiveSize = newSize - g_options.strip_padding_top - g_options.strip_padding_bottom;
|
4673 |
alignInnerStrip();
|
4674 |
|
4675 |
scrollToSelectedThumb();
|
4676 |
+
|
4677 |
+
if(g_aviaControl)
|
4678 |
+
g_aviaControl.onResize();
|
4679 |
}
|
4680 |
|
4681 |
|
12455 |
strip_finalPos:0,
|
12456 |
handle_timeout:"",
|
12457 |
isStripMoving:false,
|
12458 |
+
isControlEnabled: true,
|
12459 |
+
maxDpos:1000 //max speed, lower - slower
|
12460 |
};
|
12461 |
|
12462 |
|
12474 |
g_temp.isControlEnabled = false;
|
12475 |
}
|
12476 |
|
12477 |
+
/**
|
12478 |
+
* set scroll avia type - sides only, full data determine on size
|
12479 |
+
*/
|
12480 |
+
function setScrollType(){
|
12481 |
+
|
12482 |
+
//trace("set scroll type");
|
12483 |
+
|
12484 |
+
}
|
12485 |
+
|
12486 |
+
/**
|
12487 |
+
* on resize function
|
12488 |
+
*/
|
12489 |
+
this.onResize = function(){
|
12490 |
+
|
12491 |
+
setScrollType();
|
12492 |
+
}
|
12493 |
+
|
12494 |
+
|
12495 |
/**
|
12496 |
* init function for avia controls
|
12497 |
*/
|
12498 |
this.init = function(objParent){
|
|
|
12499 |
|
12500 |
+
g_parent = objParent;
|
12501 |
+
|
12502 |
g_objects = objParent.getObjects();
|
12503 |
|
12504 |
g_gallery = g_objects.g_gallery;
|
12507 |
g_objStripInner = g_objects.g_objStripInner;
|
12508 |
g_options = g_objects.g_options;
|
12509 |
g_isVertical = g_objects.isVertical;
|
12510 |
+
|
12511 |
initEvents();
|
12512 |
+
|
12513 |
+
setScrollType();
|
12514 |
+
}
|
12515 |
+
|
12516 |
+
/**
|
12517 |
+
* check if sides only scroll to position mode
|
12518 |
+
*/
|
12519 |
+
function isInsideSlideArea(){
|
12520 |
+
|
12521 |
+
var objSizes = g_parent.getSizes();
|
12522 |
+
|
12523 |
+
trace(objSizes);
|
12524 |
+
|
12525 |
}
|
12526 |
|
12527 |
/**
|
12535 |
return(event.pageY);
|
12536 |
}
|
12537 |
|
12538 |
+
/**
|
12539 |
+
* on mouse move
|
12540 |
+
*/
|
12541 |
+
function onMouseMove(event){
|
12542 |
+
|
12543 |
+
if(g_temp.isControlEnabled == false)
|
12544 |
+
return(true);
|
12545 |
+
|
12546 |
+
//protection for touch devices, disable the avia events
|
12547 |
+
if(g_temp.touchEnabled == true){
|
12548 |
+
jQuery("body").off("mousemove");
|
12549 |
+
return(true);
|
12550 |
+
}
|
12551 |
+
|
12552 |
+
g_temp.isMouseInsideStrip = g_objStrip.ismouseover();
|
12553 |
+
|
12554 |
+
var strip_touch_active = g_parent.isTouchMotionActive();
|
12555 |
+
|
12556 |
+
if(g_temp.isMouseInsideStrip == true && strip_touch_active == false){
|
12557 |
+
|
12558 |
+
var mousePos = getMousePos(event);
|
12559 |
+
|
12560 |
+
moveStripToMousePosition(mousePos);
|
12561 |
+
}else{
|
12562 |
+
stopStripMovingLoop();
|
12563 |
+
}
|
12564 |
+
|
12565 |
+
}
|
12566 |
+
|
12567 |
/**
|
12568 |
* handle avia strip control event on body mouse move
|
12569 |
*/
|
12580 |
});
|
12581 |
|
12582 |
//on body move
|
12583 |
+
jQuery("body").mousemove(onMouseMove);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12584 |
|
12585 |
}
|
12586 |
|
12689 |
return(false);
|
12690 |
}
|
12691 |
|
12692 |
+
var maxDpos = g_temp.maxDpos;
|
12693 |
+
|
12694 |
var innerPos = g_parent.getInnerStripPos();
|
12695 |
|
12696 |
if(Math.floor(innerPos) == Math.floor(g_temp.strip_finalPos)){
|
12705 |
dpos = diff;
|
12706 |
}
|
12707 |
else{
|
12708 |
+
|
12709 |
dpos = diff / 4;
|
12710 |
if(dpos > 0 && dpos < 1)
|
12711 |
dpos = 1;
|
12713 |
|
12714 |
if(g_temp.strip_finalPos < innerPos)
|
12715 |
dpos = dpos * -1;
|
12716 |
+
|
12717 |
+
if(dpos > maxDpos)
|
12718 |
+
dpos = maxDpos;
|
12719 |
+
|
12720 |
+
if(dpos < -maxDpos)
|
12721 |
+
dpos = -maxDpos;
|
12722 |
+
|
12723 |
var newPos = innerPos + dpos;
|
12724 |
|
12725 |
g_parent.positionInnerStrip(newPos);
|
12736 |
return(false);
|
12737 |
|
12738 |
g_temp.isStripMoving = true;
|
12739 |
+
g_temp.handle_timeout = setInterval(moveStripStep, 10);
|
12740 |
}
|
12741 |
|
12742 |
/**
|
12778 |
|
12779 |
g_temp.is_strip_moving = true;
|
12780 |
g_temp.strip_finalPos = innerPos;
|
12781 |
+
|
12782 |
startStripMovingLoop();
|
12783 |
}
|
12784 |
|
12785 |
+
|
12786 |
}
|
12787 |
//------ ug-slider.js------
|
12788 |
/**
|
15035 |
setVideoPlayerPosition();
|
15036 |
|
15037 |
g_objVideoPlayer.show();
|
15038 |
+
|
15039 |
switch(objItem.type){
|
15040 |
case "youtube":
|
15041 |
+
g_objVideoPlayer.playYoutube(objItem.videoid, true, objItem.video_start);
|
15042 |
break;
|
15043 |
case "vimeo":
|
15044 |
g_objVideoPlayer.playVimeo(objItem.videoid);
|
18292 |
/**
|
18293 |
* put the vimeo video
|
18294 |
*/
|
18295 |
+
this.putVideo = function(divID, videoID, width, height, isAutoplay, addOptions){
|
18296 |
|
18297 |
if(isWistiaActive()){
|
18298 |
+
putVideoActually(divID, videoID, width, height, isAutoplay, addOptions);
|
18299 |
return(true);
|
18300 |
}
|
18301 |
|
18305 |
g_intHandle = setInterval(function(){
|
18306 |
|
18307 |
if(isWistiaActive()){
|
18308 |
+
putVideoActually(divID, videoID, width, height, isAutoplay, addOptions);
|
18309 |
clearInterval(g_intHandle);
|
18310 |
}
|
18311 |
|
18943 |
this.isAPILoaded = false;
|
18944 |
var t = this, g_player = null, g_intHandle, g_isPlayerReady = false;
|
18945 |
var g_objThis = jQuery(this), g_prevState = -1, g_lastContainerID; //unstarted
|
18946 |
+
var g_functions = new UGFunctions();
|
18947 |
|
18948 |
var g_options = {
|
18949 |
video_youtube_showinfo: true
|
18959 |
/**
|
18960 |
* actually put the video
|
18961 |
*/
|
18962 |
+
function putVideoActually(divID, videoID, width, height, isAutoplay, addOptions){
|
18963 |
|
18964 |
if(g_player && g_isPlayerReady){
|
18965 |
g_player.destroy();
|
18966 |
}
|
18967 |
+
|
18968 |
var playerVars = {
|
18969 |
+
controls:1,
|
18970 |
+
showinfo:g_options.video_youtube_showinfo,
|
18971 |
+
start:0,
|
18972 |
rel:0
|
18973 |
};
|
18974 |
+
|
18975 |
if(isAutoplay === true)
|
18976 |
playerVars.autoplay = 1;
|
18977 |
+
|
18978 |
+
var start = g_functions.getVal(addOptions, "start");
|
18979 |
+
if(start && jQuery.isNumeric(start))
|
18980 |
+
playerVars.start = start;
|
18981 |
+
|
18982 |
g_isPlayerReady = false;
|
18983 |
+
|
18984 |
g_player = new YT.Player(divID, {
|
18985 |
height: height,
|
18986 |
width: width,
|
19019 |
/**
|
19020 |
* put the youtube video
|
19021 |
*/
|
19022 |
+
this.putVideo = function(divID, videoID, width, height, isAutoplay, addOptions){
|
19023 |
|
19024 |
if(isYTActive()){
|
19025 |
+
putVideoActually(divID, videoID, width, height, isAutoplay, addOptions);
|
19026 |
return(true);
|
19027 |
}
|
19028 |
|
19031 |
g_intHandle = setInterval(function(){
|
19032 |
|
19033 |
if(isYTActive()){
|
19034 |
+
putVideoActually(divID, videoID, width, height, isAutoplay, addOptions);
|
19035 |
clearInterval(g_intHandle);
|
19036 |
}
|
19037 |
|
19598 |
/**
|
19599 |
* play youtube inside the video, isAutoplay - true by default
|
19600 |
*/
|
19601 |
+
this.playYoutube = function(videoID, isAutoplay, startSeconds){
|
19602 |
+
|
19603 |
if(typeof isAutoplay == "undefined")
|
19604 |
var isAutoplay = true;
|
19605 |
|
19606 |
+
if(!startSeconds)
|
19607 |
+
var startSeconds = null;
|
19608 |
+
|
19609 |
stopAndHidePlayers("youtube");
|
19610 |
|
19611 |
g_objYoutube.show();
|
19614 |
if(objYoutubeInner.length == 0)
|
19615 |
g_objYoutube.append("<div id='"+g_temp.youtubeInnerID+"'></div>");
|
19616 |
|
19617 |
+
var addOptions = {};
|
19618 |
+
if(startSeconds)
|
19619 |
+
addOptions.start = startSeconds;
|
19620 |
|
19621 |
if(g_youtubeAPI.isPlayerReady() == true && g_temp.standAloneMode == true)
|
19622 |
g_youtubeAPI.changeVideo(videoID, isAutoplay);
|
19623 |
else{
|
19624 |
+
g_youtubeAPI.putVideo(g_temp.youtubeInnerID, videoID, "100%", "100%", isAutoplay, addOptions);
|
19625 |
}
|
19626 |
|
19627 |
g_activePlayerType = "youtube";
|
19745 |
//save the gallery to common galleries array
|
19746 |
|
19747 |
if(typeof window.ugArrGalleriesObjects == "undefined")
|
19748 |
+
window.ugArrGalleriesObjects = [];
|
19749 |
|
19750 |
+
window.ugArrGalleriesObjects.push(objGallery);
|
19751 |
|
19752 |
var api = new UG_API(objGallery);
|
19753 |
|
20339 |
* fill item by html child
|
20340 |
*/
|
20341 |
function fillItemByChild(objChild){
|
20342 |
+
|
20343 |
var isMobile = t.isMobileMode();
|
20344 |
|
20345 |
var tagname = objChild.prop("tagName").toLowerCase();
|
20346 |
|
20347 |
+
if(tagname == "noscript")
|
20348 |
+
return(null);
|
20349 |
+
|
20350 |
+
if(tagname == "picture"){
|
20351 |
+
var objImage = objChild.find("img");
|
20352 |
+
if(objImage.length == 0)
|
20353 |
+
return(null);
|
20354 |
+
|
20355 |
+
objChild = objImage;
|
20356 |
+
tagname = "img";
|
20357 |
+
}
|
20358 |
+
|
20359 |
+
var srcLazy = objChild.data("lazy-src");
|
20360 |
+
if(srcLazy)
|
20361 |
+
objChild.attr("src", srcLazy);
|
20362 |
+
|
20363 |
//handle link wrapper
|
20364 |
var itemLink = "";
|
20365 |
if(tagname == "a"){
|
20366 |
itemLink = objChild.attr("href");
|
20367 |
+
objChild = objChild.children("img:first-child");
|
20368 |
var tagname = objChild.prop("tagName").toLowerCase();
|
20369 |
}
|
20370 |
|
20375 |
var objItem = {};
|
20376 |
objItem.type = itemType;
|
20377 |
|
20378 |
+
|
20379 |
if(tagname == "img"){
|
20380 |
|
20381 |
//protection agains lasy load
|
20382 |
var lasyLoadSrc = objChild.data("lazyload-src");
|
20383 |
+
if(!lasyLoadSrc)
|
20384 |
+
var lasyLoadSrc = objChild.data("lazy-src");
|
20385 |
+
|
20386 |
if(lasyLoadSrc && lasyLoadSrc != ""){
|
20387 |
objChild.attr("src", lasyLoadSrc);
|
20388 |
jQuery.removeData(objChild, "lazyload-src");
|
20391 |
//src is thumb
|
20392 |
var urlImage = objChild.data("image");
|
20393 |
var urlThumb = objChild.data("thumb");
|
20394 |
+
var titleFromData = objChild.data("title");
|
20395 |
|
20396 |
if(typeof(urlImage) == "undefined")
|
20397 |
urlImage = null;
|
20415 |
|
20416 |
objItem.urlThumb = urlThumb;
|
20417 |
objItem.urlImage = urlImage;
|
20418 |
+
|
20419 |
objItem.title = objChild.attr("alt");
|
20420 |
+
if(titleFromData)
|
20421 |
+
objItem.title = titleFromData;
|
20422 |
|
20423 |
//always set thumb image to object
|
20424 |
objItem.objThumbImage = objChild;
|
20425 |
|
20426 |
objItem.objThumbImage.attr("src", objItem.urlThumb);
|
20427 |
+
|
20428 |
}else{
|
20429 |
|
20430 |
if(itemType == "image"){
|
20440 |
objItem.urlImage = objChild.data("image");
|
20441 |
}
|
20442 |
|
20443 |
+
|
20444 |
//trace(isMobile);
|
20445 |
|
20446 |
//check mobile version images
|
20501 |
|
20502 |
switch(objItem.type){
|
20503 |
case "youtube":
|
20504 |
+
|
20505 |
+
objItem.videoid = objChild.data("videoid");
|
20506 |
+
|
20507 |
+
objItem.video_start = objChild.data("start");
|
20508 |
+
|
20509 |
if(isImageMissing || isThumbMissing){
|
20510 |
|
20511 |
var objImages = g_ugYoutubeAPI.getVideoImages(objItem.videoid);
|
20597 |
|
20598 |
for(var i=0;i<arrChildren.length;i++){
|
20599 |
var objChild = jQuery(arrChildren[i]);
|
20600 |
+
|
20601 |
var objItem = fillItemByChild(objChild);
|
20602 |
+
|
20603 |
+
if(objItem === null){
|
20604 |
+
objChild.remove();
|
20605 |
+
continue;
|
20606 |
+
}
|
20607 |
+
|
20608 |
numIndex = g_arrItems.length;
|
20609 |
objItem.index = numIndex;
|
20610 |
|
20932 |
|
20933 |
|
20934 |
/**
|
20935 |
+
* get keypress score
|
20936 |
*/
|
20937 |
+
this.getKeyPressScore = function(){
|
20938 |
|
20939 |
+
var isInsideScreen = t.isGalleryInsideScreen();
|
|
|
20940 |
|
20941 |
+
if(isInsideScreen)
|
20942 |
+
return(1);
|
20943 |
|
20944 |
+
if(g_objLightbox){
|
20945 |
+
var isLightboxOpened = g_objLightbox.isOpened();
|
20946 |
+
if(isLightboxOpened == true)
|
20947 |
+
return(2);
|
20948 |
+
}
|
20949 |
|
20950 |
+
return(0);
|
20951 |
+
}
|
20952 |
+
|
20953 |
+
|
20954 |
+
/**
|
20955 |
+
* get gallery id
|
20956 |
+
*/
|
20957 |
+
this.getGalleryID = function(){
|
20958 |
+
|
20959 |
+
return(g_galleryID);
|
20960 |
+
}
|
20961 |
+
|
20962 |
+
/**
|
20963 |
+
* decide if it's the right gallery for key action
|
20964 |
+
*/
|
20965 |
+
function isThisGalleryForKeyAction(){
|
20966 |
+
|
20967 |
+
if(!window.ugArrGalleriesObjects)
|
20968 |
+
return(true);
|
20969 |
+
|
20970 |
+
var numGalleries = window.ugArrGalleriesObjects.length;
|
20971 |
+
|
20972 |
+
if(window.ugArrGalleriesObjects.length == 1)
|
20973 |
+
return(true);
|
20974 |
+
|
20975 |
+
var maxScore = 0;
|
20976 |
+
var currentScore;
|
20977 |
+
|
20978 |
+
var currentGalleryID = t.getGalleryID();
|
20979 |
+
|
20980 |
+
jQuery.each(window.ugArrGalleriesObjects, function(index, objGallery){
|
20981 |
+
|
20982 |
+
var galleryID = objGallery.getGalleryID();
|
20983 |
+
var score = objGallery.getKeyPressScore();
|
20984 |
+
|
20985 |
+
if(score > maxScore)
|
20986 |
+
maxScore = score;
|
20987 |
+
|
20988 |
+
if(galleryID == currentGalleryID)
|
20989 |
+
currentScore = score;
|
20990 |
+
|
20991 |
+
});
|
20992 |
+
|
20993 |
+
if(currentScore == maxScore)
|
20994 |
+
return(true);
|
20995 |
+
|
20996 |
+
return(false);
|
20997 |
}
|
20998 |
|
20999 |
|
21013 |
|
21014 |
switch(keyCode){
|
21015 |
case 39: //right key
|
|
|
21016 |
|
21017 |
+
var isGalleryForKeyAction = isThisGalleryForKeyAction();
|
21018 |
+
|
21019 |
+
if(isGalleryForKeyAction == true){
|
21020 |
t.nextItem();
|
21021 |
wasAction = true;
|
21022 |
}
|
21023 |
break;
|
21024 |
case 37: //left key
|
21025 |
+
var isGalleryForKeyAction = isThisGalleryForKeyAction();
|
21026 |
+
|
21027 |
+
if(isGalleryForKeyAction == true){
|
21028 |
t.prevItem();
|
21029 |
wasAction = true;
|
21030 |
}
|
21035 |
}
|
21036 |
|
21037 |
//only first page gallery affected
|
|
|
21038 |
if(wasAction == true){
|
21039 |
+
|
|
|
|
|
21040 |
event.preventDefault();
|
21041 |
event.stopPropagation();
|
21042 |
event.stopImmediatePropagation();
|
22138 |
*/
|
22139 |
this.isGalleryInsideScreen = function(){
|
22140 |
|
22141 |
+
if(g_temp.isFreestyleMode == true)
|
22142 |
+
return(false);
|
22143 |
+
|
22144 |
if(!g_objSlider)
|
22145 |
return(false);
|
22146 |
+
|
22147 |
var isInside = g_functions.isElementInsideScreen(g_objWrapper);
|
22148 |
|
22149 |
return(isInside);
|
22236 |
|
22237 |
}
|
22238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22239 |
|
22240 |
this.__________EXTERNAL_EVENTS_______ = function(){};
|
22241 |
|
assets_libraries/unitegallery/js/unitegallery.min.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
//
|
2 |
-
|
3 |
-
function debugLine(e,t,i){!0===e&&(e="true"),!1===e&&(e="false");var n=e;if("object"==typeof e)for(name in n="",e){var r=e[name];n+=" "+name+": "+r}if(1!=t||i||(n+=" "+Math.random()),1==i){var o=jQuery("#debug_line");o.width(200),o.height()>=500&&o.html(""),n=o.html()+"<br> -------------- <br>"+n}jQuery("#debug_line").show().html(n)}function debugSide(e){var t="";for(name in e){var i=e[name];t+=name+" : "+i+"<br>"}jQuery("#debug_side").show().html(t)}function trace(e){"undefined"!=typeof console&&console.log(e)}function UGFunctions(){var e=null,t=this,i={starTime:0,arrThemes:[],isTouchDevice:-1,isRgbaSupported:-1,timeCache:{},dataCache:{},lastEventType:"",lastEventTime:0,lastTouchStartElement:null,touchThreshold:700,handle:null};function n(e,t,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent?t.attachEvent("on"+e,i):t[e]=i}this.debugVar="",this.z__________FULL_SCREEN___________=function(){},this.toFullscreen=function(e,t){if(e.requestFullscreen)e.requestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},this.exitFullscreen=function(){if(0==t.isFullScreen())return!1;if(document.exitFullscreen)document.exitFullscreen();else if(document.cancelFullScreen)document.cancelFullScreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},this.addFullScreenChangeEvent=function(e){document.webkitCancelFullScreen?n("webkitfullscreenchange",document,e):document.msExitFullscreen?n("MSFullscreenChange",document,e):document.mozCancelFullScreen?n("mozfullscreenchange",document,e):n("fullscreenchange",document,e)},this.destroyFullScreenChangeEvent=function(){jQuery(document).unbind("fullscreenChange"),jQuery(document).unbind("mozfullscreenchange"),jQuery(document).unbind("webkitfullscreenchange"),jQuery(document).unbind("MSFullscreenChange")},this.getFullScreenElement=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},this.isFullScreen=function(){var e=document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement;return e=!!e},this.z__________GET_PROPS___________=function(){},this.getBrowserPrefix=function(){if(null!==e)return e;var t=["webkit","Moz","ms","O"],i=document.createElement("div");for(var n in t){var r=t[n];if(r+"Transform"in i.style)return r=r.toLowerCase(),e=r,r}return e="",""},this.getImageInsideParentDataByImage=function(e,i,n){var r=e.parent(),o=t.getImageOriginalSize(e);return t.getImageInsideParentData(r,o.width,o.height,i,n)},this.getImageInsideParentData=function(e,t,i,n,r,o,a){if(!r)r={};var s={};if(void 0===o)o=e.width();if(void 0===a)a=e.height();r.padding_left&&(o-=r.padding_left),r.padding_right&&(o-=r.padding_right),r.padding_top&&(a-=r.padding_top),r.padding_bottom&&(a-=r.padding_bottom);var l=null,u="100%",d=null,_=null,g="display:block;margin:0px auto;";if(t>0&&i>0){if("down"==n&&t<o&&i<a)_=(o-(l=t))/2,d=(a-(u=i))/2;else if("fill"==n){(l=(u=a)*(c=t/i))<o?(u=(l=o)/c,_=0,d=Math.round((u-a)/2*-1)):(d=0,_=Math.round((l-o)/2*-1))}else{var c;d=0,_=(o-(l=(u=a)*(c=t/i)))/2,"fitvert"!=n&&l>o&&(_=0,d=(a-(u=(l=o)/c))/2)}l=Math.floor(l),u=Math.floor(u),d=Math.floor(d),_=Math.floor(_),g="position:absolute;"}return r.padding_top&&(d+=r.padding_top),r.padding_left&&(_+=r.padding_left),s.imageWidth=l,s.imageHeight=u,s.imageTop=d,s.imageLeft=_,s.imageRight=_+l,s.imageBottom=0==d||"100%"==u?null:d+u,s.style=g,s},this.getElementCenterPosition=function(e,i){var n=e.parent(),r=t.getElementSize(e),o=t.getElementSize(n),a=o.width,s=o.height;i&&void 0!==i.padding_top&&(s-=i.padding_top),i&&void 0!==i.padding_bottom&&(s-=i.padding_bottom),i&&void 0!==i.padding_left&&(a-=i.padding_left),i&&void 0!==i.padding_right&&(a-=i.padding_right);var l={};return l.left=Math.round((a-r.width)/2),l.top=Math.round((s-r.height)/2),i&&void 0!==i.padding_top&&(l.top+=i.padding_top),i&&void 0!==i.padding_left&&(l.left+=i.padding_left),l},this.getElementCenterPoint=function(e,i){if(!i)i=!1;var n=t.getElementSize(e),r={};return r.x=n.width/2,r.y=n.height/2,1==i&&(r.x+=n.left,r.y+=n.top),r.x=Math.round(r.x),r.y=Math.round(r.y),r},this.getMousePosition=function(e,t){var i={pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY};if(e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(i.pageX=e.originalEvent.touches[0].pageX,i.pageY=e.originalEvent.touches[0].pageY,i.clientX=e.originalEvent.touches[0].clientX,i.clientY=e.originalEvent.touches[0].clientY),t){var n=t.offset();i.mouseX=i.pageX-n.left,i.mouseY=i.pageY-n.top}return i},this.getMouseElementPoint=function(e,i){var n={x:e.pageX,y:e.pageY};return t.getElementLocalPoint(n,i)},this.getElementLocalPoint=function(e,t){var i={},n=t.offset();return i.x=Math.round(e.x-n.left),i.y=Math.round(e.y-n.top),i},this.getImageOriginalSize=function(e,t,i){if(void 0!==t&&void 0!==i)return{width:t,height:i};var n=e[0];if(void 0===n)throw new Error("getImageOriginalSize error - Image not found");var r={};if(void 0===n.naturalWidth){if("number"==typeof e.data("naturalWidth"))return(r={}).width=e.data("naturalWidth"),r.height=e.data("naturalHeight"),r;var o=new Image;return o.src=n.src,o.complete?(r.width=o.width,r.height=o.height,e.data("naturalWidth",r.width),e.data("naturalHeight",r.height),r):{width:0,height:0}}return r.width=n.naturalWidth,r.height=n.naturalHeight,r},this.getimageRatio=function(e){var i=t.getImageOriginalSize(e);return t.getElementSize(e).width/i.width},this.isImageFitParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width<=r.width&&n.height<=r.height},this.getElementSize=function(e){if(void 0===e)throw new Error("Can't get size, empty element");var t=e.position();return t.height=e.outerHeight(),t.width=e.outerWidth(),t.left=Math.round(t.left),t.top=Math.round(t.top),t.right=t.left+t.width,t.bottom=t.top+t.height,t},this.isElementBiggerThenParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width>r.width||n.height>r.height},this.isPointInsideElement=function(e,t){return 0!=(e.x>=0&&e.x<t.width)&&0!=(e.y>=0&&e.y<t.height)},this.getElementRelativePos=function(e,i,n,r){if(!r)r=e.parent();if("number"==typeof e)var o={width:e,height:e};else o=t.getElementSize(e);var a=t.getElementSize(r);switch(i){case"top":case"left":i=0,n&&(i+=n);break;case"center":i=Math.round((a.width-o.width)/2),n&&(i+=n);break;case"right":i=a.width-o.width,n&&(i-=n);break;case"middle":i=Math.round((a.height-o.height)/2),n&&(i+=n);break;case"bottom":i=a.height-o.height,n&&(i-=n)}return i},this.getScreenVisibleSize=function(){document.body.clientWidth,document.body.clientHeight,jQuery(document).scrollTop();var e=jQuery(document),t=e.scrollLeft(),i=e.scrollTop();t=Math.round(t);var n=(i=Math.round(i))+window.innerHeight,r=t+window.innerWidth;return{top:i,left:t,height:n-i,width:r-t,right:r,bottom:n}},this.isElementsIntersect=function(e,t){return!(e.right<t.left)&&(!(e.left>t.right)&&(!(e.bottom<t.top)&&!(e.top>t.bottom)))},this.isElementInsideScreen=function(e){var i=t.getElementSize(e),n=t.getScreenVisibleSize();return t.isElementsIntersect(n,i)},this.z_________SET_ELEMENT_PROPS_______=function(){},this.zoomImageInsideParent=function(e,i,n,r,o,a,s){if(!n)n=1.2;if(!o)o="fit";var l,u,d,_,g=n,c=e.parent(),h=t.getElementSize(e),p=t.getImageOriginalSize(e),m=!1,f=0,b=0,v=0,y=0;if(r){var I=t.getMouseElementPoint(r,e);m=t.isPointInsideElement(I,h),v=I.x,y=I.y}else m=!1;if(0==m){var w=t.getElementCenterPoint(e);v=w.x,y=w.y}if(1==i)l=h.height*g,u=h.width*g,0!=v&&(f=-(v*g-v)),0!=y&&(b=-(y*g-y));else{if(l=h.height/g,(u=h.width/g)<t.getImageInsideParentData(c,p.width,p.height,o,s).imageWidth)return t.scaleImageFitParent(e,p.width,p.height,o,s),!0;1==m&&(0!=v&&(f=-(v/g-v)),0!=y&&(b=-(y/g-y)))}if(a){var E=1;if(0!=p.width&&(E=u/p.width),E>a)return!1}if(t.setElementSize(e,u,l),0==i&&0==m){var T=t.getElementCenterPosition(e);d=T.left,_=T.top}else d=h.left+f,_=h.top+b;return t.placeElement(e,d,_),!0},this.placeElement=function(e,i,n,r,o,a){if(0==jQuery.isNumeric(i)||0==jQuery.isNumeric(n)){if(!a)a=e.parent();var s=t.getElementSize(e),l=t.getElementSize(a)}if(0==jQuery.isNumeric(i))switch(i){case"left":i=0,r&&(i+=r);break;case"center":i=Math.round((l.width-s.width)/2),r&&(i+=r);break;case"right":i=l.width-s.width,r&&(i-=r)}if(0==jQuery.isNumeric(n))switch(n){case"top":n=0,o&&(n+=o);break;case"middle":case"center":n=Math.round((l.height-s.height)/2),o&&(n+=o);break;case"bottom":n=l.height-s.height,o&&(n-=o)}var u={position:"absolute",margin:"0px"};null!==i&&(u.left=i),null!==n&&(u.top=n),e.css(u)},this.placeElementInParentCenter=function(e){t.placeElement(e,"center","middle")},this.setElementSizeAndPosition=function(e,t,i,n,r){var o={width:n+"px",height:r+"px",left:t+"px",top:i+"px",position:"absolute",margin:"0px"};e.css(o)},this.setElementSize=function(e,t,i){var n={width:t+"px"};null!=i&&(n.height=i+"px"),e.css(n)},this.cloneElementSizeAndPos=function(e,i,n,r,o){var a=e.position();if(null==a)throw new Error("Can't get size, empty element");!0===n?(a.height=e.outerHeight(),a.width=e.outerWidth()):(a.height=e.height(),a.width=e.width()),a.left=Math.round(a.left),a.top=Math.round(a.top),r&&(a.left+=r),o&&(a.top+=o),t.setElementSizeAndPosition(i,a.left,a.top,a.width,a.height)},this.placeImageInsideParent=function(e,i,n,r,o,a){var s=t.getImageInsideParentData(i,n,r,o,a),l="<img";return null!==s.imageWidth&&(l+=" width = '"+s.imageWidth+"'",s.style+="width:"+s.imageWidth+";"),null!=s.imageHeight&&("100%"==s.imageHeight?(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+";"):(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+"px;")),null!==s.imageTop&&(s.style+="top:"+s.imageTop+"px;"),null!==s.imageLeft&&(s.style+="left:"+s.imageLeft+"px;"),e=t.escapeDoubleSlash(e),l+=" style='"+s.style+"'",l+=' src="'+e+'"',l+=">",i.html(l),i.children("img")},this.scaleImageCoverParent=function(e,i,n){if("number"==typeof i)var r=i,o=n;else r=i.outerWidth(),o=i.outerHeight();var a=t.getImageOriginalSize(e),s=a.width/a.height,l=o,u=l*s,d=0,_=0;u<r?(l=(u=r)/s,_=0,d=Math.round((l-o)/2*-1)):(d=0,_=Math.round((u-r)/2*-1)),u=Math.round(u),l=Math.round(l),e.css({width:u+"px",height:l+"px",left:_+"px",top:d+"px"})},this.scaleImageFitParent=function(e,i,n,r,o){var a=e.parent(),s=t.getImageInsideParentData(a,i,n,r,o),l=!1,u={};return null!==s.imageWidth&&(l=!0,e.removeAttr("width"),u.width=s.imageWidth+"px"),null!=s.imageHeight&&(l=!0,e.removeAttr("height"),u.height=s.imageHeight+"px"),null!==s.imageTop&&(l=!0,u.top=s.imageTop+"px"),null!==s.imageLeft&&(l=!0,u.left=s.imageLeft+"px"),1==l&&(u.position="absolute",u.margin="0px 0px",e.css(u)),s},this.scaleImageByHeight=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i*a);i=Math.round(i),t.setElementSize(e,s,i)},this.scaleImageByWidth=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i/a);i=Math.round(i),t.setElementSize(e,i,s)},this.scaleImageExactSizeInParent=function(e,i,n,r,o,a){var s=e.parent(),l=t.getElementSize(s);l.width<r&&(r=l.width),l.height<o&&(o=l.height);var u,d=t.getImageInsideParentData(null,i,n,a,null,r,o),_=r,g=o,c=d.imageLeft,h=d.imageLeft,p=d.imageTop,m=d.imageTop,f=Math.round((l.width-r)/2),b=Math.round((l.height-o)/2);0!=(u=r-(d.imageWidth+c+h))&&(h+=u),0!=(u=o-(d.imageHeight+p+m))&&(m+=u),e.removeAttr("width"),e.removeAttr("height");var v={position:"absolute",margin:"0px 0px"};v.width=_+"px",v.height=g+"px",v.left=f+"px",v.top=b+"px",v["padding-left"]=c+"px",v["padding-top"]=p+"px",v["padding-right"]=h+"px",v["padding-bottom"]=m+"px",e.css(v);var y={};return y.imageWidth=_,y.imageHeight=g,y},this.showElement=function(e,t,i){e.show().fadeTo(0,1),t&&t.show().fadeTo(0,1),i&&i.show().fadeTo(0,1)},this.z_________GALLERY_RELATED_FUNCTIONS_______=function(){},this.disableButton=function(e,i){if(!i)i="ug-button-disabled";0==t.isButtonDisabled(e,i)&&e.addClass(i)},this.convertCustomPrefixOptions=function(e,t,i){if(!t)return e;var n={};return jQuery.each(e,function(e,r){if(0===e.indexOf(t+"_"+i+"_")){var o=e.replace(t+"_"+i+"_",i+"_");n[o]=r}else n[e]=r}),n},this.enableButton=function(e,i){if(!i)i="ug-button-disabled";1==t.isButtonDisabled(e,i)&&e.removeClass(i)},this.isButtonDisabled=function(e,t){if(!t)t="ug-button-disabled";return!!e.hasClass(t)},this.z_________MATH_FUNCTIONS_______=function(){},this.normalizeSetting=function(e,t,i,n,r,o){if(!o)o=!1;return r=e+(t-e)*((r-i)/(n-i)),1==o&&(r<e&&(r=e),r>t&&(r=t)),r},this.getNormalizedValue=function(e,t,i,n,r){return r=e+(n-i)*((r-e)/(t-e))},this.getDistance=function(e,t,i,n){return Math.round(Math.sqrt(Math.abs((i-e)*(i-e)+(n-t)*(n-t))))},this.getMiddlePoint=function(e,t,i,n){var r={};return r.x=e+Math.round((i-e)/2),r.y=t+Math.round((n-t)/2),r},this.getNumItemsInSpace=function(e,t,i){return Math.floor((e+i)/(t+i))},this.getNumItemsInSpaceRound=function(e,t,i){return Math.round((e+i)/(t+i))},this.getSpaceByNumItems=function(e,t,i){return e*t+(e-1)*i},this.getItemSizeInSpace=function(e,t,i){return Math.floor((e-(t-1)*i)/t)},this.getColX=function(e,t,i){return e*(t+i)},this.getColByIndex=function(e,t){return t%e},this.getColRowByIndex=function(e,t){var i=Math.floor(e/t);return{col:Math.floor(e%t),row:i}},this.getIndexByRowCol=function(e,t,i){return e<0?-1:t<0?-1:e*i+t},this.getPrevRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row-1,n.col,i)},this.getNextRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row+1,n.col,i)},this.z_________DATA_FUNCTIONS_______=function(){},this.setGlobalData=function(e,t){jQuery.data(document.body,e,t)},this.getGlobalData=function(e){return jQuery.data(document.body,e)},this.z_________EVENT_DATA_FUNCTIONS_______=function(){},this.handleScrollTop=function(e){if(0==t.isTouchDevice())return null;var n=t.getStoredEventData(e);if(null===n.scrollDir&&(Math.abs(n.diffMouseX)>15?n.scrollDir="hor":Math.abs(n.diffMouseY)>15&&Math.abs(n.diffMouseY)>Math.abs(n.diffMouseX)&&(n.scrollDir="vert",n.scrollStartY=n.lastMouseClientY,n.scrollOrigin=jQuery(document).scrollTop(),i.dataCache[e].scrollStartY=n.lastMouseClientY,i.dataCache[e].scrollOrigin=n.scrollOrigin),i.dataCache[e].scrollDir=n.scrollDir),"vert"!==n.scrollDir)return n.scrollDir;jQuery(document).scrollTop();var r=n.scrollOrigin-(n.lastMouseClientY-n.scrollStartY);return r>=0&&jQuery(document).scrollTop(r),n.scrollDir},this.wasVerticalScroll=function(e){return"vert"===t.getStoredEventData(e).scrollDir},this.storeEventData=function(e,n,r){var o=t.getMousePosition(e),a=jQuery.now(),s={startTime:a,lastTime:a,startMouseX:o.pageX,startMouseY:o.pageY,lastMouseX:o.pageX,lastMouseY:o.pageY,startMouseClientY:o.clientY,lastMouseClientY:o.clientY,scrollTop:jQuery(document).scrollTop(),scrollDir:null};r&&(s=jQuery.extend(s,r)),i.dataCache[n]=s},this.updateStoredEventData=function(e,n,r){if(!i.dataCache[n])throw new Error("updateEventData error: must have stored cache object");var o=i.dataCache[n],a=t.getMousePosition(e);o.lastTime=jQuery.now(),void 0!==a.pageX&&(o.lastMouseX=a.pageX,o.lastMouseY=a.pageY,o.lastMouseClientY=a.clientY),r&&(o=jQuery.extend(o,r)),i.dataCache[n]=o},this.getStoredEventData=function(e,t){if(!i.dataCache[e])throw new Error("updateEventData error: must have stored cache object");var n=i.dataCache[e];return n.diffMouseX=n.lastMouseX-n.startMouseX,n.diffMouseY=n.lastMouseY-n.startMouseY,n.diffMouseClientY=n.lastMouseClientY-n.startMouseClientY,n.diffTime=n.lastTime-n.startTime,!0===t?(n.startMousePos=n.lastMouseY,n.lastMousePos=n.lastMouseY,n.diffMousePos=n.diffMouseY):(n.startMousePos=n.lastMouseX,n.lastMousePos=n.lastMouseX,n.diffMousePos=n.diffMouseX),n},this.isApproveStoredEventClick=function(e,n){if(!i.dataCache[e])return!0;var r=t.getStoredEventData(e,n),o=Math.abs(r.diffMousePos);return!(r.diffTime>400)&&!(o>30)},this.clearStoredEventData=function(e){i.dataCache[e]=null},this.z_________CHECK_SUPPORT_FUNCTIONS_______=function(){},this.isCanvasExists=function(){return"function"==typeof jQuery('<canvas width="500" height="500" > </canvas>')[0].getContext},this.isScrollbarExists=function(){return window.innerWidth>document.documentElement.clientWidth},this.isTouchDevice=function(){if(-1!==i.isTouchDevice)return i.isTouchDevice;try{document.createEvent("TouchEvent"),i.isTouchDevice=!0}catch(e){i.isTouchDevice=!1}return i.isTouchDevice},this.isRgbaSupported=function(){if(-1!==i.isRgbaSupported)return i.isRgbaSupported;var e=document.getElementsByTagName("script")[0],t=e.style.color;try{e.style.color="rgba(1,5,13,0.44)"}catch(e){}var n=e.style.color!=t;return e.style.color=t,i.isRgbaSupported=n,n},this.z_________GENERAL_FUNCTIONS_______=function(){},this.checkMinJqueryVersion=function(e){for(var t=jQuery.fn.jquery.split("."),i=e.split("."),n=0,r=t.length;n<r;n++){var o=parseInt(t[n]),a=parseInt(i[n]);if(void 0===i[n])return!0;if(a>o)return!1;if(o>a)return!0}return!0},this.getCssSizeParam=function(e){return jQuery.isNumeric(e)?e+"px":e},this.convertHexToRGB=function(e,t){var i=e.replace("#","");return i===e?e:(r=parseInt(i.substring(0,2),16),g=parseInt(i.substring(2,4),16),b=parseInt(i.substring(4,6),16),result="rgba("+r+","+g+","+b+","+t+")",result)},this.timestampToString=function(e){var t=new Date(e),i=t.getDate()+"/"+t.getMonth();return i+=" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()+":"+t.getMilliseconds()},this.getArrTouches=function(e){var t=[];return e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(t=e.originalEvent.touches),t},this.getArrTouchPositions=function(e){for(var t=[],i=0;i<e.length;i++){var n={pageX:e[i].pageX,pageY:e[i].pageY};t.push(n)}return t},this.startTimeDebug=function(){i.starTime=jQuery.now()},this.showTimeDebug=function(){debugLine({"Time Passed":jQuery.now()-i.starTime},!0)},this.initProgressIndicator=function(e,i,n){switch("bar"!=e&&0==t.isCanvasExists()&&(e="bar"),e){case"bar":(r=new UGProgressBar).putHidden(n,i);break;default:case"pie":(r=new UGProgressPie).putHidden(n,i);break;case"pie2":var r;i.type_fill=!0,(r=new UGProgressPie).putHidden(n,i)}return r},this.setButtonMobileReady=function(e){e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover")}),e.on("mousedown touchend",function(e){return e.stopPropagation(),e.stopImmediatePropagation(),!1})},this.registerTheme=function(e){i.arrThemes.push(e)},this.getArrThemes=function(){return i.arrThemes},this.isThemeRegistered=function(e){return-1!==jQuery.inArray(e,i.arrThemes)},this.getFirstRegisteredTheme=function(){return 0==i.arrThemes.length?"":i.arrThemes[0]},this.isTimePassed=function(e,t){if(!t)t=100;var n=jQuery.now();0==i.timeCache.hasOwnProperty(e)?lastTime=0:lastTime=i.timeCache[e];var r=n-lastTime;return i.timeCache[e]=n,!(r<=t)},this.whenContiniousEventOver=function(e,t,n){if(!n)n=300;1==i.timeCache.hasOwnProperty(e)&&null!=i.timeCache[e]&&(clearTimeout(i.timeCache[e]),i.timeCache[e]=null),i.timeCache[e]=setTimeout(t,n)},this.validateClickTouchstartEvent=function(e){var t=!0,n=jQuery.now()-i.lastEventTime;return"click"==e&&"touchstart"==i.lastEventType&&n<1e3&&(t=!1),i.lastEventTime=jQuery.now(),i.lastEventType=e,t},this.addClassOnHover=function(e,t){if(!t)t="ug-button-hover";e.hover(function(){jQuery(this).addClass(t)},function(){jQuery(this).removeClass(t)})},this.destroyButton=function(e){e.off("mouseenter"),e.off("mouseleave"),e.off("click"),e.off("touchstart"),e.off("touchend"),e.off("mousedown"),e.off("tap")},this.setButtonOnClick=function(e,i){t.setButtonMobileReady(e),e.on("click touchstart",function(e){if(objThis=jQuery(this),e.stopPropagation(),e.stopImmediatePropagation(),0==t.validateClickTouchstartEvent(e.type))return!0;i(objThis,e)})},this.setButtonOnTap=function(e,n){e.on("tap",n),0==t.isTouchDevice()?e.on("click",function(e){var i=jQuery(this);if(0==t.validateClickTouchstartEvent(e.type))return!0;i.trigger("tap")}):(e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover"),i.lastTouchStartElement=jQuery(this),i.lastEventTime=jQuery.now()}),e.on("touchend",function(e){var t=jQuery(this);return 0==t.is(i.lastTouchStartElement)||(!i.lastEventTime||(jQuery.now()-i.lastEventTime>i.touchThreshold||void t.trigger("tap")))}))},this.loadJs=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("script");i.src=e;var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)},this.loadCss=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(i)},this.addEvent=function(e,t,i){void 0!==e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent&&e.attachEvent("on"+t,i)},this.checkImagesLoaded=function(e,t,i){var n=0,r=e.length;if(0==r&&t)return t(),!1;function o(e,o){n++,"function"==typeof i&&setTimeout(function(){i(e,o)}),n==r&&"function"==typeof t&&setTimeout(function(){t()})}setTimeout(function(){for(var t=0;t<r;t++){var i=e[t];if(void 0!==i.naturalWidth&&0!==i.naturalWidth)o(e[t],!1);else{var n=jQuery("<img/>");n.data("index",t),n.on("load",function(){var t=jQuery(this).data("index");o(e[t],!1)}),n.on("error",function(){var t=jQuery(this).data("index");o(e[t],!0)}),n.attr("src",i.src)}}})},this.waitForWidth=function(e,t){var n=e.width();if(0!=n)return t(),!1;i.handle=setInterval(function(){0!=(n=e.width())&&(clearInterval(i.handle),t())},300)},this.arrayShuffle=function(e){if("object"!=typeof e)return e;for(var t,i,n=e.length;n;t=parseInt(Math.random()*n),i=e[--n],e[n]=e[t],e[t]=i);return e},this.getObjectLength=function(e){var t=0;for(var i in e)t++;return t},this.normalizePercent=function(e){return e<0&&(e=0),e>1&&(e=1),e},this.stripTags=function(e){return e.replace(/(<([^>]+)>)/gi,"")},this.escapeDoubleSlash=function(e){return e.replace('"','"')},this.htmlentitles=function(e){return jQuery("<div/>").text(e).html()},this.z_________END_GENERAL_FUNCTIONS_______=function(){}}!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var a=t||window.event,s=l.call(arguments,1),u=0,d=0,_=0,g=0;if((t=e.event.fix(a)).type="mousewheel","detail"in a&&(_=-1*a.detail),"wheelDelta"in a&&(_=a.wheelDelta),"wheelDeltaY"in a&&(_=a.wheelDeltaY),"wheelDeltaX"in a&&(d=-1*a.wheelDeltaX),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(d=-1*_,_=0),u=0===_?d:_,"deltaY"in a&&(u=_=-1*a.deltaY),"deltaX"in a&&(d=a.deltaX,0===_&&(u=-1*d)),0!==_||0!==d){if(1===a.deltaMode){var c=e.data(this,"mousewheel-line-height");u*=c,_*=c,d*=c}else if(2===a.deltaMode){var h=e.data(this,"mousewheel-page-height");u*=h,_*=h,d*=h}return g=Math.max(Math.abs(_),Math.abs(d)),(!o||o>g)&&(o=g,n(a,g)&&(o/=40)),n(a,g)&&(u/=40,d/=40,_/=40),u=Math[u>=1?"floor":"ceil"](u/o),d=Math[d>=1?"floor":"ceil"](d/o),_=Math[_>=1?"floor":"ceil"](_/o),t.deltaX=d,t.deltaY=_,t.deltaFactor=o,t.deltaMode=0,s.unshift(t,u,d,_),r&&clearTimeout(r),r=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){o=null}function n(e,t){return d.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}var r,o,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var u=a.length;u;)e.event.fixHooks[a[--u]]=e.event.mouseHooks;var d=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",d.getLineHeight(this)),e.data(this,"mousewheel-page-height",d.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=s.length;e;)this.removeEventListener(s[--e],t,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e(t)}):"object"==typeof module&&"object"==typeof module.exports?exports=e(require("jquery")):e(jQuery)}(function(e){e.easing.jswing=e.easing.swing;var t=Math.pow,i=Math.sqrt,n=Math.sin,r=Math.cos,o=Math.PI,a=1.70158,s=1.525*a,l=2*o/3,u=2*o/4.5;function d(e){var t=7.5625,i=2.75;return e<1/i?t*e*e:e<2/i?t*(e-=1.5/i)*e+.75:e<2.5/i?t*(e-=2.25/i)*e+.9375:t*(e-=2.625/i)*e+.984375}e.extend(e.easing,{def:"easeOutQuad",swing:function(t){return e.easing[e.easing.def](t)},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return 1-(1-e)*(1-e)},easeInOutQuad:function(e){return e<.5?2*e*e:1-t(-2*e+2,2)/2},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return 1-t(1-e,3)},easeInOutCubic:function(e){return e<.5?4*e*e*e:1-t(-2*e+2,3)/2},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1-t(1-e,4)},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-t(-2*e+2,4)/2},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1-t(1-e,5)},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1-t(-2*e+2,5)/2},easeInSine:function(e){return 1-r(e*o/2)},easeOutSine:function(e){return n(e*o/2)},easeInOutSine:function(e){return-(r(o*e)-1)/2},easeInExpo:function(e){return 0===e?0:t(2,10*e-10)},easeOutExpo:function(e){return 1===e?1:1-t(2,-10*e)},easeInOutExpo:function(e){return 0===e?0:1===e?1:e<.5?t(2,20*e-10)/2:(2-t(2,-20*e+10))/2},easeInCirc:function(e){return 1-i(1-t(e,2))},easeOutCirc:function(e){return i(1-t(e-1,2))},easeInOutCirc:function(e){return e<.5?(1-i(1-t(2*e,2)))/2:(i(1-t(-2*e+2,2))+1)/2},easeInElastic:function(e){return 0===e?0:1===e?1:-t(2,10*e-10)*n((10*e-10.75)*l)},easeOutElastic:function(e){return 0===e?0:1===e?1:t(2,-10*e)*n((10*e-.75)*l)+1},easeInOutElastic:function(e){return 0===e?0:1===e?1:e<.5?-t(2,20*e-10)*n((20*e-11.125)*u)/2:t(2,-20*e+10)*n((20*e-11.125)*u)/2+1},easeInBack:function(e){return 2.70158*e*e*e-a*e*e},easeOutBack:function(e){return 1+2.70158*t(e-1,3)+a*t(e-1,2)},easeInOutBack:function(e){return e<.5?t(2*e,2)*(7.189819*e-s)/2:(t(2*e-2,2)*((s+1)*(2*e-2)+s)+2)/2},easeInBounce:function(e){return 1-d(1-e)},easeOutBounce:d,easeInOutBounce:function(e){return e<.5?(1-d(1-2*e))/2:(1+d(2*e-1))/2}})}),function(e,t){if(void 0===e.cssHooks)return!1;function i(e,t,i){var n=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=n.floor?~~e:parseFloat(e),isNaN(e)?t.def:n.mod?(e+n.mod)%n.mod:0>e?0:n.max<e?n.max:e)}function n(t){var i=l(),n=i._rgba=[];return t=t.toLowerCase(),c(s,function(e,r){var o,a=r.re.exec(t),s=a&&r.parse(a),l=r.space||"rgba";return s?(o=i[l](s),i[u[l].cache]=o[u[l].cache],n=i._rgba=o._rgba,!1):void 0}),n.length?("0,0,0,0"===n.join()&&e.extend(n,o.transparent),i):o[t]}function r(e,t,i){return 1>6*(i=(i+1)%1)?e+(t-e)*i*6:1>2*i?t:2>3*i?e+(t-e)*(2/3-i)*6:e}var o,a=/^([\-+])=\s*(\d+\.?\d*)/,s=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,n,r){return new e.Color.fn.parse(t,i,n,r)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},_=l.support={},g=e("<p>")[0],c=e.each;g.style.cssText="background-color:rgba(1,1,1,.5)",_.rgba=g.style.backgroundColor.indexOf("rgba")>-1,c(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(r,a,s,d){if(r===t)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=e(r).css(a),a=t);var _=this,g=e.type(r),h=this._rgba=[];return a!==t&&(r=[r,a,s,d],g="array"),"string"===g?this.parse(n(r)||o._default):"array"===g?(c(u.rgba.props,function(e,t){h[t.idx]=i(r[t.idx],t)}),this):"object"===g?(c(u,r instanceof l?function(e,t){r[t.cache]&&(_[t.cache]=r[t.cache].slice())}:function(t,n){var o=n.cache;c(n.props,function(e,t){if(!_[o]&&n.to){if("alpha"===e||null==r[e])return;_[o]=n.to(_._rgba)}_[o][t.idx]=i(r[e],t,!0)}),_[o]&&e.inArray(null,_[o].slice(0,3))<0&&(_[o][3]=1,n.from&&(_._rgba=n.from(_[o])))}),this):void 0},is:function(e){var t=l(e),i=!0,n=this;return c(u,function(e,r){var o,a=t[r.cache];return a&&(o=n[r.cache]||r.to&&r.to(n._rgba)||[],c(r.props,function(e,t){return null!=a[t.idx]?i=a[t.idx]===o[t.idx]:void 0})),i}),i},_space:function(){var e=[],t=this;return c(u,function(i,n){t[n.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var n=l(e),r=n._space(),o=u[r],a=0===this.alpha()?l("transparent"):this,s=a[o.cache]||o.to(a._rgba),_=s.slice();return n=n[o.cache],c(o.props,function(e,r){var o=r.idx,a=s[o],l=n[o],u=d[r.type]||{};null!==l&&(null===a?_[o]=l:(u.mod&&(l-a>u.mod/2?a+=u.mod:a-l>u.mod/2&&(a-=u.mod)),_[o]=i((l-a)*t+a,r)))}),this[r](_)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),n=i.pop(),r=l(t)._rgba;return l(e.map(i,function(e,t){return(1-n)*r[t]+n*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),n=i.pop();return t&&i.push(~~(255*n)),"#"+e.map(i,function(e){return 1===(e=(e||0).toString(16)).length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,n=e[0]/255,r=e[1]/255,o=e[2]/255,a=e[3],s=Math.max(n,r,o),l=Math.min(n,r,o),u=s-l,d=s+l,_=.5*d;return t=l===s?0:n===s?60*(r-o)/u+360:r===s?60*(o-n)/u+120:60*(n-r)/u+240,i=0===u?0:.5>=_?u/d:u/(2-d),[Math.round(t)%360,i,_,null==a?1:a]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],n=e[2],o=e[3],a=.5>=n?n*(1+i):n+i-n*i,s=2*n-a;return[Math.round(255*r(s,a,t+1/3)),Math.round(255*r(s,a,t)),Math.round(255*r(s,a,t-1/3)),o]},c(u,function(n,r){var o=r.props,s=r.cache,u=r.to,d=r.from;l.fn[n]=function(n){if(u&&!this[s]&&(this[s]=u(this._rgba)),n===t)return this[s].slice();var r,a=e.type(n),_="array"===a||"object"===a?n:arguments,g=this[s].slice();return c(o,function(e,t){var n=_["object"===a?e:t.idx];null==n&&(n=g[t.idx]),g[t.idx]=i(n,t)}),d?((r=l(d(g)))[s]=g,r):l(g)},c(o,function(t,i){l.fn[t]||(l.fn[t]=function(r){var o,s=e.type(r),l="alpha"===t?this._hsla?"hsla":"rgba":n,u=this[l](),d=u[i.idx];return"undefined"===s?d:("function"===s&&(r=r.call(this,d),s=e.type(r)),null==r&&i.empty?this:("string"===s&&((o=a.exec(r))&&(r=d+parseFloat(o[2])*("+"===o[1]?1:-1))),u[i.idx]=r,this[l](u)))})})}),l.hook=function(t){var i=t.split(" ");c(i,function(t,i){e.cssHooks[i]={set:function(t,r){var o,a,s="";if("transparent"!==r&&("string"!==e.type(r)||(o=n(r)))){if(r=l(o||r),!_.rgba&&1!==r._rgba[3]){for(a="backgroundColor"===i?t.parentNode:t;(""===s||"transparent"===s)&&a&&a.style;)try{s=e.css(a,"backgroundColor"),a=a.parentNode}catch(e){}r=r.blend(s&&"transparent"!==s?s:"_default")}r=r.toRgbaString()}try{t.style[i]=r}catch(e){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),e.cssHooks.borderColor={expand:function(e){var t={};return c(["Top","Right","Bottom","Left"],function(i,n){t["border"+n+"Color"]=e}),t}},o=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(e){e.mlp={x:0,y:0},e(function t(){try{var i=this===document?e(this):e(this).contents()}catch(e){return!1}i.mousemove(function(t){e.mlp={x:t.pageX,y:t.pageY}}),i.find("iframe").on("load",t)}),e.fn.ismouseover=function(){var t=!1;return this.eq(0).each(function(){var i=e(this).is("iframe")?e(this).contents().find("body"):e(this),n=i.offset();t=n.left<=e.mlp.x&&n.left+i.outerWidth()>e.mlp.x&&n.top<=e.mlp.y&&n.top+i.outerHeight()>e.mlp.y}),t}}(jQuery);var g_ugFunctions=new UGFunctions;function UGThumbsGeneral(){var e,t,i,n,r=this,o=jQuery(r),a=new UniteGalleryMain,s=new UGFunctions;this.type={GET_THUMBS_ALL:"all",GET_THUMBS_RATIO:"ratio",GET_THUMBS_NO_RATIO:"no_ratio",GET_THUMBS_NEW:"new"},this.events={SETOVERSTYLE:"thumbmouseover",SETNORMALSTYLE:"thumbmouseout",SETSELECTEDSTYLE:"thumbsetselected",PLACEIMAGE:"thumbplaceimage",AFTERPLACEIMAGE:"thumb_after_place_image",IMAGELOADERROR:"thumbimageloaderror",THUMB_IMAGE_LOADED:"thumb_image_loaded"};var l={thumb_width:88,thumb_height:50,thumb_fixed_size:!0,thumb_resize_by:"height",thumb_border_effect:!0,thumb_border_width:0,thumb_border_color:"#000000",thumb_over_border_width:0,thumb_over_border_color:"#d9d9d9",thumb_selected_border_width:1,thumb_selected_border_color:"#d9d9d9",thumb_round_corners_radius:0,thumb_color_overlay_effect:!0,thumb_overlay_color:"#000000",thumb_overlay_opacity:.4,thumb_overlay_reverse:!1,thumb_image_overlay_effect:!1,thumb_image_overlay_type:"bw",thumb_transition_duration:200,thumb_transition_easing:"easeOutQuad",thumb_show_loader:!0,thumb_loader_type:"dark",thumb_wrapper_as_link:!1,thumb_link_newpage:!1},u={touchEnabled:!1,num_thumbs_checking:0,customThumbs:!1,funcSetCustomThumbHtml:null,isEffectBorder:!1,isEffectOverlay:!1,isEffectImage:!1,colorOverlayOpacity:1,thumbInnerReduce:0,allowOnResize:!0,classNewThumb:"ug-new-thumb"},d="thumb_size_change";function _(e,t){var r=i[e],o="";0==u.customThumbs&&(o=" ug-thumb-generated");var a="<div class='ug-thumb-wrapper"+o+"' "+("style='z-index:"+(r.index+1)+";'")+"></div>";if(1==l.thumb_wrapper_as_link){var s=r.link;""==r.link&&(s="javascript:void(0)");var d="";1==l.thumb_link_newpage&&r.link&&(d=" target='_blank'");a="<a href='"+s+"'"+d+" class='ug-thumb-wrapper"+o+"'></a>"}var _=jQuery(a),g=r.objThumbImage;if(0==u.customThumbs){if(1==l.thumb_show_loader&&g){var c="ug-thumb-loader-dark";"bright"==l.thumb_loader_type&&(c="ug-thumb-loader-bright"),_.append("<div class='ug-thumb-loader "+c+"'></div>"),_.append("<div class='ug-thumb-error' style='display:none'></div>")}if(g){if(g.addClass("ug-thumb-image"),1==l.thumb_image_overlay_effect){var h=g.clone().appendTo(_);h.addClass("ug-thumb-image-overlay "+t).removeClass("ug-thumb-image"),h.fadeTo(0,0),r.objImageOverlay=h}_.append(g)}}return u.isEffectBorder&&_.append("<div class='ug-thumb-border-overlay'></div>"),u.isEffectOverlay&&_.append("<div class='ug-thumb-overlay'></div>"),n.append(_),u.customThumbs&&u.funcSetCustomThumbHtml(_,r),i[e].objThumbWrapper=_,_}function g(e,t,i,r){var o={width:e+"px",height:t+"px"},a={width:e-u.thumbInnerReduce+"px",height:t-u.thumbInnerReduce+"px"},s=".ug-thumb-loader, .ug-thumb-error, .ug-thumb-border-overlay, .ug-thumb-overlay";i?(!0!==r&&i.css(o),i.find(s).css(a)):(n.children(".ug-thumb-wrapper").css(o),n.find(s).css(a))}function c(e,t,i,n){if(!n)n=!1;a.isFakeFullscreen()&&(n=!0);var r=e.children(".ug-thumb-border-overlay"),o={};o["border-width"]=t+"px",0!=t&&(o["border-color"]=i),n&&!0===n?(r.css(o),0==t?r.hide():r.show()):(0==t?r.stop().fadeOut(l.thumb_transition_duration):r.show().stop().fadeIn(l.thumb_transition_duration),function(e,t){e.stop(!0).animate(t,{duration:l.thumb_transition_duration,easing:l.thumb_transition_easing,queue:!1})}(r,o))}function h(e,t,i){var n=e.children(".ug-thumb-overlay"),r=l.thumb_transition_duration;i&&!0===i&&(r=0),t?n.stop(!0).fadeTo(r,u.colorOverlayOpacity):n.stop(!0).fadeTo(r,0)}function p(e,t,i){var n=e.children("img.ug-thumb-image"),r=e.children("img.ug-thumb-image-overlay"),o=l.thumb_transition_duration;i&&!0===i&&(o=0),t?r.stop(!0).fadeTo(o,1):(n.fadeTo(0,1),r.stop(!0).fadeTo(o,0))}function m(e,t){(u.isEffectBorder&&c(e,l.thumb_selected_border_width,l.thumb_selected_border_color,t),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!1,t),o.trigger(r.events.SETSELECTEDSTYLE,e)}function f(e){1==v(e)?m(e,!0):r.setThumbNormalStyle(e,!0,"redraw")}function b(e,t,i){if(1==l.thumb_fixed_size)s.scaleImageCoverParent(t,e);else{"height"==l.thumb_resize_by?s.scaleImageByHeight(t,l.thumb_height):s.scaleImageByWidth(t,l.thumb_width);var n=s.getElementSize(t);s.placeElement(t,0,0),g(n.width,n.height,e)}e.children(".ug-thumb-loader").hide(),t.show(),0==l.thumb_image_overlay_effect?t.fadeTo(0,1):(1==l.thumb_image_overlay_effect&&function(e){var t=e.siblings(".ug-thumb-image-overlay");if(0==t.length)return!1;var i=s.getElementSize(e),n={width:i.width+"px",height:i.height+"px",left:i.left+"px",top:i.top+"px"};t.css(n),0==u.customThumbs&&t.fadeTo(0,1)}(t),t.fadeTo(0,0),f(e)),o.trigger(r.events.AFTERPLACEIMAGE,e)}function v(e){return!!e.hasClass("ug-thumb-selected")}function y(e,t){t=jQuery(t);r.getItemByThumb(t);var i=s.getElementSize(t);g(i.width,i.height,t,!0),f(t)}function I(e,t){if(!t)t=!1;var i=jQuery(e),n=i.parents(".ug-thumb-wrapper");return 0!=n.parent().length&&(objItem=r.getItemByThumb(n),(1!=objItem.isLoaded||!1!==t)&&(r.triggerImageLoadedEvent(n,i),void(1==u.customThumbs?o.trigger(r.events.PLACEIMAGE,[n,i]):b(n,i,objItem))))}function w(e,t,i){objItem=r.getItemByThumb(t),objItem.isLoaded=!0,objItem.isThumbImageLoaded=!0;var n=s.getImageOriginalSize(i);objItem.thumbWidth=n.width,objItem.thumbHeight=n.height,objItem.thumbRatioByWidth=n.width/n.height,objItem.thumbRatioByHeight=n.height/n.width,t.addClass("ug-thumb-ratio-set")}this.init=function(n,r){e=n.getObjects(),a=n,jQuery(n),t=e.g_objWrapper,i=e.g_arrItems,l=jQuery.extend(l,r),u.isEffectBorder=l.thumb_border_effect,u.isEffectOverlay=l.thumb_color_overlay_effect,u.isEffectImage=l.thumb_image_overlay_effect},this._____________EXTERNAL_SETTERS__________=function(){},this.setHtmlThumbs=function(e,t){if(n=e,1==u.isEffectImage)var i=function(){var e="",t=l.thumb_image_overlay_type.split(",");for(var i in t){var n=t[i];switch(n){case"bw":e+=" ug-bw-effect";break;case"blur":e+=" ug-blur-effect";break;case"sepia":e+=" ug-sepia-effect"}}return e}();if(!0!==t)for(var o=a.getNumItems(),s=0;s<o;s++)_(s,i);else{r.getThumbs().removeClass(u.classNewThumb);var d=a.getNewAddedItemsIndexes();jQuery.each(d,function(e,t){_(t,i).addClass(u.classNewThumb)})}},this.setThumbNormalStyle=function(e,t,i){(1==u.customThumbs&&e.removeClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_border_width,l.thumb_border_color,t),u.isEffectOverlay)&&h(e,1!=l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!0,t),o.trigger(r.events.SETNORMALSTYLE,e)},this.setThumbOverStyle=function(e){(1==u.customThumbs&&e.addClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_over_border_width,l.thumb_over_border_color),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse);1==u.isEffectImage&&p(e,!1),o.trigger(r.events.SETOVERSTYLE,e)},this.setHtmlProperties=function(e){if(!e)e=r.getThumbs();if(0==u.customThumbs){1==l.thumb_fixed_size&&g(l.thumb_width,l.thumb_height,e),function(e){if(l.thumb_round_corners_radius<=0)return!1;var t={"border-radius":l.thumb_round_corners_radius+"px"};e?(e.css(t),e.find(".ug-thumb-border-overlay").css(t)):n.find(".ug-thumb-wrapper, .ug-thumb-wrapper .ug-thumb-border-overlay").css(t)}(e)}if(e.each(function(){f(jQuery(this))}),u.isEffectOverlay&&l.thumb_overlay_color){var t={};if(s.isRgbaSupported()){var i=s.convertHexToRGB(l.thumb_overlay_color,l.thumb_overlay_opacity);t["background-color"]=i}else t["background-color"]=l.thumb_overlay_color,u.colorOverlayOpacity=l.thumb_overlay_opacity;e.find(".ug-thumb-overlay").css(t)}},this.setThumbSelected=function(e){if(1==u.customThumbs&&e.removeClass("ug-thumb-over"),1==v(e))return!0;e.addClass("ug-thumb-selected"),m(e)},this.setThumbUnselected=function(e){e.removeClass("ug-thumb-selected"),r.setThumbNormalStyle(e,!1,"set unselected")},this.setOptions=function(e){l=jQuery.extend(l,e)},this.setThumbInnerReduce=function(e){u.thumbInnerReduce=e},this.setCustomThumbs=function(e,t,i){if(u.customThumbs=!0,"function"!=typeof e)throw new Error("The argument should be function");u.funcSetCustomThumbHtml=e,-1==jQuery.inArray("overlay",t)&&(u.isEffectOverlay=!1),-1==jQuery.inArray("border",t)&&(u.isEffectBorder=!1),u.isEffectImage=!1,i&&!1===i.allow_onresize&&(u.allowOnResize=!1)},this._____________EXTERNAL_GETTERS__________=function(){},this.getOptions=function(){return l},this.getNumThumbs=function(){return i.length},this.getThumbImage=function(e){return e.find(".ug-thumb-image")},this.getThumbByIndex=function(e){var t=r.getThumbs();if(e>=t.length||e<0)throw new Error("Wrong thumb index");return jQuery(t[e])},this.getThumbs=function(e){switch(e){default:case r.type.GET_THUMBS_ALL:var t=n.children(".ug-thumb-wrapper");break;case r.type.GET_THUMBS_NO_RATIO:t=n.children(".ug-thumb-wrapper").not(".ug-thumb-ratio-set");break;case r.type.GET_THUMBS_RATIO:t=n.children(".ug-thumb-wrapper.ug-thumb-ratio-set");break;case r.type.GET_THUMBS_NEW:t=n.children("."+u.classNewThumb)}return t},this.getItemByThumb=function(e){var t=e.data("index");return void 0===t&&(t=e.index()),i[t]},this.isThumbLoaded=function(e){return r.getItemByThumb(e).isLoaded},this.getGlobalThumbSize=function(){return{width:l.thumb_width,height:l.thumb_height}},this._____________EXTERNAL_OTHERS__________=function(){},this.initEvents=function(){1==u.allowOnResize&&t.on(d,y),o.on(r.events.THUMB_IMAGE_LOADED,w),n.on("touchstart",".ug-thumb-wrapper",function(){u.touchEnabled=!0,n.off("mouseenter").off("mouseleave")}),n.on("mouseenter",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return objThumbs.off("mouseenter").off("mouseleave"),!0;0==v(e)&&r.setThumbOverStyle(e)}(jQuery(this))}),n.on("mouseleave",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return!0;0==v(e)&&r.setThumbNormalStyle(e,!1)}(jQuery(this))})},this.destroy=function(){n.off("touchstart",".ug-thumb-wrapper"),t.off(d),n.off("mouseenter",".ug-thumb-wrapper"),n.off("mouseleave",".ug-thumb-wrapper"),o.off(r.events.THUMB_IMAGE_LOADED)},this.loadThumbsImages=function(){var e=n.find(".ug-thumb-image");s.checkImagesLoaded(e,null,function(e,t){0==t?I(e,!0):function(e){var t=r.getItemByThumb(e);if(t.isLoaded=!0,t.isThumbImageLoaded=!1,1==u.customThumbs)return o.trigger(r.events.IMAGELOADERROR,e),!0;e.children(".ug-thumb-loader").hide(),e.children(".ug-thumb-error").show()}(jQuery(e).parent())})},this.triggerImageLoadedEvent=function(e,t){o.trigger(r.events.THUMB_IMAGE_LOADED,[e,t])},this.hideThumbs=function(){n.find(".ug-thumb-wrapper").hide()}}function UGThumbsStrip(){var e,t,n,r,o,a,s,l,u=this,d=new UniteGalleryMain,_=new UGFunctions,g=!1,c=new UGThumbsGeneral,h=(_=new UGFunctions,{strip_vertical_type:!1,strip_thumbs_align:"left",strip_space_between_thumbs:6,strip_thumb_touch_sensetivity:15,strip_scroll_to_thumb_duration:500,strip_scroll_to_thumb_easing:"easeOutCubic",strip_control_avia:!0,strip_control_touch:!0,strip_padding_top:0,strip_padding_bottom:0,strip_padding_left:0,strip_padding_right:0}),p={isRunOnce:!1,is_placed:!1,isNotFixedThumbs:!1,handle:null},m={stripSize:0,stripActiveSize:0,stripInnerSize:0,thumbSize:0,thumbSecondSize:0};this.events={STRIP_MOVE:"stripmove",INNER_SIZE_CHANGE:"size_change"};var f={strip_thumbs_align:"top",thumb_resize_by:"width"};function b(){var e=c.getOptions();p.isNotFixedThumbs=!1===e.thumb_fixed_size,g=h.strip_vertical_type}function v(){var t,i,n,r,_;c.setHtmlProperties(),t=a.children(".ug-thumb-wrapper"),i=jQuery(t[0]),n=i.outerWidth(),r=i.outerHeight(),_=c.getOptions(),0==g?(m.thumbSize=n,1==_.thumb_fixed_size?m.thumbSecondSize=r:m.thumbSecondSize=_.thumb_height,y(o.width()),m.stripInnerSize=a.width()):(m.thumbSize=r,1==_.thumb_fixed_size?m.thumbSecondSize=n:m.thumbSecondSize=_.thumb_width,y(o.height()),m.stripInnerSize=a.height()),function(){if(0==g){var e=m.thumbSecondSize,t={};t.height=e+"px";var i={};i.height=e+"px"}else{var n=m.thumbSecondSize,t={};t.width=n+"px";var i={};i.width=n+"px"}o.css(t),a.css(i)}(),I(),0==p.isRunOnce&&(1==h.strip_control_touch&&(l=new UGTouchThumbsControl).init(u),1==h.strip_control_avia&&(s=new UGAviaControl).init(u),P(),c.loadThumbsImages(),c.initEvents(),o.find(".ug-thumb-wrapper").on("click touchend",function(e){!function(e){if(u.isTouchMotionActive()){var t=l.isSignificantPassed();if(1==t)return!0}var i=c.getItemByThumb(e);d.selectItem(i)}(jQuery(this))}),e.on(d.events.ITEM_CHANGE,j),p.isNotFixedThumbs&&jQuery(c).on(c.events.AFTERPLACEIMAGE,x)),p.isRunOnce=!0}function y(e){m.stripSize=e,m.stripActiveSize=0==g?m.stripSize-h.strip_padding_left-h.strip_padding_right:m.stripSize-h.strip_padding_top-h.strip_padding_bottom,m.stripActiveSize<0&&(m.stripActiveSize=0)}function I(){var e,t=a.children(".ug-thumb-wrapper"),n=0,r=0;for(0==g&&(r=h.strip_padding_top),i=0;i<t.length;i++){var o=jQuery(t[i]);if(1==p.isNotFixedThumbs){if(objItem=c.getItemByThumb(o),0==objItem.isLoaded)continue;o.show()}_.placeElement(o,n,r),0==g?n+=o.outerWidth()+h.strip_space_between_thumbs:r+=o.outerHeight()+h.strip_space_between_thumbs}if(0==g)var s=n-h.strip_space_between_thumbs;else s=r-h.strip_space_between_thumbs;e=s,0==g?a.width(e):a.height(e),m.stripInnerSize=e,P(),jQuery(u).trigger(u.events.INNER_SIZE_CHANGE)}function w(e){var t=u.getInnerStripPos()+e;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function E(e){var t=-1*A(e).min;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function T(e){var t=-1*A(e).max+m.stripSize;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function S(e){if(0==C())return!1;var t,i,n=(t={},i=u.getInnerStripPos(),t.minPosThumbs=-1*i+1,t.maxPosThumbs=-1*i+m.stripSize-1,t),r=A(e);if(r.min<n.minPosThumbs){var o=e.prev();o.length?E(o):E(e)}else if(r.max>n.maxPosThumbs){var a=e.next();a.length?T(a):T(e)}}function P(){1==C()?(s&&s.enable(),l&&l.enable()):(s&&s.disable(),l&&l.disable())}function x(){clearTimeout(p.handle),p.handle=setTimeout(function(){I()},50)}function j(){var e=d.getSelectedItem();c.setThumbSelected(e.objThumbWrapper),S(e.objThumbWrapper)}function C(){return m.stripInnerSize>m.stripActiveSize}function A(e){var t={},i=e.position();return 0==g?(t.min=i.left,t.max=i.left+m.thumbSize):(t.min=i.top,t.max=i.top+m.thumbSize),t}this.setHtml=function(e){if(!e){e=n;null!=h.parent_container&&(e=h.parent_container)}e.append("<div class='ug-thumbs-strip'><div class='ug-thumbs-strip-inner'></div></div>"),o=e.children(".ug-thumbs-strip"),a=o.children(".ug-thumbs-strip-inner"),c.setHtmlThumbs(a),1==p.isNotFixedThumbs&&c.hideThumbs()},this.destroy=function(){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.off(d.events.ITEM_CHANGE),jQuery(c).off(c.events.AFTERPLACEIMAGE),l&&l.destroy(),s&&s.destroy(),c.destroy()},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(i,o){!function(i,o){t=i.getObjects(),(d=i).attachThumbsPanel("strip",u),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,h=jQuery.extend(h,o),1==(g=h.strip_vertical_type)&&(h=jQuery.extend(h,f),h=jQuery.extend(h,o),o.thumb_resize_by="width"),c.init(i,o),b()}(i,o)},this.run=function(){v()},this.positionInnerStrip=function(e,t){if(void 0===t)t=!1;if(0==g)var i={left:e+"px"};else i={top:e+"px"};0==t?(a.css(i),u.triggerStripMoveEvent()):(u.triggerStripMoveEvent(),a.stop(!0).animate(i,{duration:h.strip_scroll_to_thumb_duration,easing:h.strip_scroll_to_thumb_easing,queue:!1,progress:function(){u.triggerStripMoveEvent()},always:function(){u.triggerStripMoveEvent()}}))},this.triggerStripMoveEvent=function(){jQuery(u).trigger(u.events.STRIP_MOVE)},this.isTouchMotionActive=function(){return!!l&&l.isTouchActive()},this.isItemThumbVisible=function(e){var t=e.objThumbWrapper,i=t.position(),n=-1*u.getInnerStripPos();if(0==g)var r=n+m.stripSize,o=i.left,a=i.left+t.width();else r=n+m.stripSize,o=i.top,a=i.top+t.height();var s=!1;return a>=n&&o<=r&&(s=!0),s},this.getInnerStripPos=function(){return 0==g?a.position().left:a.position().top},this.getInnerStripLimits=function(){var e={};return e.maxPos=0==g?h.strip_padding_left:h.strip_padding_top,e.minPos=-(m.stripInnerSize-m.stripActiveSize),e},this.fixInnerStripLimits=function(e){var t=u.getInnerStripLimits();return e>t.maxPos&&(e=t.maxPos),e<t.minPos&&(e=t.minPos),e},this.scrollForeward=function(){w(-m.stripSize)},this.scrollBack=function(){w(m.stripSize)},this.________EXTERNAL_SETTERS___________=function(){},this.setOptions=function(e){h=jQuery.extend(h,e),c.setOptions(e),b()},this.setSizeVertical=function(e){if(0==g)throw new Error("setSizeVertical error, the strip size is not vertical");var t=m.thumbSecondSize,i={};i.width=t+"px",i.height=e+"px",o.css(i),y(e);var n={};n.width=t+"px",n.left="0px",n.top="0px",a.css(n),p.is_placed=!0,P()},this.setSizeHorizontal=function(e){if(1==g)throw new Error("setSizeHorizontal error, the strip size is not horizontal");var t=m.thumbSecondSize+h.strip_padding_top+h.strip_padding_bottom,i={};i.width=e+"px",i.height=t+"px",o.css(i),y(e);var n=h.strip_padding_left,r={};r.height=t+"px",r.left=n+"px",r.top="0px",a.css(r),p.is_placed=!0,P()},this.setPosition=function(e,t,i,n){_.placeElement(o,e,t,i,n)},this.resize=function(e){0==g?(o.width(e),m.stripActiveSize=e-h.strip_padding_left-h.strip_padding_right):(o.height(e),m.stripActiveSize=e-h.strip_padding_top-h.strip_padding_bottom),y(e),P(),function(){if(0==C())return!1;var e=u.getInnerStripPos(),t=u.fixInnerStripLimits(e);e!=t&&u.positionInnerStrip(t,!0)}(),function(){if(C())return!1;0==g?_.placeElement(a,h.strip_thumbs_align,0):_.placeElement(a,0,h.strip_thumbs_align)}(),function(){var e=d.getSelectedItem();if(null==e)return!0;var t=e.objThumbWrapper;t&&S(t)}()},this.setThumbUnselected=function(e){c.setThumbUnselected(e)},this.setCustomThumbs=function(e){c.setCustomThumbs(e)},this.________EXTERNAL_GETTERS___________=function(){},this.getObjects=function(){var t=c.getOptions(),i=jQuery.extend(h,t);return{g_gallery:d,g_objGallery:e,g_objWrapper:n,g_arrItems:r,g_objStrip:o,g_objStripInner:a,g_aviaControl:s,g_touchThumbsControl:l,isVertical:g,g_options:i,g_thumbs:c}},this.getObjThumbs=function(){return c},this.getSelectedThumb=function(){var e=d.getSelectedItemIndex();return-1==e?null:c.getThumbByIndex(e)},this.getSizeAndPosition=function(){return _.getElementSize(o)},this.getHeight=function(){return o.outerHeight()},this.getWidth=function(){return o.outerWidth()},this.getSizes=function(){return m},this.isVertical=function(){return g},this.isPlaced=function(){return p.is_placed},this.isMoveEnabled=function(){return C()}}function UGTouchThumbsControl(){var e,t,i,n,r,o,a=new UGFunctions,s={touch_portion_time:200,thumb_touch_slowFactor:0,minDeltaTime:70,minPath:10,limitsBreakAddition:30,returnAnimateSpeed:500,animationEasing:"easeOutCubic",returnAnimationEasing:"easeOutCubic"},l={touch_active:!1,loop_active:!1,mousePos:0,innerPos:0,startPos:0,startTime:0,lastTime:0,buttonReleaseTime:0,lastPos:0,lastPortionPos:0,lastDeltaTime:0,lastDeltaPos:0,speed:0,handle:"",touchEnabled:!1,isControlEnabled:!0};function u(){var e=jQuery.now(),t={};return t.passedTime=l.lastTime-l.startTime,t.lastActiveTime=e-l.buttonReleaseTime,t.passedDistance=l.lastPos-l.startPos,t.passedDistanceAbs=Math.abs(t.passedDistance),t}function d(e){return 0==o?a.getMousePosition(e).pageX:a.getMousePosition(e).pageY}function _(){var e=jQuery.now();e-l.lastTime>=s.touch_portion_time&&(l.lastDeltaTime=e-l.lastTime,l.lastDeltaTime>s.touch_portion_time&&(l.lastDeltaTime=s.touch_portion_time),l.lastDeltaPos=l.lastPos-l.lastPortionPos,l.lastPortionPos=l.lastPos,l.lastTime=e)}function g(){l.lastPos=e.getInnerStripPos(),e.triggerStripMoveEvent()}function c(t){if(0==l.loop_active)return!0;if(t){d(t);!function(){var t=s.thumb_touch_slowFactor,i=s.minDeltaTime,r=s.minPath,a=e.getInnerStripPos(),u=jQuery.now()-l.lastTime,d=a-l.lastPortionPos;u<i&&l.lastDeltaTime>0&&(u=l.lastDeltaTime,d=l.lastDeltaPos+d),u<i&&(u=i);var _=0;u>0&&(_=d/u);var c=_*_/(2*t)*(d>0?1:-1);Math.abs(c)<=r&&(c=0);var h=e.getInnerStripPos(),p=h+c,m=e.fixInnerStripLimits(p),f=e.getInnerStripLimits(),b=s.limitsBreakAddition,v=!1,y=m;if(p>f.maxPos&&(v=!0,m=b,p<b&&(m=p)),p<f.minPos){v=!0;var I=f.minPos-b;m=I,p>I&&(m=p)}var w=m-h,E=Math.abs(Math.round(_/t));if(0!=c&&(E=E*w/c),h!=m){var T={left:m+"px"};1==o&&(T={top:m+"px"}),n.animate(T,{duration:E,easing:s.animationEasing,queue:!0,progress:g})}if(1==v){var S=s.returnAnimateSpeed,P={left:y+"px"};1==o&&(P={top:y+"px"}),n.animate(P,{duration:S,easing:s.returnAnimationEasing,queue:!0,progress:g})}}()}l.loop_active=!1,l.handle=clearInterval(l.handle)}function h(e){return 0==l.isControlEnabled||(l.buttonReleaseTime=jQuery.now(),0==l.touch_active?(c(e),!0):(e.preventDefault(),l.touch_active=!1,c(e),void i.removeClass("ug-dragging")))}function p(t){if(0==l.isControlEnabled)return!0;t.preventDefault(),l.touch_active=!0;var r=d(t);n.stop(!0),function(t){var i=e.getInnerStripPos();l.mousePos=t,l.innerPos=i,l.lastPortionPos=i,l.lastDeltaTime=0,l.lastDeltaPos=0,l.startTime=jQuery.now(),l.startPos=l.innerPos,l.lastTime=l.startTime,l.lastPos=l.startPos,l.speed=0}(r),function(){if(1==l.loop_active)return!0;l.loop_active=!0,l.handle=setInterval(_,10)}(),i.addClass("ug-dragging")}function m(t){if(0==l.isControlEnabled)return!0;if(0==l.touch_active)return!0;if(t.preventDefault(),0==t.buttons)return l.touch_active=!1,c(t),!0;var i=d(t);l.lastPos=e.getInnerStripPos(),function(t){var i=l.mousePos-t,n=l.innerPos-i,r=e.getInnerStripLimits();if(n>r.maxPos){var o=n-r.maxPos;n=r.maxPos+o/3}n<r.minPos&&(o=r.minPos-n,n=r.minPos-o/3);e.positionInnerStrip(n)}(i),_()}this.enable=function(){l.isControlEnabled=!0},this.disable=function(){l.isControlEnabled=!1},this.init=function(l){e=l,t=l.getObjects(),t.g_gallery,t.g_objGallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,s.thumb_touch_slowFactor=a.normalizeSetting(5e-5,.01,1,100,r.strip_thumb_touch_sensetivity,!0),i.bind("mousedown touchstart",p),jQuery(window).add("body").bind("mouseup touchend",h),jQuery("body").bind("mousemove touchmove",m)},this.isSignificantPassed=function(){var e=u();return e.passedTime>300||e.passedDistanceAbs>30},this.isTouchActive=function(){return 1==l.touch_active||(1==n.is(":animated")||u().lastActiveTime<50)},this.destroy=function(){i.unbind("mousedown"),i.unbind("touchstart"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),jQuery("body").unbind("mousemove").unbind("touchmove")}}function UGPanelsBase(){var e,t,i,n,r,o,a,s=new UniteGalleryMain,l=this,u=new UGFunctions;function d(t,n){switch(e.orientation){case"right":case"left":var r={left:t+"px"};break;case"top":case"bottom":r={top:t+"px"}}i.stop(!0).animate(r,{duration:300,easing:"easeInOutQuad",queue:!1,complete:function(){n&&n()}})}function _(t){switch(e.orientation){case"right":case"left":u.placeElement(i,t,null);break;case"top":case"bottom":u.placeElement(i,null,t)}}function g(){r.trigger(t.events.FINISH_MOVE)}this.init=function(i,o,l,u,d){e=o,t=l,s=i,n=u,r=d,a=jQuery(s)},this.setHtml=function(r){if(i=r,"strip"==e.panelType)var a=n.strippanel_enable_handle;else a=n.gridpanel_enable_handle;if(1==a&&((o=new UGPanelHandle).init(t,i,n,e.panelType,s),o.setHtml()),!0===e.isDisabledAtStart){i.append("<div class='ug-overlay-disabled'></div>"),setTimeout(function(){i.children(".ug-overlay-disabled").hide()},e.disabledAtStartTimeout)}},this.placeElements=function(){o&&o.placeHandle()},this.initEvents=function(){o&&(o.initEvents(),a.on(s.events.SLIDER_ACTION_START,function(){o.hideHandle()}),a.on(s.events.SLIDER_ACTION_END,function(){o.showHandle()}))},this.destroy=function(){o&&(o.destroy(),a.off(s.events.SLIDER_ACTION_START),a.off(s.events.SLIDER_ACTION_END))},this.openPanel=function(n){if(!n)n=!1;return!i.is(":animated")&&(0!=e.isClosed&&(e.isClosed=!1,r.trigger(t.events.OPEN_PANEL),void(!1===n?d(e.originalPos,g):(_(e.originalPos),g()))))},this.closePanel=function(n){if(!n)n=!1;if(i.is(":animated"))return!1;if(1==e.isClosed)return!1;var o=l.getClosedPanelDest();e.isClosed=!0,r.trigger(t.events.CLOSE_PANEL),!1===n?d(o,g):(_(o),g())},this.setClosedState=function(i){e.originalPos=i,r.trigger(t.events.CLOSE_PANEL),e.isClosed=!0},this.setOpenedState=function(i){r.trigger(t.events.OPEN_PANEL),e.isClosed=!1},this.getClosedPanelDest=function(){var t,n=u.getElementSize(i);switch(e.orientation){case"left":e.originalPos=n.left,t=-e.panelWidth;break;case"right":e.originalPos=n.left,t=s.getSize().width;break;case"top":e.originalPos=n.top,t=-e.panelHeight;break;case"bottom":e.originalPos=n.top,t=s.getSize().height}return t},this.isPanelClosed=function(){return e.isClosed},this.setDisabledAtStart=function(t){if(t<=0)return!1;e.isDisabledAtStart=!0,e.disabledAtStartTimeout=t}}function UGPanelHandle(){var e,t,i,n=new UGFunctions,r={panel_handle_align:"top",panel_handle_offset:0,panel_handle_skin:0};function o(){i.removeClass("ug-button-hover")}function a(e){if(e.stopPropagation(),e.stopImmediatePropagation(),0==n.validateClickTouchstartEvent(e.type))return!0;t.isPanelClosed()?t.openPanel():t.closePanel()}this.init=function(i,n,o,a,s){switch(t=i,e=n,a){case"grid":r.panel_handle_align=o.gridpanel_handle_align,r.panel_handle_offset=o.gridpanel_handle_offset,r.panel_handle_skin=o.gridpanel_handle_skin;break;case"strip":r.panel_handle_align=o.strippanel_handle_align,r.panel_handle_offset=o.strippanel_handle_offset,r.panel_handle_skin=o.strippanel_handle_skin;break;default:throw new Error("Panel handle error: wrong panel type: "+a)}var l=s.getOptions().gallery_skin;""==r.panel_handle_skin&&(r.panel_handle_skin=l)},this.setHtml=function(){var n="ug-panel-handle-tip";switch(t.getOrientation()){case"right":n+=" ug-handle-tip-left";break;case"left":n+=" ug-handle-tip-right";break;case"bottom":n+=" ug-handle-tip-top";break;case"top":n+=" ug-handle-tip-bottom"}e.append("<div class='"+n+" ug-skin-"+r.panel_handle_skin+"'></div>"),i=e.children(".ug-panel-handle-tip")},this.initEvents=function(){n.addClassOnHover(i),i.bind("click touchstart",a),jQuery(t).on(t.events.OPEN_PANEL,function(){o(),i.removeClass("ug-button-closed")}),jQuery(t).on(t.events.CLOSE_PANEL,function(){o(),i.addClass("ug-button-closed")})},this.destroy=function(){n.destroyButton(i),jQuery(t).off(t.events.OPEN_PANEL),jQuery(t).off(t.events.CLOSE_PANEL)},this.placeHandle=function(){var e=n.getElementSize(i);!function(){switch(t.getOrientation()){case"right":case"left":"top"!=r.panel_handle_align&&"bottom"!=r.panel_handle_align&&(r.panel_handle_align="top");break;case"bottom":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="left");break;case"top":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="right")}}();var o=t.getOrientation();switch(o){case"left":n.placeElement(i,"right",r.panel_handle_align,-e.width);break;case"right":n.placeElement(i,-e.width,r.panel_handle_align,0,r.panel_handle_offset);break;case"top":n.placeElement(i,r.panel_handle_align,"bottom",r.panel_handle_offset,-e.height);break;case"bottom":n.placeElement(i,r.panel_handle_align,"top",r.panel_handle_offset,-e.height);break;default:throw new Error("Wrong panel orientation: "+o)}},this.hideHandle=function(){1==i.is(":visible")&&i.hide()},this.showHandle=function(){0==i.is(":visible")&&i.show()}}function UGStripPanel(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGThumbsStrip,d=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var _={strippanel_vertical_type:!1,strippanel_padding_top:8,strippanel_padding_bottom:8,strippanel_padding_left:0,strippanel_padding_right:0,strippanel_enable_buttons:!0,strippanel_buttons_skin:"",strippanel_padding_buttons:2,strippanel_buttons_role:"scroll_strip",strippanel_enable_handle:!0,strippanel_handle_align:"top",strippanel_handle_offset:0,strippanel_handle_skin:"",strippanel_background_color:""},g={strip_vertical_type:!0,strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:0,strippanel_padding_bottom:0},c={strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:8,strippanel_padding_bottom:8},h={panelType:"strip",panelWidth:0,panelHeight:0,isEventsInited:!1,isClosed:!1,orientation:null,originalPos:null,isFirstRun:!0};function p(){if(1==h.isFirstRun&&0==function(){if(0==_.strippanel_vertical_type){if(0==h.panelWidth)throw new Error("Strip panel error: The width not set, please set width")}else if(0==h.panelHeight)throw new Error("Strip panel error: The height not set, please set height");if(null==h.orientation)throw new Error("Wrong orientation, please set panel orientation before run");return!0}())return!1;u.run(),f(),b(),function(){if(1==h.isEventsInited)return!1;if(h.isEventsInited=!0,n)if(l.addClassOnHover(n,"ug-button-hover"),l.addClassOnHover(r,"ug-button-hover"),l.setButtonOnClick(r,y),l.setButtonOnClick(n,v),"advance_item"!=_.strippanel_buttons_role)jQuery(u).on(u.events.STRIP_MOVE,w),jQuery(u).on(u.events.INNER_SIZE_CHANGE,I),e.on(s.events.SIZE_CHANGE,I);else{var t=s.getOptions();0==t.gallery_carousel&&jQuery(s).on(s.events.ITEM_CHANGE,E)}d.initEvents()}(),h.isFirstRun=!1,I()}function m(e){if(!e)e=t;if(e.append("<div class='ug-strip-panel'></div>"),i=e.children(".ug-strip-panel"),1==_.strippanel_enable_buttons){var o="ug-strip-arrow-left",a="ug-strip-arrow-right";1==_.strippanel_vertical_type&&(o="ug-strip-arrow-up",a="ug-strip-arrow-down"),i.append("<div class='ug-strip-arrow "+o+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>"),i.append("<div class='ug-strip-arrow "+a+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>")}d.setHtml(i),u.setHtml(i),1==_.strippanel_enable_buttons&&(r=i.children("."+o),n=i.children("."+a)),""!=_.strippanel_background_color&&i.css("background-color",_.strippanel_background_color)}function f(){0==_.strippanel_vertical_type?function(){var e=u.getHeight(),t=h.panelWidth;if(n){r.height(e),n.height(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_top+_.strippanel_padding_bottom;i.width(t),i.height(s),h.panelHeight=s;var d=t-_.strippanel_padding_left-_.strippanel_padding_right;n&&(d=d-2*n.outerWidth()-2*_.strippanel_padding_buttons),u.resize(d)}():function(){var e=u.getWidth(),t=h.panelHeight;if(n){r.width(e),n.width(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_left+_.strippanel_padding_right;i.width(s),i.height(t),h.panelWidth=s;var d=t-_.strippanel_padding_top-_.strippanel_padding_bottom;n&&(d=d-2*n.outerHeight()-2*_.strippanel_padding_buttons),u.resize(d)}()}function b(){0==_.strippanel_vertical_type?function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"right","top",_.strippanel_padding_right,_.strippanel_padding_top));var e=_.strippanel_padding_left;n&&(e+=n.outerWidth()+_.strippanel_padding_buttons),u.setPosition(e,_.strippanel_padding_top)}():function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"left","bottom",_.strippanel_padding_left,_.strippanel_padding_bottom));var e=_.strippanel_padding_top;n&&(e+=n.outerHeight()+_.strippanel_padding_buttons),u.setPosition(_.strippanel_padding_left,e)}(),d.placeElements()}function v(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.nextItem():u.scrollForeward()}function y(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.prevItem():u.scrollBack()}function I(){if(!n)return!0;if(0==u.isMoveEnabled())return l.disableButton(r),l.disableButton(n),!0;var e=u.getInnerStripLimits(),t=u.getInnerStripPos();t>=e.maxPos?l.disableButton(r):l.enableButton(r),t<=e.minPos?l.disableButton(n):l.enableButton(n)}function w(){I()}function E(){s.isLastItem()?l.disableButton(n):l.enableButton(n),s.isFirstItem()?l.disableButton(r):l.enableButton(r)}this.destroy=function(){n&&(l.destroyButton(n),l.destroyButton(r),jQuery(u).off(u.events.STRIP_MOVE),jQuery(s).off(s.events.ITEM_CHANGE),jQuery(s).off(s.events.SIZE_CHANGE)),d.destroy(),u.destroy()},this.getOrientation=function(){return h.orientation},this.setOrientation=function(e){h.orientation=e},this.init=function(i,n){!function(i,n){s=i,e=jQuery(s);var r=!1;1==(_=jQuery.extend(_,n)).strippanel_vertical_type&&(_=jQuery.extend(_,g),r=!0),0==_.strippanel_enable_buttons&&(_=jQuery.extend(_,c),r=!0),1==r&&(_=jQuery.extend(_,n));var l=s.getOptions().gallery_skin;""==_.strippanel_buttons_skin&&(_.strippanel_buttons_skin=l),t=s.getElement(),d.init(s,h,o,_,a),(u=new UGThumbsStrip).init(s,_)}(i,n)},this.run=function(){p()},this.setHtml=function(e){m(e)},this.getElement=function(){return i},this.getSize=function(){return l.getElementSize(i)},this.setWidth=function(e){h.panelWidth=e},this.setHeight=function(e){h.panelHeight=e},this.resize=function(e){o.setWidth(e),f(),b()},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return d.isPanelClosed()},this.getClosedPanelDest=function(){return d.getClosedPanelDest()},this.openPanel=function(e){d.openPanel(e)},this.closePanel=function(e){d.closePanel(e)},this.setOpenedState=function(e){d.setOpenedState(e)},this.setClosedState=function(e){d.setClosedState(e)},this.setCustomThumbs=function(e){u.setCustomThumbs(e)},this.setDisabledAtStart=function(e){d.setDisabledAtStart(e)}}function UGGridPanel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGThumbsGrid,u=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var d={gridpanel_vertical_scroll:!0,gridpanel_grid_align:"middle",gridpanel_padding_border_top:10,gridpanel_padding_border_bottom:4,gridpanel_padding_border_left:10,gridpanel_padding_border_right:10,gridpanel_arrows_skin:"",gridpanel_arrows_align_vert:"middle",gridpanel_arrows_padding_vert:4,gridpanel_arrows_align_hor:"center",gridpanel_arrows_padding_hor:10,gridpanel_space_between_arrows:20,gridpanel_arrows_always_on:!1,gridpanel_enable_handle:!0,gridpanel_handle_align:"top",gridpanel_handle_offset:0,gridpanel_handle_skin:"",gridpanel_background_color:""},_={gridpanel_grid_align:"middle",gridpanel_padding_border_top:2,gridpanel_padding_border_bottom:2},g={gridpanel_grid_align:"center"},c={panelType:"grid",isHorType:!1,arrowsVisible:!1,panelHeight:0,panelWidth:0,originalPosX:null,isEventsInited:!1,isClosed:!1,orientation:null};function h(){if(null==c.orientation)throw new Error("Wrong orientation, please set panel orientation before run")}function p(){h(),"center"==d.gridpanel_grid_align&&(d.gridpanel_grid_align="middle"),l.run(),function(){var e=!1;if(1==d.gridpanel_arrows_always_on)e=!0;else{var t=l.getNumPanes();t>1&&(e=!0)}1==e?(i.show().fadeTo(0,1),n.show().fadeTo(0,1),c.arrowsVisible=!0):(i.hide(),n.hide(),c.arrowsVisible=!1)}(),function(){var e=l.getSize();1==c.isHorType?c.panelHeight=e.height+d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom:c.panelWidth=e.width+d.gridpanel_padding_border_left+d.gridpanel_padding_border_right;s.setElementSize(t,c.panelWidth,c.panelHeight)}(),function(){0==c.isHorType?1==d.gridpanel_vertical_scroll?1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"top":e=d.gridpanel_padding_border_top+a.height+d.gridpanel_arrows_padding_vert;break;case"middle":e="middle";break;case"bottom":e=c.panelHeight-u.height-a.height-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert}var _=f(),g=l.getElement();s.placeElement(g,_,e);var u=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":t=(u.top-a.height)/2,r=u.bottom+(c.panelHeight-u.bottom-a.height)/2,o=0;break;case"grid":t=u.top-a.height-d.gridpanel_arrows_padding_vert_vert,r=u.bottom+d.gridpanel_arrows_padding_vert,o=0;break;case"border":case"borders":t=d.gridpanel_padding_border_top,r="bottom",o=d.gridpanel_padding_border_bottom}s.placeElement(n,"center",t),s.placeElement(i,"center",r,0,o)}():b():1==c.arrowsVisible?function(){var e,t,r,o=s.getElementSize(n),a=l.getSize(),u=d.gridpanel_padding_border_top;switch(d.gridpanel_grid_align){case"middle":switch(d.gridpanel_arrows_align_vert){default:var _=a.height+d.gridpanel_arrows_padding_vert+o.height;u=(c.panelHeight-_)/2;break;case"border":case"borders":var g=c.panelHeight-o.height-d.gridpanel_padding_border_bottom;u=(g-a.height)/2}break;case"bottom":var _=a.height+o.height+d.gridpanel_arrows_padding_vert;u=c.panelHeight-_-d.gridpanel_padding_border_bottom}var h=l.getElement(),p=f();s.placeElement(h,p,u);var a=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":e=a.bottom+(c.panelHeight-a.bottom-o.height)/2,r=0;break;case"grid":e=a.bottom+d.gridpanel_arrows_padding_vert,r=0;break;case"border":case"borders":e="bottom",r=d.gridpanel_padding_border_bottom}t=-o.width/2-d.gridpanel_space_between_arrows/2,s.placeElement(n,"center",e,t,r);var m=Math.abs(t);s.placeElement(i,"center",e,m,r)}():b():1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left+d.gridpanel_arrows_padding_hor+a.width;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-u.width-a.width-d.gridpanel_padding_border_right-d.gridpanel_arrows_padding_hor}var _=l.getElement();switch(s.placeElement(_,e,d.gridpanel_padding_border_top),u=l.getSize(),d.gridpanel_arrows_align_vert){default:case"center":case"middle":o=(u.height-a.height)/2+u.top;break;case"top":o=d.gridpanel_padding_border_top+d.gridpanel_arrows_padding_vert;break;case"bottom":o=c.panelHeight-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert-a.height}switch(d.gridpanel_arrows_align_hor){default:case"borders":t=d.gridpanel_padding_border_left,r=c.panelWidth-d.gridpanel_padding_border_right-a.width;break;case"grid":t=u.left-d.gridpanel_arrows_padding_hor-a.width,r=u.right+d.gridpanel_arrows_padding_hor;break;case"center":t=(u.left-a.width)/2,r=u.right+(c.panelWidth-u.right-a.width)/2}s.placeElement(n,t,o),s.placeElement(i,r,o)}():function(){var e,t=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-t.width-d.gridpanel_padding_border_right}var i=l.getElement();s.placeElement(i,e,d.gridpanel_padding_border_top)}();u.placeElements()}(),function(){if(1==c.isEventsInited)return!1;c.isEventsInited=!0,n&&(s.addClassOnHover(n),l.attachPrevPaneButton(n));i&&(s.addClassOnHover(i),l.attachNextPaneButton(i));u.initEvents()}()}function m(){e.append("<div class='ug-grid-panel'></div>"),t=e.children(".ug-grid-panel"),c.isHorType?(t.append("<div class='grid-arrow grid-arrow-left-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left-hortype"),i=t.children(".grid-arrow-right-hortype")):0==d.gridpanel_vertical_scroll?(t.append("<div class='grid-arrow grid-arrow-left ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left"),i=t.children(".grid-arrow-right")):(t.append("<div class='grid-arrow grid-arrow-up ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-down ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-up"),i=t.children(".grid-arrow-down")),u.setHtml(t),n.fadeTo(0,0),i.fadeTo(0,0),l.setHtml(t),""!=d.gridpanel_background_color&&t.css("background-color",d.gridpanel_background_color)}function f(){return d.gridpanel_padding_border_left}function b(){var e=d.gridpanel_grid_align,t=0;switch(e){case"top":t=d.gridpanel_padding_border_top;break;case"bottom":t=d.gridpanel_padding_border_bottom}var i=f(),n=l.getElement();s.placeElement(n,i,e,0,t)}this.destroy=function(){n&&s.destroyButton(n),i&&s.destroyButton(i),u.destroy(),l.destroy()},this.getOrientation=function(){return c.orientation},this.setOrientation=function(e){switch(c.orientation=e,e){case"right":case"left":c.isHorType=!1;break;case"top":case"bottom":c.isHorType=!0;break;default:throw new Error("Wrong grid panel orientation: "+e)}},this.setHeight=function(e){if(1==c.isHorType)throw new Error("setHeight is not appliable to this orientatio ("+c.orientation+"). Please use setWidth");c.panelHeight=e;var t,n,r=(t=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByHeight(n)?n:(t=s.getElementSize(i).height+d.gridpanel_arrows_padding_vert,1==d.gridpanel_vertical_scroll&&(t*=2),t+=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t));l.setMaxHeight(r)},this.setWidth=function(e){if(0==c.isHorType)throw new Error("setWidth is not appliable to this orientatio ("+c.orientation+"). Please use setHeight");c.panelWidth=e;var t,n,r=(t=d.gridpanel_padding_border_left+d.gridpanel_padding_border_right,n=c.panelWidth-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByWidth(n)?n:(t+=2*(s.getElementSize(i).width+d.gridpanel_arrows_padding_hor),n=c.panelWidth-t));l.setMaxWidth(r)},this.init=function(t,i){!function(t,i){a=t,h(),i&&i.vertical_scroll&&(d.gridpanel_vertical_scroll=i.vertical_scroll),d=jQuery.extend(d,i),1==c.isHorType?(d=jQuery.extend(d,g),d=jQuery.extend(d,i)):1==d.gridpanel_vertical_scroll&&(d=jQuery.extend(d,_),(d=jQuery.extend(d,i)).grid_panes_direction="bottom");var n=a.getOptions().gallery_skin;""==d.gridpanel_arrows_skin&&(d.gridpanel_arrows_skin=n);var s=t.getObjects();e=s.g_objWrapper,u.init(a,c,r,d,o),(l=new UGThumbsGrid).init(a,d)}(t,i)},this.setHtml=function(){m()},this.run=function(){p()},this.getElement=function(){return t},this.getSize=function(){return s.getElementSize(t)},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return u.isPanelClosed()},this.getClosedPanelDest=function(){return u.getClosedPanelDest()},this.openPanel=function(e){u.openPanel(e)},this.closePanel=function(e){u.closePanel(e)},this.setOpenedState=function(e){u.setOpenedState(e)},this.setClosedState=function(e){u.setClosedState(e)},this.setDisabledAtStart=function(e){u.setDisabledAtStart(e)}}function UGThumbsGrid(){var e,t,n,r,o,a,s=this,l=jQuery(this),u=new UniteGalleryMain,d=new UGFunctions,_=new UGThumbsGeneral,g=new UGTileDesign,c={grid_panes_direction:"left",grid_num_cols:2,grid_min_cols:2,grid_num_rows:2,grid_space_between_cols:10,grid_space_between_rows:10,grid_space_between_mobile:10,grid_transition_duration:300,grid_transition_easing:"easeInOutQuad",grid_carousel:!1,grid_padding:0,grid_vertical_scroll_ondrag:!1};this.events={PANE_CHANGE:"pane_change"};var h={eventSizeChange:"thumb_size_change",isHorizontal:!1,isMaxHeight:!1,isMaxWidth:!1,gridHeight:0,gridWidth:0,innerWidth:0,innerHeight:0,numPanes:0,arrPanes:0,numThumbs:0,currentPane:0,numThumbsInPane:0,isNavigationVertical:!1,touchActive:!1,startScrollPos:0,isFirstTimeRun:!0,isTilesMode:!1,storedEventID:"thumbsgrid",tileMaxWidth:null,tileMaxHeight:null,spaceBetweenCols:null,spaceBetweenRows:null};function p(i,o,a){var l;if(t=i.getObjects(),(u=i).attachThumbsPanel("grid",s),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,!0===a&&(h.isTilesMode=!0),h.numThumbs=r.length,l=o,c=jQuery.extend(c,l),_.setOptions(l),h.isNavigationVertical="top"==c.grid_panes_direction||"bottom"==c.grid_panes_direction,h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows,1==h.isTilesMode){g.setFixedMode(),g.setApproveClickFunction(j),g.init(i,c);var d=g.getOptions();h.tileMaxHeight=d.tile_height,h.tileMaxWidth=d.tile_width,_=g.getObjThumbs()}else o.thumb_fixed_size=!0,_.init(i,o)}function m(){var t=u.getSelectedItem();(function(){if(0==h.isHorizontal){if(0==h.gridHeight)throw new Error("You must set height before run.")}else if(0==h.gridWidth)throw new Error("You must set width before run.")}(),1==h.isFirstTimeRun)?(!function(){if(0==h.isTilesMode){_.initEvents();var t=o.find(".ug-thumb-wrapper");t.on("click touchend",C),e.on(u.events.ITEM_CHANGE,z)}else g.initEvents();o.bind("mousedown touchstart",A),jQuery("body").bind("mousemove touchmove",M),jQuery(window).add("body").bind("mouseup touchend",O)}(),1==h.isTilesMode?(b(),v(),g.run()):(_.setHtmlProperties(),v(),_.loadThumbsImages())):1==h.isTilesMode&&1==b()&&(v(),g.run());if(0==h.isHorizontal?h.isNavigationVertical?function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(l);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t+=p+h.spaceBetweenCols;var f=n+m;f>r&&(r=f),++s>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=l,s=0),1==h.numPanes&&h.numThumbsInPane++,f=n+m;var b=u+h.gridHeight;f>b&&(1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(h.gridHeight),b=h.gridHeight),n=b+h.spaceBetweenRows,u=n,t=l=0,s=0,i<_-1&&(h.numPanes++,h.arrPanes.push(n)))}a.height(r),h.innerHeight=r,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(r))}():function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(s);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t>l&&(l=t);var f=n+m;f>u&&(u=f);var b=l+p;b>h.innerWidth&&(h.innerWidth=b),t+=p+h.spaceBetweenCols,++r>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=s,r=0),1==h.numPanes&&h.numThumbsInPane++,n+m>h.gridHeight&&(n=0,s=h.innerWidth+h.spaceBetweenCols,t=s,r=0,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(h.gridHeight)),i<_-1&&(h.numPanes++,h.arrPanes.push(s)))}a.width(h.innerWidth),1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(u))}():function(){var e=a.children(".ug-thumb-wrapper"),t=c.grid_padding,n=c.grid_padding,r=n,s=t,l=0,u=0,_=0,g=0,p=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(t-c.grid_padding);var m=e.length;for(i=0;i<m;i++){var f=jQuery(e[i]),b=f.outerWidth(),v=f.outerHeight();s-t+b>h.gridWidth&&(r=0,++p>=c.grid_num_rows?(p=0,t=s,r=n,_=0,1==h.numPanes&&(h.gridWidth=l+c.grid_padding,o.width(h.gridWidth),h.gridHeight=g+c.grid_padding,o.height(h.gridHeight)),h.numPanes++,h.arrPanes.push(t-c.grid_padding)):(s=t,r=_+h.spaceBetweenRows)),d.placeElement(f,s,r);var y=s+b;y>l&&(l=y);var I=r+v;I>_&&(_=I),I>g&&(g=I),I>u&&(u=I);var y=l+b;y>h.innerWidth&&(h.innerWidth=y),s+=b+h.spaceBetweenCols,1==h.numPanes&&h.numThumbsInPane++}h.innerWidth=l+c.grid_padding,h.innerHeight=g+c.grid_padding,a.width(h.innerWidth),a.height(h.innerHeight),1==h.numPanes&&(h.gridWidth=l+c.grid_padding,h.gridHeight=g+c.grid_padding,o.width(h.gridWidth),o.height(h.gridHeight))}(),1==h.isFirstTimeRun&&h.isTilesMode){var r=_.getThumbs();r.each(function(e,t){n.trigger(h.eventSizeChange,jQuery(t))}),r.fadeTo(0,1)}null!=t&&y(t.index),l.trigger(s.events.PANE_CHANGE,h.currentPane),h.isFirstTimeRun=!1}function f(){if(1==h.isTilesMode)var e=g.getGlobalTileSize();else e=_.getGlobalThumbSize();return e}function b(){if(0==h.isTilesMode)throw new Error("Dynamic size can be set only in tiles mode");var e=!1,t=u.isMobileMode(),i=h.spaceBetweenCols;1==t?(h.spaceBetweenCols=c.grid_space_between_mobile,h.spaceBetweenRows=c.grid_space_between_mobile):(h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows),h.spaceBetweenCols!=i&&(e=!0);var n=f().width,r=h.tileMaxWidth;return d.getNumItemsInSpace(h.gridWidth,h.tileMaxWidth,h.spaceBetweenCols)<c.grid_min_cols&&(r=d.getItemSizeInSpace(h.gridWidth,c.grid_min_cols,h.spaceBetweenCols)),g.setTileSizeOptions(r),r!=n&&(e=!0),e}function v(){var e,t,i;0==h.isHorizontal?(e=f().width,t=c.grid_num_cols*e+(c.grid_num_cols-1)*h.spaceBetweenCols+2*c.grid_padding,i=h.gridHeight,h.gridWidth=t,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i):function(){var e=f().height,t=h.gridWidth,i=c.grid_num_rows*e+(c.grid_num_rows-1)*h.spaceBetweenRows+2*c.grid_padding;h.gridHeight=i,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i}()}function y(e){var t=P(e);if(-1==t)return!1;s.gotoPane(t,"scroll")}function I(e){if(e>=h.numPanes||e<0)throw new Error("Pane "+index+" doesn't exists.");return!0}function w(e){var t=T(e);if(0==t)return!1;a.stop(!0).animate(t,{duration:c.grid_transition_duration,easing:c.grid_transition_easing,queue:!1})}function E(){w(-h.arrPanes[h.currentPane])}function T(e){var t={};return 1==h.isNavigationVertical?t.top=e+"px":t.left=e+"px",t}function S(){var e=d.getElementSize(a);return 1==h.isNavigationVertical?e.top:e.left}function P(e){return 0==function(e){if(e<0||e>=h.numThumbs)throw new Error("Thumb not exists: "+e);return!0}(e)?-1:Math.floor(e/h.numThumbsInPane)}function x(){var e=d.getStoredEventData(h.storedEventID),t=S();diffPos=Math.abs(e.startInnerPos-t);var i=1==h.isNavigationVertical?h.gridHeight:h.gridWidth,n=Math.round(3*i/8);return diffPos>=n||e.diffTime<300&&diffPos>25}function j(){return 1==h.numPanes||d.isApproveStoredEventClick(h.storedEventID,h.isNavigationVertical)}function C(e){if(1==function(){if(1==h.numPanes)return!1;var e=d.getStoredEventData(h.storedEventID),t=e.diffTime,i=S(),n=Math.abs(i-e.startInnerPos);return n>30||n>5&&t>300}())return!0;var t=jQuery(this),i=_.getItemByThumb(t);u.selectItem(i)}function A(e){if(1==h.numPanes)return!0;if(1==h.touchActive)return!0;0==h.isTilesMode&&e.preventDefault(),h.touchActive=!0;var t={startInnerPos:S()};d.storeEventData(e,h.storedEventID,t)}function M(e){if(0==h.touchActive)return!0;e.preventDefault(),d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(0!=c.grid_vertical_scroll_ondrag&&1!=h.isNavigationVertical&&"vert"===d.handleScrollTop(h.storedEventID))return!0;var i=t.diffMousePos,n=t.startInnerPos+i,r=i>0?"prev":"next",o=h.arrPanes[h.numPanes-1];0==c.grid_carousel&&n>0&&"prev"==r&&(n/=3),0==c.grid_carousel&&n<-o&&"next"==r&&(n=t.startInnerPos+i/3),function(e){var t=T(e);if(0==t)return!1;a.css(t)}(n)}function O(e){if(0==h.touchActive)return!0;d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(h.touchActive=!1,0==x())return E(),!0;"next"==(S()-t.startInnerPos>0?"prev":"next")?0==c.grid_carousel&&s.isLastPane()?E():s.nextPane():0==c.grid_carousel&&s.isFirstPane()?E():s.prevPane()}function z(){var e=u.getSelectedItem();_.setThumbSelected(e.objThumbWrapper),y(e.index)}this.destroy=function(){if(0==h.isTilesMode){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.on(u.events.ITEM_CHANGE),_.destroy()}else g.destroy();o.unbind("mousedown"),o.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("touchend"),jQuery(window).add("body").unbind("mouseup"),l.off(s.events.PANE_CHANGE)},this.__________EXTERNAL_GENERAL_________=function(){},this.setThumbUnselected=function(e){_.setThumbUnselected(e)},this.isItemThumbVisible=function(e){return P(e.index)==h.currentPane},this.__________EXTERNAL_API_________=function(){},this.getNumPanesEstimationByHeight=function(e){if(1==h.isTilesMode)var t=c.tile_height;else t=_.getOptions().thumb_height;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_cols),r=n*t+(n-1)*h.spaceBetweenRows;return Math.ceil(r/e)},this.getNumPanesEstimationByWidth=function(e){if(h.isTilesMode)var t=c.tile_width;else t=_.getOptions().thumb_width;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_rows),r=n*t+(n-1)*h.spaceBetweenCols;return Math.ceil(r/e)},this.getHeightEstimationByWidth=function(e){if(0==h.isTilesMode)throw new Error("This function works only with tiles mode");var t=_.getNumThumbs(),i=d.getNumItemsInSpace(e,c.tile_width,h.spaceBetweenCols),n=Math.ceil(t/i);n>c.grid_num_rows&&(n=c.grid_num_rows);var r=d.getSpaceByNumItems(n,c.tile_height,h.spaceBetweenRows);return r+=2*c.grid_padding},this.getElement=function(){return o},this.getSize=function(){return d.getElementSize(o)},this.getNumPanes=function(){return h.numPanes},this.isFirstPane=function(){return 0==h.currentPane},this.isLastPane=function(){return h.currentPane==h.numPanes-1},this.getPaneInfo=function(){return{pane:h.currentPane,total:h.numPanes}},this.getPane=function(){return h.currentPane},this.setWidth=function(e){h.gridWidth=e,h.isHorizontal=!0},this.setMaxWidth=function(e){h.gridWidth=e,h.isMaxWidth=!0,h.isHorizontal=!0},this.setHeight=function(e){h.gridHeight=e,h.isHorizontal=!1},this.setMaxHeight=function(e){h.gridHeight=e,h.isMaxHeight=!0,h.isHorizontal=!1},this.gotoPane=function(e,t){if(0==I(e))return!1;if(e==h.currentPane)return!1;var i=-h.arrPanes[e];h.currentPane=e,w(i),l.trigger(s.events.PANE_CHANGE,e)},this.nextPane=function(){var e=h.currentPane+1;if(e>=h.numPanes){if(0==c.grid_carousel)return!0;e=0}s.gotoPane(e,"next")},this.prevPane=function(){var e=h.currentPane-1;if(e<0&&(e=h.numPanes-1,0==c.grid_carousel))return!1;s.gotoPane(e,"prev")},this.attachNextPaneButton=function(e){if(d.setButtonOnClick(e,s.nextPane),1==c.grid_carousel)return!0;s.isLastPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isLastPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachPrevPaneButton=function(e){if(d.setButtonOnClick(e,s.prevPane),1==c.grid_carousel)return!0;s.isFirstPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isFirstPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachBullets=function(e){e.setActive(h.currentPane),jQuery(e).on(e.events.BULLET_CLICK,function(t,i){s.gotoPane(i,"theme"),e.setActive(i)}),jQuery(s).on(s.events.PANE_CHANGE,function(t,i){e.setActive(i)})},this.getObjTileDesign=function(){return g},this.init=function(e,t,i){p(e,t,i)},this.run=function(){m()},this.setHtml=function(e){!function(e){var t=n;e&&(t=e),t.append("<div class='ug-thumbs-grid'><div class='ug-thumbs-grid-inner'></div></div>"),o=t.children(".ug-thumbs-grid"),a=o.children(".ug-thumbs-grid-inner"),1==h.isTilesMode?g.setHtml(a):_.setHtmlThumbs(a)}(e)}}function UGTileDesign(){var e,t,i=this,n=jQuery(this),r=new UniteGalleryMain,o=new UGFunctions,a=new UGThumbsGeneral;this.resizemode={FULL:"full",WRAPPER_ONLY:"wrapper_only",VISIBLE_ELEMENTS:"visible_elements"},this.sizeby={GLOBAL_RATIO:"global_ratio",TILE_RATIO:"tile_ratio",IMAGE_RATIO:"image_ratio",CUSTOM:"custom"},this.events={TILE_CLICK:"tile_click"};var s={tile_width:250,tile_height:200,tile_size_by:i.sizeby.IMAGE_RATIO,tile_visible_before_image:!1,tile_enable_background:!0,tile_background_color:"#F0F0F0",tile_enable_border:!1,tile_border_width:3,tile_border_color:"#F0F0F0",tile_border_radius:0,tile_enable_outline:!1,tile_outline_color:"#8B8B8B",tile_enable_shadow:!1,tile_shadow_h:1,tile_shadow_v:1,tile_shadow_blur:3,tile_shadow_spread:2,tile_shadow_color:"#8B8B8B",tile_enable_action:!0,tile_as_link:!1,tile_link_newpage:!0,tile_enable_overlay:!0,tile_overlay_opacity:.4,tile_overlay_color:"#000000",tile_enable_icons:!0,tile_show_link_icon:!1,tile_videoplay_icon_always_on:"never",tile_space_between_icons:26,tile_enable_image_effect:!1,tile_image_effect_type:"bw",tile_image_effect_reverse:!1,tile_enable_textpanel:!1,tile_textpanel_source:"title",tile_textpanel_always_on:!1,tile_textpanel_appear_type:"slide",tile_textpanel_position:"inside_bottom",tile_textpanel_offset:0},l={thumb_color_overlay_effect:!0,thumb_overlay_reverse:!0,thumb_image_overlay_effect:!1,tile_textpanel_enable_description:!1,tile_textpanel_bg_opacity:.6,tile_textpanel_padding_top:8,tile_textpanel_padding_bottom:8},u={ratioByHeight:0,ratioByWidth:0,eventSizeChange:"thumb_size_change",funcCustomTileHtml:null,funcCustomPositionElements:null,funcParentApproveClick:null,isSaparateIcons:!1,tileInnerReduce:0,isTextpanelOutside:!1,hasImageContainer:!1,isVideoplayIconAlwaysOn:!1,isTextPanelHidden:!1};function d(e,n){r=e,jQuery(e);var d=r.getObjects();t=d.g_objWrapper,r.getArrItems(),s=jQuery.extend(s,l),s=jQuery.extend(s,n),function(){1==s.tile_enable_overlay?(s.thumb_overlay_opacity=s.tile_overlay_opacity,s.thumb_overlay_color=s.tile_overlay_color):0==s.tile_enable_icons?s.thumb_color_overlay_effect=!1:s.thumb_overlay_opacity=0;s.tile_as_link&&(s.thumb_wrapper_as_link=!0,s.thumb_link_newpage=s.tile_link_newpage);1==s.tile_enable_outline&&0==s.tile_enable_border&&(s.tile_enable_outline=!1);u.tileInnerReduce=0,s.tile_enable_border&&(u.tileInnerReduce=2*s.tile_border_width,a.setThumbInnerReduce(u.tileInnerReduce));if(u.isSaparateIcons=!o.isRgbaSupported(),1==s.tile_enable_textpanel){switch(s.tile_textpanel_position){case"top":s.tile_textpanel_align="top";case"bottom":u.isTextpanelOutside=!0,s.tile_textpanel_always_on=!0,s.tile_textpanel_offset=0;break;case"inside_top":s.tile_textpanel_align="top";break;case"middle":s.tile_textpanel_align="middle",s.tile_textpanel_appear_type="fade"}0==s.tile_textpanel_always_on&&(u.isSaparateIcons=!0)}0!=s.tile_textpanel_offset&&(s.tile_textpanel_appear_type="fade",s.tile_textpanel_margin=s.tile_textpanel_offset);"title_and_desc"==s.tile_textpanel_source&&(s.tile_textpanel_enable_description=!0,s.tile_textpanel_desc_style_as_title=!0)}(),a.init(e,s);var _=["overlay"];u.funcCustomTileHtml&&(_=[]),a.setCustomThumbs(g,_,{allow_onresize:!1});var c=a.getOptions();s=jQuery.extend(s,c),u.ratioByWidth=s.tile_width/s.tile_height,u.ratioByHeight=s.tile_height/s.tile_width,s.tile_size_by==i.sizeby.GLOBAL_RATIO&&u.isTextpanelOutside&&(u.hasImageContainer=!0)}function _(){var e=r.isMobileMode();switch(u.isTextPanelHidden=!1,1==e&&0==s.tile_textpanel_always_on&&(u.isTextPanelHidden=!0),u.isVideoplayIconAlwaysOn=s.tile_videoplay_icon_always_on,s.tile_videoplay_icon_always_on){case"always":u.isVideoplayIconAlwaysOn=!0;break;case"never":u.isVideoplayIconAlwaysOn=!1;break;case"mobile_only":u.isVideoplayIconAlwaysOn=1==e;break;case"desktop_only":u.isVideoplayIconAlwaysOn=0==e}}function g(e,t){if(e.addClass("ug-tile"),u.funcCustomTileHtml)return u.funcCustomTileHtml(e,t),!1;var n="";1==u.hasImageContainer&&(n+="<div class='ug-image-container ug-trans-enabled'>");var a="ug-thumb-image";0!=s.tile_enable_image_effect&&1!=s.tile_image_effect_reverse||(a+=" ug-trans-enabled");var l=o.stripTags(t.title);l=o.htmlentitles(l),n+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+l+"' class='"+a+"'>",1==u.hasImageContainer&&(n+="</div>"),e.append(n),s.tile_size_by==i.sizeby.GLOBAL_RATIO&&e.fadeTo(0,0);var d={};if(1==s.tile_enable_background&&(d["background-color"]=s.tile_background_color),1==s.tile_enable_border&&(d["border-width"]=s.tile_border_width+"px",d["border-style"]="solid",d["border-color"]=s.tile_border_color,s.tile_border_radius&&(d["border-radius"]=s.tile_border_radius+"px")),1==s.tile_enable_outline&&(d.outline="1px solid "+s.tile_outline_color),1==s.tile_enable_shadow){var _=s.tile_shadow_h+"px ";_+=s.tile_shadow_v+"px ",_+=s.tile_shadow_blur+"px ",_+=s.tile_shadow_spread+"px ",_+=s.tile_shadow_color,d["box-shadow"]=_}e.css(d);var g="";if(s.tile_enable_icons){if(0==s.tile_as_link&&1==s.tile_enable_action){var c="ug-button-play ug-icon-zoom";"image"!=t.type&&(c="ug-button-play ug-icon-play"),g+="<div class='ug-tile-icon "+c+"' style='display:none'></div>"}if(t.link&&1==s.tile_show_link_icon||1==s.tile_as_link)if(0==s.tile_as_link){var h="";1==s.tile_link_newpage&&(h=" target='_blank'"),g+="<a href='"+t.link+"'"+h+" class='ug-tile-icon ug-icon-link'></a>"}else g+="<div class='ug-tile-icon ug-icon-link' style='display:none'></div>";var m=u.isSaparateIcons;if(0==m&&"image"!=t.type&&1==u.isVideoplayIconAlwaysOn&&(m=!0),m)var f=e;else f=e.children(".ug-thumb-overlay");f.append(g);var b=f.children("."+c);0==b.length?b=null:b.hide();var v=f.children(".ug-icon-link");0==v.length?v=null:v.hide(),v||1!=s.tile_enable_action||e.addClass("ug-tile-clickable")}else 1==s.tile_enable_action&&e.addClass("ug-tile-clickable");if(1==s.tile_enable_image_effect){var y="";0==s.tile_image_effect_reverse&&(y=" ug-trans-enabled");var I="<div class='ug-tile-image-overlay"+y+"' >",w=" ug-"+s.tile_image_effect_type+"-effect";I+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+t.title+"' class='"+w+y+"'>",I+="</div>",e.append(I),1==s.tile_image_effect_reverse&&e.children(".ug-tile-image-overlay").fadeTo(0,0)}if(1==s.tile_enable_textpanel){var E=new UGTextPanel;E.init(r,s,"tile");var T="";1!=s.tile_textpanel_always_on&&1!=u.isTextpanelOutside||(T="ug-trans-enabled"),E.appendHTML(e,T);var S=t.title,P="";switch(s.tile_textpanel_source){case"desc":case"description":S=t.description;break;case"desc_title":""!=t.description&&(S=t.description);break;case"title_and_desc":S=t.title,P=t.description}if(E.setTextPlain(S,P),0==s.tile_textpanel_always_on&&E.getElement().fadeTo(0,0),e.data("objTextPanel",E),1==s.tile_textpanel_always_on)p(e).css("z-index",2);if(1==u.isTextpanelOutside){e.append("<div class='ug-tile-cloneswrapper'></div>");var x=e.children(".ug-tile-cloneswrapper"),j=new UGTextPanel;j.init(r,s,"tile"),j.appendHTML(x),j.setTextPlain(S,P),e.data("objTextPanelClone",j)}}null!==t.addHtml&&e.append(t.addHtml)}function c(e){return e.children(".ug-tile-image-overlay")}function h(e){return e.data("objTextPanel")}function p(e){return e.children(".ug-textpanel")}function m(e){if(1==u.isTextpanelOutside)var t=function(e){var t=e.find(".ug-tile-cloneswrapper .ug-textpanel");if(0==t.length)throw new Error("text panel cloned element not found");return t}(e);else t=p(e);return t?o.getElementSize(t).height:0}function f(e){var t=e.find(".ug-icon-link");return 0==t.length?null:t}function b(e){var t=e.find(".ug-button-play");return 0==t.length?null:t}function v(e){return!!e.hasClass("ug-thumb-over")}function y(e){return e.hasClass("ug-tile-clickable")}function I(e){return 1==s.tile_enable_icons&&1==u.isVideoplayIconAlwaysOn&&"image"!=e.type}function w(e,t,n,r){var a=c(e),l=i.getTileImage(e),d=function(e){return e.find(".ug-tile-image-overlay img")}(e);t-=u.tileInnerReduce,n-=u.tileInnerReduce;var _=null;if(1==u.isTextpanelOutside){var g=m(e);if(n-=g,"top"==s.tile_textpanel_position&&(_=g),1==u.hasImageContainer){var h=function(e){return 0==u.hasImageContainer?null:e.children(".ug-image-container")}(e);o.setElementSize(h,t,n),null!==_&&o.placeElement(h,0,_)}}if(0==s.tile_enable_image_effect)o.scaleImageCoverParent(l,t,n),0==u.hasImageContainer&&null!==_&&o.placeElement(l,0,_);else{var p="nothing";!0===r&&0==u.isTextpanelOutside&&(p=1==s.tile_image_effect_reverse?"effect":"image"),"effect"!=p&&(o.setElementSize(a,t,n),null!==_&&o.placeElement(a,0,_),o.scaleImageCoverParent(d,t,n)),"image"!=p&&(1==u.hasImageContainer?o.scaleImageCoverParent(l,t,n):"effect"==p?(o.scaleImageCoverParent(l,t,n),null!==_&&o.placeElement(l,0,_)):o.cloneElementSizeAndPos(d,l,!1,null,_))}}function E(e,t,n,r){var o=null;if(n&&(o=n-u.tileInnerReduce),r&&(r-=u.tileInnerReduce),"clone"==t)return function(e){return e.data("objTextPanelClone")}(e).refresh(!0,!0,o),i.getItemByTile(e).textPanelCloneSizeSet=!0,!1;var a=h(e);if(!a)return!1;var l=null;if(1==u.isTextpanelOutside&&(l=m(e)),a.refresh(!1,!0,o,l),1==s.tile_textpanel_always_on||"fade"==s.tile_textpanel_appear_type)if(1==u.isTextpanelOutside&&r&&"bottom"==s.tile_textpanel_position){var d=r-l;a.positionPanel(d)}else a.positionPanel()}function T(e){i.getItemByTile(e);var t=b(e),n=f(e),r=o.getElementSize(e);w(e,r.width,r.height),1==s.tile_enable_textpanel&&E(e,"regular",r.width,r.height);var a=r.width-u.tileInnerReduce,l=r.height-u.tileInnerReduce,d=0;if(1==u.isTextpanelOutside){var _=m(e);l-=_,"top"==s.tile_textpanel_position&&(d=_)}var g=function(e){return e.children(".ug-thumb-overlay")}(e);if(o.setElementSizeAndPosition(g,0,d,a,l),t||n){var c=0;if(1==s.tile_enable_textpanel&&0==u.isTextPanelHidden&&0==u.isTextpanelOutside){var h=p(e),v=o.getElementSize(h);v.height>0&&(c=Math.floor(v.height/2*-1))}}if(t&&n){var y=o.getElementSize(t),I=o.getElementSize(n),T=s.tile_space_between_icons,S=y.width+T+I.width,P=Math.floor((r.width-S)/2);P<T&&(T=Math.floor((r.width-y.width-I.width)/3),S=y.width+T+I.width,P=Math.floor((r.width-S)/2)),o.placeElement(t,P,"middle",0,c),o.placeElement(n,P+y.width+T,"middle",0,c)}else t&&o.placeElement(t,"center","middle",0,c),n&&o.placeElement(n,"center","middle",0,c);t&&t.show(),n&&n.show()}function S(e,t){i.getItemByTile(e);var n=c(e),r=s.thumb_transition_duration;if(0==s.tile_image_effect_reverse){var o=i.getTileImage(e);t?(o.fadeTo(0,1),n.stop(!0).fadeTo(r,0)):n.stop(!0).fadeTo(r,1)}else t?n.stop(!0).fadeTo(r,1):n.stop(!0).fadeTo(r,0)}function P(e,t){var i=s.thumb_transition_duration,n=p(e);if(!n)return!0;if("slide"==s.tile_textpanel_appear_type){var r=o.getElementSize(n);if(0==r.width)return!1;var a=-r.height,l={},u={},d="bottom";"inside_top"==s.tile_textpanel_position&&(d="top"),l[d]=a+"px",u[d]="0px",1==t?(n.fadeTo(0,1),0==n.is(":animated")&&n.css(l),u.opacity=1,n.stop(!0).animate(u,i)):n.stop(!0).animate(l,i)}else 1==t?n.stop(!0).fadeTo(i,1):n.stop(!0).fadeTo(i,0)}function x(e,t,i){var n=s.thumb_transition_duration;i&&!0===i&&(n=0);var r=b(e),o=f(e),a=t?1:0;r&&r.stop(!0).fadeTo(n,a),o&&o.stop(!0).fadeTo(n,a)}function j(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!0),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&0==u.isTextPanelHidden&&P(t,!0),u.isSaparateIcons&&1==s.tile_enable_icons){var n=1==s.thumb_overlay_reverse;0==I(i.getItemByTile(t))&&x(t,n,!1)}}function C(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!1),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&P(t,!1),1==u.isSaparateIcons&&1==s.tile_enable_icons){var n=1!=s.thumb_overlay_reverse;0==I(i.getItemByTile(t))?x(t,n,!1):x(t,!0,!0)}}function A(e,t,i){if(t=jQuery(t),1==s.tile_visible_before_image&&!0!==t.data("image_placed")&&!0!==i)return!0;T(t),a.setThumbNormalStyle(t)}function M(e,t,i){T(t),i.fadeTo(0,1),t.data("image_placed",!0)}function O(e){if(1==y(e))return n.trigger(i.events.TILE_CLICK,e),!0;var t;0==v(e)&&(t=e,a.getThumbs().not(t).each(function(e,t){a.setThumbNormalStyle(jQuery(t))}),a.setThumbOverStyle(e))}function z(e){var t=jQuery(this),r=t.prop("tagName").toLowerCase(),o=!0;if(u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(o=!1),"a"==r)0==o&&e.preventDefault();else if(0==v(t))1==o&&O(t);else{if(0==y(t))return!0;1==o&&n.trigger(i.events.TILE_CLICK,t)}}function L(e){e.stopPropagation();var t=jQuery(this).parents(".ug-tile"),r=!0;return u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(r=!1),0==v(t)?(O(t),!0):1==r?(n.trigger(i.events.TILE_CLICK,t),!1):void 0}function H(e){var t=jQuery(this).parents(".ug-tile");u.funcParentApproveClick&&0==u.funcParentApproveClick()&&e.preventDefault(),0==v(t)&&0==s.tile_as_link&&(e.preventDefault(),O(t))}this.loadTileImage=function(e){var t=i.getTileImage(e);o.checkImagesLoaded(t,null,function(t,i){M(null,e,jQuery(t))})},this.setHtml=function(t,i){e=t,!0!==i&&_(),a.setHtmlThumbs(t,i)},this.initEvents=function(){a.initEvents(),jQuery(a).on(a.events.SETOVERSTYLE,j),jQuery(a).on(a.events.SETNORMALSTYLE,C),jQuery(a).on(a.events.PLACEIMAGE,M),t.on(u.eventSizeChange,A),e.on("click",".ug-tile",z),e.on("click",".ug-tile .ug-button-play",L),e.on("click",".ug-tile .ug-icon-link",H)},this.destroy=function(){if(e.off("click",".ug-tile"),e.off("click",".ug-tile .ug-button-play"),e.off("click",".ug-tile .ug-icon-link"),jQuery(a).off(a.events.SETOVERSTYLE),jQuery(a).off(a.events.SETNORMALSTYLE),jQuery(a).off(a.events.PLACEIMAGE),t.off(u.eventSizeChange),1==s.tile_enable_textpanel){var i=a.getThumbs();jQuery.each(i,function(e,t){var i=h(jQuery(t));i&&i.destroy()})}a.destroy()},this.init=function(e,t,i){d(e,t)},this.setFixedMode=function(){s.tile_size_by=i.sizeby.GLOBAL_RATIO,s.tile_visible_before_image=!0},this.setApproveClickFunction=function(e){u.funcParentApproveClick=e},this.resizeTile=function(e,t,n,r){if(1==u.isTextpanelOutside&&E(e,"clone",t),t){if(!n)n=i.getTileHeightByWidth(t,e)}else{t=s.tile_width;var n=s.tile_height}switch(o.setElementSize(e,t,n),r){default:case i.resizemode.FULL:i.triggerSizeChangeEvent(e,!0);break;case i.resizemode.WRAPPER_ONLY:return!0;case i.resizemode.VISIBLE_ELEMENTS:if(u.funcCustomTileHtml)return i.triggerSizeChangeEvent(e,!0),!0;w(e,t,n,!0),1==s.tile_enable_textpanel&&1==s.tile_textpanel_always_on&&t&&E(e,"regular",t,n)}},this.resizeAllTiles=function(e,t,n){_();var r=null;if(s.tile_size_by==i.sizeby.GLOBAL_RATIO&&(r=i.getTileHeightByWidth(e)),!n)n=a.getThumbs();n.each(function(n,o){i.resizeTile(jQuery(o),e,r,t)})},this.triggerSizeChangeEvent=function(e,i){if(!e)return!1;if(!i)i=!1;t.trigger(u.eventSizeChange,[e,i])},this.triggerSizeChangeEventAllTiles=function(e){a.getThumbs().each(function(){var t=jQuery(this);i.triggerSizeChangeEvent(t,e)})},this.disableEvents=function(){a.getThumbs().css("pointer-events","none")},this.enableEvents=function(){a.getThumbs().css("pointer-events","auto")},this.setOptions=function(e){s=jQuery.extend(s,e),a.setOptions(e)},this.setTileSizeOptions=function(e){if(s.tile_size_by!==i.sizeby.GLOBAL_RATIO)throw new Error("setNewTileOptions works with global ration only");s.tile_width=e,s.tile_height=Math.floor(e*u.ratioByHeight)},this.setCustomFunctions=function(e,t){u.funcCustomTileHtml=e,u.funcCustomPositionElements=t},this.run=function(e){var t=a.type.GET_THUMBS_ALL;!0===e&&(t=a.type.GET_THUMBS_NEW);var n=a.getThumbs(t);s.tile_size_by==i.sizeby.GLOBAL_RATIO&&i.resizeAllTiles(s.tile_width,i.resizemode.WRAPPER_ONLY,n),1==s.tile_enable_image_effect&&0==s.tile_image_effect_reverse&&n.children(".ug-thumb-image").fadeTo(0,0),a.setHtmlProperties(n),1==s.tile_visible_before_image&&(n.children(".ug-thumb-image").fadeTo(0,0),a.loadThumbsImages())},this._____________EXTERNAL_GETTERS____________=function(){},this.getObjThumbs=function(){return a},this.getOptions=function(){return s},this.getTileImage=function(e){return e.find("img.ug-thumb-image")},this.getItemByTile=function(e){return a.getItemByThumb(e)},this.getTileHeightByWidth=function(e,t){var n=function(e){var t=u.ratioByHeight;switch(s.tile_size_by){default:t=u.ratioByHeight;break;case i.sizeby.IMAGE_RATIO:if(!e)throw new Error("tile should be given for tile ratio");var n=i.getItemByTile(e);if(void 0!==n.thumbRatioByHeight){if(0==n.thumbRatioByHeight)throw trace(n),new Error("the item ratio not inited yet");t=n.thumbRatioByHeight}break;case i.sizeby.CUSTOM:return null}return t}(t);if(null===n)return null;var r=Math.floor((e-u.tileInnerReduce)*n)+u.tileInnerReduce;return t&&1==u.isTextpanelOutside&&s.tile_size_by==i.sizeby.IMAGE_RATIO&&(r+=m(t)),r},this.getTileImageSize=function(e){var t=i.getItemByTile(e);if(!t.thumbWidth||!t.thumbHeight)throw new Error("Can't get image size - image not inited.");return{width:t.thumbWidth,height:t.thumbHeight}},this.getGlobalTileSize=function(){if(s.tile_size_by!=i.sizeby.GLOBAL_RATIO)throw new Error("The size has to be global ratio");return{width:s.tile_width,height:s.tile_height}}}function UGTiles(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGTileDesign,d=new UGThumbsGeneral,_={},g={tiles_type:"columns",tiles_col_width:250,tiles_align:"center",tiles_exact_width:!1,tiles_space_between_cols:3,tiles_space_between_cols_mobile:3,tiles_include_padding:!0,tiles_min_columns:2,tiles_max_columns:0,tiles_keep_order:!1,tiles_set_initial_height:!0,tiles_justified_row_height:150,tiles_justified_space_between:3,tiles_nested_optimal_tile_width:250,tiles_nested_col_width:null,tiles_nested_debug:!1,tiles_enable_transition:!0};this.events={THUMB_SIZE_CHANGE:"thumb_size_change",TILES_FIRST_PLACED:"tiles_first_placed",ALL_TILES_LOADED:"all_tiles_loaded"};var c={isFirstTimeRun:!0,handle:null,isTransActive:!1,isTransInited:!1,isFirstPlaced:!0,isAllLoaded:!1},h={colWidth:null,nestedOptimalCols:5,gridY:0,maxColumns:0,columnsValueToEnableHeightResize:3,resizeLeftRightToColumn:!0,currentItem:0,currentGap:null,optimalTileWidth:null,maxGridY:0};function p(i,n){g_objects=i.getObjects(),s=i,e=jQuery(i),t=g_objects.g_objWrapper,g_objects.g_arrItems,g=jQuery.extend(g,n),function(){g.tiles_min_columns<1&&(g.tiles_min_columns=1);0!=g.tiles_max_columns&&g.tiles_max_columns<g.tiles_min_columns&&(g.tiles_max_columns=g.tiles_min_columns)}(),u.init(i,g),d=u.getObjThumbs()}function m(){if(i.addClass("ug-tiles-rest-mode"),c.isTransInited=!0,1==g.tiles_enable_transition){i.addClass("ug-tiles-transit");var e=u.getOptions();1==e.tile_enable_image_effect&&0==e.tile_image_effect_reverse&&i.addClass("ug-tiles-transit-overlays"),c.isTransActive=!0}}function f(){return l.getElementSize(i).width}function b(){return 0!=c.isTransInited&&(i.addClass("ug-tiles-transition-active"),i.removeClass("ug-tiles-rest-mode"),0!=c.isTransActive&&void u.disableEvents())}function v(){if(0==c.isTransInited)return!1;i.removeClass("ug-tiles-transition-active"),i.addClass("ug-tiles-rest-mode")}function y(){1==c.isTransActive?(setTimeout(function(){u.enableEvents(),u.triggerSizeChangeEventAllTiles(),v()},800),c.handle&&clearTimeout(c.handle),c.handle=setTimeout(function(){v(),u.triggerSizeChangeEventAllTiles(),c.handle=null},2e3)):(u.triggerSizeChangeEventAllTiles(),v())}function I(){_.colWidth=(_.availWidth-_.colGap*(_.numCols-1))/_.numCols,_.colWidth=Math.floor(_.colWidth),_.totalWidth=l.getSpaceByNumItems(_.numCols,_.colWidth,_.colGap)}function w(){if(_.colWidth=g.tiles_col_width,_.minCols=g.tiles_min_columns,_.maxCols=g.tiles_max_columns,0==s.isMobileMode()?_.colGap=g.tiles_space_between_cols:_.colGap=g.tiles_space_between_cols_mobile,_.galleryWidth=f(),_.availWidth=_.galleryWidth,1==g.tiles_include_padding&&(_.availWidth=_.galleryWidth-2*_.colGap),1==g.tiles_exact_width)_.numCols=l.getNumItemsInSpace(_.availWidth,_.colWidth,_.colGap),_.maxCols>0&&_.numCols>_.maxCols&&(_.numCols=_.maxCols),_.numCols<_.minCols?(_.numCols=_.minCols,I()):_.totalWidth=_.numCols*(_.colWidth+_.colGap)-_.colGap;else{var e=l.getNumItemsInSpaceRound(_.availWidth,_.colWidth,_.colGap);e<_.minCols?e=_.minCols:0!=_.maxCols&&e>_.maxCols&&(e=_.maxCols),_.numCols=e,I()}switch(g.tiles_align){case"center":default:_.addX=Math.round((_.galleryWidth-_.totalWidth)/2);break;case"left":_.addX=0;break;case"right":_.addX=_.galleryWidth-_.totalWidth}for(_.arrPosx=[],col=0;col<_.numCols;col++){var t=l.getColX(col,_.colWidth,_.colGap);_.arrPosx[col]=t+_.addX}}function E(){_.maxColHeight=0,_.colHeights=[0]}function T(e,t,n,r){if(null==r)r=function(){var e=0,t=999999999;for(col=0;col<_.numCols;col++){if(null==_.colHeights[col]||0==_.colHeights[col])return col;_.colHeights[col]<t&&(e=col,t=_.colHeights[col])}return e}();var o=0;void 0!==_.colHeights[r]&&(o=_.colHeights[r]);var a=u.getTileHeightByWidth(_.colWidth,e);if(null===a){if(1==g.tiles_enable_transition)throw new Error("Can't know tile height, please turn off transition");a=l.getElementSize(e).height}var s=_.arrPosx[r];l.placeElement(e,s,o);var d=o+a;_.colHeights[r]=d+_.colGap,_.maxColHeight<d&&(_.maxColHeight=d),1==t&&e.show().fadeTo(0,1),1==n&&i.height(_.maxColHeight)}function S(e){e||(e=!1),w(),E();var t=d.getThumbs(d.type.GET_THUMBS_RATIO);b(),u.resizeAllTiles(_.colWidth,u.resizemode.VISIBLE_ELEMENTS,t);for(var n=0;n<t.length;n++){var r=jQuery(t[n]),o=void 0;1==g.tiles_keep_order&&(o=l.getColByIndex(_.numCols,n)),T(r,e,!1,o)}y();var a=i.height();1==c.isTransActive&&a>_.maxColHeight?setTimeout(function(){i.height(_.maxColHeight)},700):i.height(_.maxColHeight)}function P(e,t){if(!0!==t&&0==function(e){var t=e.index();if(!0===s.getItem(t).ordered_placed)return!1;var i=l.getPrevRowSameColIndex(t,_.numCols);return i<0||!0===s.getItem(i).ordered_placed}(e))return!1;var i=e.index(),n=l.getColByIndex(_.numCols,i),r=s.getItem(i);u.resizeTile(e,_.colWidth),T(e,!0,!0,n),r.ordered_placed=!0;var o=s.getNumItems(),a=l.getNextRowSameColIndex(i,_.numCols);if(a>=o)return!1;var g=d.getThumbByIndex(a),c=s.getItem(a);d.isThumbLoaded(g);d.isThumbLoaded(g)&&!c.ordered_placed&&P(g,!0)}function x(){var e=d.getThumbs(d.type.GET_THUMBS_NO_RATIO);if(!e||0==e.length)return!1;if(c.isAllLoaded=!1,1==c.isFirstPlaced){w(),E();var t=Math.abs(_.galleryWidth-_.totalWidth);if(1==g.tiles_set_initial_height&&0==l.isScrollbarExists()&&t<25){e.length;var n=Math.ceil(e.length/_.numCols)*g.tiles_col_width*.75;i.height(n),w()}}e.fadeTo(0,0);var r=e.find("img.ug-thumb-image"),h=_.numCols,p=_.galleryWidth;l.checkImagesLoaded(r,function(){w(),h==_.numCols&&p==_.galleryWidth||S(!1),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){1==c.isFirstPlaced&&s.triggerEvent(o.events.TILES_FIRST_PLACED),function(e,t){if(1==t)return!1;e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e),1==g.tiles_keep_order?P(i):(u.resizeTile(i,_.colWidth),T(i,!0,!0))}(e,t)})}function j(){var e=f(),t=d.getThumbs(!0),i=g.tiles_justified_row_height,n=[],r=0,o=g.tiles_justified_space_between,a=t.length;jQuery.each(t,function(e,t){t=jQuery(t);var o=d.getItemByThumb(t),a=o.thumbWidth;o.thumbHeight!==i&&(a=Math.floor(o.thumbRatioByWidth*i)),n[e]=a,r+=a});var s=Math.ceil(r/e);s>a&&(s=a);var l=r/s,u=[],_=0,c=[],h=[],p=0,m=0;jQuery.each(t,function(e,t){var i=n[e];p+i/2>(m+1)*l&&(c[u.length]=_,u.push(h),h=[],_=0,m++),p+=i,_+=i,h.push(t)}),c[u.length]=_,u.push(h);var b=[],v=[],y=0;return jQuery.each(u,function(t,r){r.length;var a=c[t],s=(r.length-1)*o,l=(e-s)/a,u=Math.round(i*l);y+=u,t>0&&(y+=o),v.push(u);var d=u/i,_=[],g=s;jQuery.each(r,function(e,t){var i=jQuery(t).index(),r=n[i],o=Math.round(r*d);_[e]=o,g+=o});var h=g-e;jQuery.each(_,function(e,t){if(0==h)return!1;h<0?(_[e]=t+1,h++):(_[e]=t-1,h--),e==_.length-1&&0!=h&&(_[e]-=h)}),b[t]=_}),{arrRows:u,arrRowWidths:b,arrRowHeights:v,gap:o,totalHeight:y}}function C(e){if(!e)e=!1;var t=f(),n=j();i.height(n.totalHeight),f()!=t&&(n=j()),b();var r=0,o=0;jQuery.each(n.arrRows,function(t,i){var a=n.arrRowWidths[t],s=n.arrRowHeights[t],d=0;jQuery.each(i,function(t,i){var _=jQuery(i),g=s,c=a[t];u.resizeTile(_,c,g,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(_,d,r),(d+=c)>o&&(o=d),d+=n.gap,1==e&&jQuery(i).show()}),r+=s+n.gap}),y()}function A(){var e=f();switch(h.galleryWidth=e,n={},h.colWidth=g.tiles_nested_col_width,h.optimalTileWidth=g.tiles_nested_optimal_tile_width,h.currentGap=g.tiles_space_between_cols,1==s.isMobileMode()&&(h.currentGap=g.tiles_space_between_cols_mobile),null==h.colWidth?h.colWidth=Math.floor(h.optimalTileWidth/h.nestedOptimalCols):h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.maxColumns=l.getNumItemsInSpace(e,h.colWidth,h.currentGap),h.colWidth=l.getItemSizeInSpace(e,h.maxColumns,h.currentGap),h.gridY=0,r=[],d.getThumbs(!0).each(function(){var e=function(e){var t,i,n={},r=h.colWidth,o=h.currentGap,a=u.getTileImageSize(e),s=e.index(),l=Math.ceil(function(e){return Math.abs(Math.sin(Math.abs(1e3*Math.sin(e))))}(s)*(1*h.nestedOptimalCols/3)+2*h.nestedOptimalCols/3),d=a.width,_=a.height,g=d/_;d>_?(t=l,0==(i=Math.round(t/g))&&(i=1)):(i=l,0==(t=Math.round(i*g))&&(t=1));return n.dimWidth=t,n.dimHeight=i,n.width=t*r+o*(t-1),n.height=i*r+o*(i-1),n.imgWidth=d,n.imgHeight=_,n.left=0,n.top=0,n}(jQuery(this));r.push(e)}),h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.totalWidth=h.maxColumns*(h.colWidth+h.currentGap)-h.currentGap,g.tiles_align){case"center":default:h.addX=Math.round((h.galleryWidth-h.totalWidth)/2);break;case"left":h.addX=0;break;case"right":h.addX=h.galleryWidth-h.totalWidth}h.maxGridY=0}function M(e){var t=f();A(),O();var n=h.maxGridY*(h.colWidth+h.currentGap)-h.currentGap;i.height(n),f()!=t&&(A(),O()),0==g.tiles_nested_debug&&function(e){if(!e)var e=!1;b();for(var t=0;t<r.length;t++)U(t,e);i.height(h.maxColHeight),y()}(e)}function O(e){if(1==g.tiles_nested_debug)return void 0===e&&(e=!0),function(e,t){if(0==t){for(var i=h.currentItem;i<r.length;i++)z(i,!0);h.currentItem=r.length-1}else z(h.currentItem,!0);for(i=0;i<=h.currentItem;i++)U(i,!0);h.currentItem++}(0,e),!1;for(var t=0;t<r.length;t++)z(t,!0)}function z(e,t){if(!t)t=!1;h.maxColHeight=0;for(var i=l.getObjectLength(n),r=h.gridY;r<=i+1;r++){for(var o=0;o<h.maxColumns;o++){if(0==Q(h.gridY)||0==F(h.gridY,o))return void L(e,D(o),o)}h.gridY++}}function L(e,t,i){var o=jQuery.extend(!0,{},r[e]),a=o.dimWidth,s=t-o.dimWidth,l=h.nestedOptimalCols;if(t<=o.dimWidth||s<=.33*l||t<=l)N(e,t);else if(s<=l)l>=4?1==G(Math.floor(t/2),i)?N(e,Math.floor(t/2)+1):N(e,Math.floor(t/2)):N(objImage,t);else if(1==G(a,i))switch(a>=l){case!0:N(e,a-1);break;case!1:N(e,a+1)}var u,d,_,g,c,p,m,f,b,v=function(e,t,i){var r=h.gridY-1,o=0,a=0,s=1,l=[],u=[];if(l.push(e),r>=0){for(a=0;r>=0;){if(o=n[r][i],void 0!==n[r][i-1]&&n[r][i-1]==n[r][i]||void 0!==n[r][i+t]&&n[r][i+t-1]==n[r][i+t]||n[r][i]!=n[r][i+t-1])return u.push(s),u.push(l),u;a!=o&&(s++,l.push(o)),r--,a=o}return u.push(s),u.push(l),u}return[0,[]]}(e,(o=jQuery.extend(!0,{},r[e])).dimWidth,i);if(h.columnsValueToEnableHeightResize<=v[0]&&h.maxColumns>=2*h.nestedOptimalCols){var y=function(e,t){var i=0,r=0,o=t.dimWidth,a=t.dimHeight,s=0,l=0,u=jQuery.map(n,function(e,t){return[e]});if(void 0===u[h.gridY]||void 0===u[h.gridY][e-1])r=0;else for(var d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e-1];)s=n[h.gridY+d][e-2],d++,r++;if(void 0===u[h.gridY]||void 0===u[h.gridY][e+o])i=0;else for(d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e+o];)l=n[h.gridY+d][e+o+1],d++,i++;var _=0,g=0;Math.abs(a-r)<Math.abs(a-i)&&0!=r?(_=r,g=s):0!=i?(_=i,g=l):_=a;return{newHeight:_,idToResize:g}}(i,o),I=k(e,y.newHeight,!0);r[e].dimHeight=I.dimHeight;var w=function(e,t){for(var i=0,n=0,o=[],a=0,s=0,l=0;l<e[1].length;l++){var u=e[1][l],d=r[e[1][l]];if(n+=d.dimHeight,0!=l)i+=d.dimHeight,o.push([u,d.dimHeight]);else{var _=N(u,t,!0);i+=_.dimHeight,o.push([e[1][l],_.dimHeight])}}a=d.left,s=d.top;for(var g=n,c=[],l=o.length-1;l>=0;l--){var h,u=o[l][0];0!=l?(h=Math.max(Math.round(1*n/3),Math.floor(o[l][1]*(n/i))),g-=h,(_=k(u,h,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}),s+=_.dimHeight):((_=k(u,h=g,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}))}return c}(v,I.dimWidth),E=!1;(function(e){for(var t=0,i=0,r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&h.maxColumns>o.left+o.dimWidth&&(a=n[o.top+o.dimHeight-1][o.left+o.dimWidth],s=n[o.top+o.dimHeight][o.left+o.dimWidth]),a!=s&&t++}for(var r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&o.left-1>=0&&(a=n[o.top+o.dimHeight-1][o.left-1],s=n[o.top+o.dimHeight][o.left-1]),a!=s&&i++}return Math.max(i,t)})(w)>=2&&(E=!0),y.newHeight>=o.dimHeight&&(o=k(e,y.newHeight,!0));var T=(u=y.idToResize,d=y.newHeight,_=o.dimHeight,g=r[u],c=g.dimHeight,g.dimWidth,p=g.left,m=g.top,parseInt(m/(h.colWidth+h.currentGap)),parseInt(p/(h.colWidth+h.currentGap)),f=k(u,c-d+_,!0),(b=[]).push({tileID:u,sizes:f}),b);return o.top=h.gridY,o.left=i,T.push({tileID:e,sizes:o}),R(T)<R(w)||1==E?void H(T):void H(w)}o.left=i,o.top=h.gridY,r[e]=o,W(e,o,i,h.gridY),h.maxGridY=o.top+o.dimHeight}function H(e){for(var t=0;t<e.length;t++){var i=e[t].sizes,n=e[t].tileID;r[n]=jQuery.extend(!0,{},i),W(n,i,i.left,i.top)}}function N(e,t,i){i||(i=!1);var n=h.colWidth,o=h.currentGap,a=r[e],s=a.imgWidth/a.imgHeight;if(dimWidth=t,dimHeight=Math.round(dimWidth/s),1==i){var l=jQuery.extend(!0,{},a);return l.dimWidth=dimWidth,l.dimHeight=dimHeight,l.width=dimWidth*n+o*(dimWidth-1),l.height=dimHeight*n+o*(dimHeight-1),l}a.dimWidth=dimWidth,a.dimHeight=dimHeight,a.width=dimWidth*n+o*(dimWidth-1),a.height=dimHeight*n+o*(dimHeight-1)}function k(e,t,i){i||(i=!1);var n=r[e],o=n.dimWidth,a=h.colWidth,s=h.currentGap;if(1==i){var l=jQuery.extend(!0,{},n);return l.dimHeight=t,l.width=o*a+s*(o-1),l.height=t*a+s*(t-1),l}n.dimHeight=t,n.width=o*a+s*(o-1),n.height=t*a+s*(t-1)}function R(e){for(var t=0,i=0,n=0;n<e.length;n++){var o=r[e[n].tileID];if(0==o.dimHeight||0==o.height)return;resizeVal=o.dimWidth/o.dimHeight/(o.imgWidth/o.imgHeight),resizeVal<1&&(resizeVal=1/resizeVal),t+=resizeVal,i++}return t/i}function G(e,t){var i=h.gridY-1;return!(i<=0||0==Q(i))&&n[i][t+e-1]!=n[i][t+e]}function D(e){var t=e,i=0;if(1==Q(h.gridY))for(;0==F(h.gridY,t);)i++,t++;else i=h.maxColumns;return i}function Q(e){return void 0!==n[e]}function W(e,t,i,n){for(var r=0;r<t.dimHeight;r++)for(var o=0;o<t.dimWidth;o++)0==Q(n+r)&&B(n+r),Y(n+r,i+o,e)}function B(e){n[e]=new Object;for(var t=0;t<h.maxColumns;t++)n[e][t]=-1}function F(e,t){return-1!=n[e][t]}function Y(e,t,i){n[e][t]=i}function U(e,t){var i=d.getThumbByIndex(e),n=r[e],o=n.top*(h.colWidth+h.currentGap),a=h.addX+n.left*(h.colWidth+h.currentGap);u.resizeTile(i,n.width,n.height,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(i,a,o),o+n.height>h.maxColHeight&&(h.maxColHeight=o+n.height),1==t&&i.fadeTo(0,1)}function V(){if(1==c.isFirstTimeRun)return!0;if(0==c.isAllLoaded)return!1;switch(g.tiles_type){case"columns":S(!1);break;case"justified":C(!1);break;case"nested":1==s.isMobileMode()?S(!1):M(!1)}}function X(){switch(t.children(".ug-tile").show(),1==c.isFirstTimeRun&&(a.on(o.events.ALL_TILES_LOADED,function(){c.isAllLoaded=!0}),e.on(s.events.SIZE_CHANGE,V),e.on(o.events.TILES_FIRST_PLACED,function(){c.isFirstPlaced=!1}),u.initEvents()),u.run(),g.tiles_type){default:case"columns":x();break;case"justified":i=jQuery(t).find("img.ug-thumb-image"),n=d.getThumbs(),c.isAllLoaded=!1,n.fadeTo(0,0),l.checkImagesLoaded(i,function(){setTimeout(function(){C(!0),n.fadeTo(0,1),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)})},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)});break;case"nested":!function(){var e=jQuery(t).find("img.ug-thumb-image"),i=d.getThumbs();c.isAllLoaded=!1,i.fadeTo(0,0),l.checkImagesLoaded(e,function(){1==s.isMobileMode()?S(!0):M(!0),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)})}()}var i,n;c.isFirstTimeRun=!1}this.destroy=function(){e.off(s.events.SIZE_CHANGE),u.destroy(),e.off(o.events.TILES_FIRST_PLACED)},this.init=function(e,t){p(e,t)},this.setHtml=function(e){!function(e){e||(e=i||t);i=e;var n=g.tiles_type;e.addClass("ug-tiletype-"+n),u.setHtml(e),e.children(".ug-thumb-wrapper").hide()}(e)},this.getObjTileDesign=function(){return u},this.run=function(){X()},this.runNewItems=function(){if(!i)throw new Error("Can't run new items - parent not set");switch(u.setHtml(i,!0),u.run(!0),g.tiles_type){case"columns":x();break;default:case"justified":case"nested":throw new Error("Tiles type: "+g.tiles_type+" not support load more yet")}}}function UGAviaControl(){var e,t,i,n,r,o,a={touchEnabled:!1,isMouseInsideStrip:!1,strip_finalPos:0,handle_timeout:"",isStripMoving:!1,isControlEnabled:!0};function s(){if(0==a.is_strip_moving)return!1;var t=e.getInnerStripPos();Math.floor(t)==Math.floor(a.strip_finalPos)&&l();var i,n=Math.abs(a.strip_finalPos-t);n<1?i=n:(i=n/4)>0&&i<1&&(i=1),a.strip_finalPos<t&&(i*=-1);var r=t+i;e.positionInnerStrip(r)}function l(){if(0==a.isStripMoving)return!1;a.isStripMoving=!1,a.handle_timeout=clearInterval(a.handle_timeout)}this.enable=function(){a.isControlEnabled=!0},this.disable=function(){a.isControlEnabled=!1},this.init=function(u){e=u,t=u.getObjects(),t.g_gallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,jQuery("body").on("touchstart",function(e){if(0==a.isControlEnabled)return!0;a.touchEnabled=!0}),jQuery("body").mousemove(function(t){if(0==a.isControlEnabled)return!0;if(1==a.touchEnabled)return jQuery("body").off("mousemove"),!0;a.isMouseInsideStrip=i.ismouseover();var u=e.isTouchMotionActive();if(1==a.isMouseInsideStrip&&0==u){var d=function(e){return 0==o?e.pageX:e.pageY}(t);!function(e){var t=function(e){return 0==o?function(e){var t=r.strip_padding_left,o=r.strip_padding_right,a=i.width()-t-o,s=n.width();if(a>s)return null;var l=i.offset().left,u=e-l-t,d=r.thumb_width,_=a-r.thumb_width;u<d&&(u=d),u>_&&(u=_);var g=(u-d)/(_-d)*(s-a);return g=-1*Math.round(g)+t}(e):function(e){var t=r.strip_padding_top,o=(r.strip_padding_bottom,i.height()),a=n.height();if(o>a)return null;var s=i.offset().top,l=e-s-t;if(l<0)return null;var u=r.thumb_height,d=o-r.thumb_height;l<u&&(l=u),l>d&&(l=d);var _=(l-u)/(d-u)*(a-o);return _=-1*Math.round(_)+t}(e)}(e);if(null===t)return!1;a.is_strip_moving=!0,a.strip_finalPos=t,function(){if(1==a.isStripMoving)return!1;a.isStripMoving=!0,a.handle_timeout=setInterval(s,10)}()}(d)}else l()})},this.destroy=function(){jQuery("body").off("touchstart"),jQuery("body").off("mousemove")}}function UGSlider(){var e,t,i,n,r,o,a,s,l,u,d,_,g,c=this,h=jQuery(c),p=new UniteGalleryMain,m=null,f=null,b=null,v=new UGVideoPlayer,y=new UGFunctions,I=null,w=null;this.events={ITEM_CHANGED:"item_changed",BEFORE_SWITCH_SLIDES:"before_switch",BEFORE_RETURN:"before_return",AFTER_RETURN:"after_return",ZOOM_START:"slider_zoom_start",ZOOM_END:"slider_zoom_end",ZOOMING:"slider_zooming",ZOOM_CHANGE:"slider_zoom_change",START_DRAG:"start_drag",AFTER_DRAG_CHANGE:"after_drag_change",ACTION_START:"action_start",ACTION_END:"action_end",CLICK:"slider_click",TRANSITION_START:"slider_transition_start",TRANSITION_END:"slider_transition_end",AFTER_PUT_IMAGE:"after_put_image",IMAGE_MOUSEENTER:"slider_image_mouseenter",IMAGE_MOUSELEAVE:"slider_image_mouseleave",CURRENTSLIDE_LOAD_START:"slider_current_loadstart",CURRENTSLIDE_LOAD_END:"slider_current_loadend"};var E={slider_scale_mode:"fill",slider_scale_mode_media:"fill",slider_scale_mode_fullscreen:"down",slider_item_padding_top:0,slider_item_padding_bottom:0,slider_item_padding_left:0,slider_item_padding_right:0,slider_background_color:"",slider_background_opacity:1,slider_image_padding_top:0,slider_image_padding_bottom:0,slider_image_padding_left:0,slider_image_padding_right:0,slider_image_border:!1,slider_image_border_width:10,slider_image_border_color:"#ffffff",slider_image_border_radius:0,slider_image_border_maxratio:.35,slider_image_shadow:!1,slider_video_constantsize:!1,slider_video_constantsize_scalemode:"fit",slider_video_constantsize_width:854,slider_video_constantsize_height:480,slider_video_padding_top:0,slider_video_padding_bottom:0,slider_video_padding_left:0,slider_video_padding_right:0,slider_video_enable_closebutton:!0,slider_transition:"slide",slider_transition_speed:300,slider_transition_easing:"easeInOutQuad",slider_control_swipe:!0,slider_control_zoom:!0,slider_zoom_mousewheel:!0,slider_vertical_scroll_ondrag:!1,slider_loader_type:1,slider_loader_color:"white",slider_enable_links:!0,slider_links_newpage:!1,slider_enable_bullets:!1,slider_bullets_skin:"",slider_bullets_space_between:-1,slider_bullets_align_hor:"center",slider_bullets_align_vert:"bottom",slider_bullets_offset_hor:0,slider_bullets_offset_vert:10,slider_enable_arrows:!0,slider_arrows_skin:"",slider_arrow_left_align_hor:"left",slider_arrow_left_align_vert:"middle",slider_arrow_left_offset_hor:20,slider_arrow_left_offset_vert:0,slider_arrow_right_align_hor:"right",slider_arrow_right_align_vert:"middle",slider_arrow_right_offset_hor:20,slider_arrow_right_offset_vert:0,slider_enable_progress_indicator:!0,slider_progress_indicator_type:"pie",slider_progress_indicator_align_hor:"right",slider_progress_indicator_align_vert:"top",slider_progress_indicator_offset_hor:10,slider_progress_indicator_offset_vert:10,slider_enable_play_button:!0,slider_play_button_skin:"",slider_play_button_align_hor:"left",slider_play_button_align_vert:"top",slider_play_button_offset_hor:40,slider_play_button_offset_vert:8,slider_play_button_mobilehide:!1,slider_enable_fullscreen_button:!0,slider_fullscreen_button_skin:"",slider_fullscreen_button_align_hor:"left",slider_fullscreen_button_align_vert:"top",slider_fullscreen_button_offset_hor:11,slider_fullscreen_button_offset_vert:9,slider_fullscreen_button_mobilehide:!1,slider_enable_zoom_panel:!0,slider_zoompanel_skin:"",slider_zoompanel_align_hor:"left",slider_zoompanel_align_vert:"top",slider_zoompanel_offset_hor:12,slider_zoompanel_offset_vert:92,slider_zoompanel_mobilehide:!1,slider_controls_always_on:!1,slider_controls_appear_ontap:!0,slider_controls_appear_duration:300,slider_enable_text_panel:!0,slider_textpanel_always_on:!0,slider_videoplay_button_type:"square"},T={slider_progress_indicator_align_hor:"left",slider_progress_indicator_align_vert:"bottom",slider_progress_indicator_offset_hor:0,slider_progress_indicator_offset_vert:0},S={isRunOnce:!1,isTextPanelSaparateHover:!1,numPrev:1,numCurrent:2,numNext:3,isControlsVisible:!0,currentControlsMode:"image"};function P(i,n,r){p=i,r&&(g=r,n=y.convertCustomPrefixOptions(n,g,"slider")),e=jQuery(i);var o=p.getObjects();if(t=o.g_objWrapper,o.g_objThumbs,n.hasOwnProperty("slider_progress_indicator_type")&&(E.slider_progress_indicator_type=n.slider_progress_indicator_type),"bar"==E.slider_progress_indicator_type&&(E=jQuery.extend(E,T)),n&&c.setOptions(n),function(){var e=p.getOptions(),t=e.gallery_skin;""==E.slider_bullets_skin&&(E.slider_bullets_skin=t);""==E.slider_arrows_skin&&(E.slider_arrows_skin=t);""==E.slider_zoompanel_skin&&(E.slider_zoompanel_skin=t);""==E.slider_play_button_skin&&(E.slider_play_button_skin=t);""==E.slider_fullscreen_button_skin&&(E.slider_fullscreen_button_skin=t);E.video_enable_closebutton=E.slider_video_enable_closebutton,"zoom"!=e.gallery_mousewheel_role&&(E.slider_zoom_mousewheel=!1)}(),1==E.slider_enable_bullets){b=new UGBullets;var a={bullets_skin:E.slider_bullets_skin,bullets_space_between:E.slider_bullets_space_between};b.init(p,a)}E.slider_enable_text_panel&&(w=new UGTextPanel).init(p,E,"slider"),E.slider_enable_zoom_panel&&(_=new UGZoomButtonsPanel).init(c,E);var s=p.getGalleryID();v.init(E,!1,s)}function x(){if(1==S.isRunOnce)return!1;if(S.isRunOnce=!0,E.slider_background_color){var t=E.slider_background_color;1!=E.slider_background_opacity&&(t=y.convertHexToRGB(t,E.slider_background_opacity)),i.css("background-color",t)}else 1!=E.slider_background_opacity&&(t=y.convertHexToRGB("#000000",E.slider_background_opacity),i.css("background-color",t));1==E.slider_control_swipe&&(u=new UGTouchSliderControl).init(c,E),1==E.slider_control_zoom&&(d=new UGZoomSliderControl).init(c,E),w&&w.run(),function(){e.on(p.events.ITEM_IMAGE_UPDATED,se),e.on(p.events.ITEM_CHANGE,K),b&&jQuery(b).on(b.events.BULLET_CLICK,J);1==E.slider_enable_arrows&&(y.addClassOnHover(l,"ug-arrow-hover"),y.addClassOnHover(s,"ug-arrow-hover"),p.setNextButton(l),p.setPrevButton(s));0==E.slider_controls_always_on&&i.hover(ie,ne);i.on("touchend click",$),h.on(c.events.CLICK,ee),w&&1==S.isTextPanelSaparateHover&&i.hover(D,G);m&&(y.addClassOnHover(m,"ug-button-hover"),p.setPlayButton(m));f&&(y.addClassOnHover(f,"ug-button-hover"),p.setFullScreenToggleButton(f));d&&h.on(c.events.ZOOM_CHANGE,te);_&&_.initEvents();v.initEvents(),jQuery(v).on(v.events.SHOW,oe),jQuery(v).on(v.events.HIDE,ae),ue(r),ue(o),ue(a),h.on(c.events.AFTER_PUT_IMAGE,le),i.on("mouseenter",".ug-item-wrapper img",function(e){h.trigger(c.events.IMAGE_MOUSEENTER)}),i.on("mouseleave",".ug-item-wrapper img",function(e){var t=c.isMouseInsideSlideImage(e);0==t&&h.trigger(c.events.IMAGE_MOUSELEAVE)})}()}function j(e,t){var i="ug-type-square";"round"==E.slider_videoplay_button_type&&(i="ug-type-round");var n="";return n+="<div class='ug-slide-wrapper ug-slide"+t+"'>",n+="<div class='ug-item-wrapper'></div>",n+="<div class='ug-slider-preloader "+e+"'></div>",n+="<div class='ug-button-videoplay "+i+"' style='display:none'></div>",n+="</div>"}function C(e){e&&(t=e);var u=function(){var e;switch(E.slider_loader_type){default:case 1:e="ug-loader1";break;case 2:e="ug-loader2";break;case 3:e="ug-loader3";break;case 4:e="ug-loader4";break;case 5:e="ug-loader5";break;case 6:e="ug-loader6";break;case 7:e="ug-loader7";break;case 8:e="ug-loader8";break;case 9:e="ug-loader9"}"black"==E.slider_loader_color&&(e+=" ug-loader-black");return e}(),d=(p.getOptions(),"<div class='ug-slider-wrapper'>");(d+="<div class='ug-slider-inner'>",d+=j(u,1),d+=j(u,2),d+=j(u,3),d+="</div>",1==E.slider_enable_arrows&&(d+="<div class='ug-slider-control ug-arrow-left ug-skin-"+E.slider_arrows_skin+"'></div>",d+="<div class='ug-slider-control ug-arrow-right ug-skin-"+E.slider_arrows_skin+"'></div>"),1==E.slider_enable_play_button&&(d+="<div class='ug-slider-control ug-button-play ug-skin-"+E.slider_play_button_skin+"'></div>"),1==E.slider_enable_fullscreen_button&&(d+="<div class='ug-slider-control ug-button-fullscreen ug-skin-"+E.slider_fullscreen_button_skin+"'></div>"),d+="</div>",t.append(d),i=t.children(".ug-slider-wrapper"),n=i.children(".ug-slider-inner"),r=n.children(".ug-slide1"),o=n.children(".ug-slide2"),a=n.children(".ug-slide3"),r.data("slidenum",1),o.data("slidenum",2),a.data("slidenum",3),b&&b.appendHTML(i),1==E.slider_enable_arrows&&(s=i.children(".ug-arrow-left"),l=i.children(".ug-arrow-right")),1==E.slider_enable_play_button&&(m=i.children(".ug-button-play")),1==E.slider_enable_fullscreen_button&&(f=i.children(".ug-button-fullscreen")),1==E.slider_enable_progress_indicator)&&("bar"==(I=y.initProgressIndicator(E.slider_progress_indicator_type,E,i)).getType()&&"pie"==E.slider_progress_indicator_type&&(E.slider_progress_indicator_type="bar",E=jQuery.extend(E,T)),p.setProgressIndicator(I));1==E.slider_enable_text_panel&&(w.appendHTML(i),0==E.slider_textpanel_always_on&&(w.getElement().hide().data("isHidden",!0),S.isTextPanelSaparateHover=!0));1==E.slider_enable_zoom_panel&&_.appendHTML(i),v.setHtml(n)}function A(e){var t=_e(e);y.placeElementInParentCenter(t);var i=ge(e);y.placeElementInParentCenter(i)}function M(){if(b&&(objBullets=b.getElement(),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert)),1==E.slider_enable_arrows&&(y.placeElement(s,E.slider_arrow_left_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_left_offset_hor,E.slider_arrow_left_offset_vert),y.placeElement(l,E.slider_arrow_right_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_right_offset_hor,E.slider_arrow_right_offset_vert)),0==E.slider_controls_always_on&&X(!0),I){var e=I.getElement();if("bar"==E.slider_progress_indicator_type){var t=i.width();I.setSize(t),y.placeElement(e,"left",E.slider_progress_indicator_align_vert,0,E.slider_progress_indicator_offset_vert)}else y.placeElement(e,E.slider_progress_indicator_align_hor,E.slider_progress_indicator_align_vert,E.slider_progress_indicator_offset_hor,E.slider_progress_indicator_offset_vert)}w&&w.positionPanel(),function(){m&&y.placeElement(m,E.slider_play_button_align_hor,E.slider_play_button_align_vert,E.slider_play_button_offset_hor,E.slider_play_button_offset_vert);f&&y.placeElement(f,E.slider_fullscreen_button_align_hor,E.slider_fullscreen_button_align_vert,E.slider_fullscreen_button_offset_hor,E.slider_fullscreen_button_offset_vert);if(_){var e=_.getElement();y.placeElement(e,E.slider_zoompanel_align_hor,E.slider_zoompanel_align_vert,E.slider_zoompanel_offset_hor,E.slider_zoompanel_offset_vert)}}(),A(r),A(o),A(a),p.isMobileMode()?(1==E.slider_fullscreen_button_mobilehide&&f&&f.hide(),1==E.slider_play_button_mobilehide&&m&&m.hide(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().hide()):(1==E.slider_fullscreen_button_mobilehide&&f&&f.show(),1==E.slider_play_button_mobilehide&&m&&m.show(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().show())}function O(){var e,t,i,r,o=c.getSlidesReference(),a=0;i=c.isSlideHasItem(o.objNextSlide),(r=c.isSlideHasItem(o.objPrevSlide))?(a=o.objPrevSlide.outerWidth(),o.objPrevSlide.css("z-index",1)):o.objPrevSlide.hide(),e=t=a+o.objCurrentSlide.outerWidth(),i?(e=t+o.objNextSlide.outerWidth(),o.objPrevSlide.css("z-index",2)):o.objNextSlide.hide(),o.objCurrentSlide.css("z-index",3),y.placeElement(o.objCurrentSlide,a,0),n.css({left:-a+"px",width:e+"px"}),r&&(y.placeElement(o.objPrevSlide,0,0),y.showElement(o.objPrevSlide)),i&&(y.showElement(o.objNextSlide),y.placeElement(o.objNextSlide,t,0))}function z(e){var t=e.data("index");if(void 0===t||null==t)return!1;var i=p.getItem(t);if(!i)return!1;R(e,i)}function L(e){e.stop(!0).hide(100)}function H(e,t,i){var n={};if(1==E.slider_image_border){n["border-style"]="solid";var r=function(e,t){if((a=E.slider_image_border_width)<=10)return a;var i=y.getElementSize(e),n=i.width,r=i.height;if(t&&(t.hasOwnProperty("imageWidth")&&(n=t.imageWidth),t.hasOwnProperty("imageHeight")&&(r=t.imageHeight)),n<=0)return a;var o=n<r?n:r;if(2*a/o<E.slider_image_border_maxratio)return a;var a=o*E.slider_image_border_maxratio/2;return a=Math.round(a)}(e,i);n["border-width"]=r+"px",n["border-color"]=E.slider_image_border_color,n["border-radius"]=E.slider_image_border_radius}"image"!=t&&1==E.slider_video_constantsize&&(n["background-color"]="#000000"),1==E.slider_image_shadow&&(n["box-shadow"]="3px 3px 10px 0px #353535"),e.css(n)}function N(e,t){var i=E.slider_video_constantsize_width,n=E.slider_video_constantsize_height,r=E.slider_video_constantsize_scalemode;return y.scaleImageExactSizeInParent(e,t.imageWidth,t.imageHeight,i,n,r)}function k(e,t,i){var n=e.children(".ug-item-wrapper"),r=_e(e);if(void 0===t.urlImage||""==t.urlImage)throw new Error("The slide don't have big image defined ( data-image='imageurl' ). Please check gallery items.","showbig");var o=t.urlImage,a=e.data("urlImage");e.data("urlImage",o);var s=c.getScaleMode(e),l=c.getSlideType(e);objPadding=c.getObjImagePadding();var u="";if("string"==typeof t.description&&(u=t.description),a==o&&!0!==i){(_=n.children("img")).attr("alt",u),0!=t.imageWidth&&0!=t.imageHeight||p.checkFillImageSize(_,t);var d={};H(_,l,d="image"!=l&&1==E.slider_video_constantsize?N(_,t):y.scaleImageFitParent(_,t.imageWidth,t.imageHeight,s,objPadding)),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else{var _;if((_=y.placeImageInsideParent(o,n,t.imageWidth,t.imageHeight,s,objPadding)).attr("alt",u),1==t.isBigImageLoaded){if(_.fadeTo(0,1),L(r),"image"!=l&&1==E.slider_video_constantsize)d=N(_,t);else d=y.getImageInsideParentData(n,t.imageWidth,t.imageHeight,s,objPadding);_.css("width",d.imageWidth+"px"),H(_,l,d),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else _.fadeTo(0,0),function(e){e.stop(!0).show(100)}(r),e.data("isLoading",!0),c.isSlideCurrent(e)&&h.trigger(c.events.CURRENTSLIDE_LOAD_START),_.data("itemIndex",t.index),_.on("load",function(){var e=jQuery(this),t=e.data("itemIndex");e.fadeTo(0,1);var i=e.parent().parent(),n=c.getSlideType(i),r=_e(i),o=c.getObjImagePadding(),a=c.getScaleMode(i);L(r),i.data("isLoading",!1),c.isSlideCurrent(i)&&h.trigger(c.events.CURRENTSLIDE_LOAD_END),p.onItemBigImageLoaded(null,e);var s=p.getItem(t),l={};"image"!=n&&1==E.slider_video_constantsize?N(e,s):l=y.scaleImageFitParent(e,s.imageWidth,s.imageHeight,a,o),e.fadeTo(0,1),H(e,n,l),h.trigger(c.events.AFTER_PUT_IMAGE,i)})}}function R(e,t){try{var i=e.children(".ug-item-wrapper");if(null==t)return i.html(""),e.removeData("index"),e.removeData("type"),e.removeData("urlImage"),!1;e.data("index");e.data("index",t.index),e.data("type",t.type),1==E.slider_enable_links&&"image"==t.type&&(t.link?e.addClass("ug-slide-clickable"):e.removeClass("ug-slide-clickable")),k(e,t);var n=ge(e);switch(t.type){case"image":n.hide();break;default:n.show()}}catch(e){throw void 0!==e.fileName&&"showbig"==e.fileName&&p.showErrorMessageReplaceGallery(e.message),i.html(""),new Error(e)}}function G(){if(!w)return!1;if(1==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(t=E.slider_controls_appear_duration),e.stop().fadeTo(t,0),e.data("isHidden",!0)}function D(){if(!w)return!1;if(0==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(e.show(),w.positionElements(),t=E.slider_controls_appear_duration),e.stop().show().fadeTo(t,1),e.data("isHidden",!1)}function Q(){return!1!==w.getElement().data("isHidden")}function W(){var e=c.getCurrentSlide(),t=c.getSlideImage(e),i=y.getElementSize(e),n=i.left,r=i.top;if(1==E.slider_video_constantsize){var o=y.getElementSize(t);n+=o.left,r+=o.top}else n+=E.slider_video_padding_left,r+=E.slider_video_padding_top;v.setPosition(n,r)}function B(){var e=E.slider_video_constantsize_width,t=E.slider_video_constantsize_height;v.setSize(e,t),H(v.getObject(),"video")}function F(e,t,i){h.trigger(c.events.TRANSITION_START);var r=E.slider_transition;switch(i&&(r=i),c.stopSlideAction(null,!0),r){default:case"fade":U(t);break;case"slide":!function e(t,i){var r=c.isAnimating();if(1==r)return S.itemWaiting=i,!0;null!=S.itemWaiting&&(S.itemWaiting=null);var o=c.getSlidesReference();switch(t){case"right":R(o.objPrevSlide,i),O();var a=y.getElementSize(o.objPrevSlide),s=-a.left;c.switchSlideNums("right");break;case"left":R(o.objNextSlide,i),O();var l=y.getElementSize(o.objNextSlide),s=-l.left;c.switchSlideNums("left");break;default:throw new Error("wrong direction: "+t)}var u=E.slider_transition_speed;var d=E.slider_transition_easing;var _={duration:u,easing:d,queue:!1,always:function(){if(c.stopSlideAction(),v.hide(),null!=S.itemWaiting){var t=function(e){var t=c.getSlidesReference().objCurrentSlide.data("index"),i=e.index,n="left";t>i&&(n="right");return n}(S.itemWaiting);e(t,S.itemWaiting)}else c.placeNabourItems(),h.trigger(c.events.TRANSITION_END)}};n.animate({left:s+"px"},_)}(e,t);break;case"lightbox_open":U(t,!1,!0)}}function Y(e,t,i){i?e.fadeTo(E.slider_transition_speed,t,i):e.fadeTo(E.slider_transition_speed,t)}function U(e,t,i){if(!t)t=!1;var n=c.getSlidesReference();R(n.objNextSlide,e);var r=y.getElementSize(n.objCurrentSlide);y.placeElement(n.objNextSlide,r.left,r.top);var o=S.numCurrent;if(S.numCurrent=S.numNext,S.numNext=o,h.trigger(c.events.ITEM_CHANGED),n.objNextSlide.stop(!0),n.objCurrentSlide.stop(!0),1==t)n.objCurrentSlide.fadeTo(0,0),n.objNextSlide.fadeTo(0,1),c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide();else{if(n.objNextSlide.fadeTo(0,0),Y(n.objCurrentSlide,0,function(){c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide()}),1==v.isVisible())Y(v.getObject(),0);Y(n.objNextSlide,1)}}function V(){return i.children(".ug-slider-control")}function X(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(0==S.isControlsVisible)return!1;if(!e)e=!1;var t=V();!0===e?t.stop().fadeTo(0,0).hide():t.stop().fadeTo(E.slider_controls_appear_duration,0,function(){t.hide()}),S.isControlsVisible=!1}function Z(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(1==S.isControlsVisible)return!0;if(!e)e=!1;var t=V();!0===e?t.stop().show():(t.stop().show().fadeTo(0,0),t.fadeTo(E.slider_controls_appear_duration,1)),S.isControlsVisible=!0}function q(e){if(e==S.currentControlsMode)return!1;switch(e){case"image":_&&_.getElement().show();break;case"video":_&&_.getElement().hide();break;default:throw new Error("wrong controld mode: "+e)}S.currentControlsMode=e}function K(e,t,i){var n=p.getSelectedItem();c.setItem(n,!1,i);var r=n.index;b&&b.setActive(r),w&&0==S.isTextPanelSaparateHover&&D(),"image"==n.type?q("image"):q("video")}function J(e,t){p.selectItem(t)}function $(e){if(u&&0==u.isTapEventOccured(e))return!0;h.trigger(c.events.CLICK,e)}function ee(){var e=c.getCurrentSlide().hasClass("ug-slide-clickable"),t=c.getCurrentItem();if(e)return 0==E.slider_links_newpage?location.href=t.link:window.open(t.link,"_blank"),!0;0==E.slider_controls_always_on&&1==E.slider_controls_appear_ontap&&1==c.isCurrentSlideType("image")&&(0==S.isControlsVisible?Z():X(),w&&1==E.slider_textpanel_always_on&&c.isCurrentSlideType("image")&&c.isCurrentSlideImageFit()&&D())}function te(e){w&&c.isCurrentSlideType("image")&&0==c.isCurrentSlideImageFit()&&G()}function ie(){Z()}function ne(){X()}function re(e){var t=e.parent();c.startSlideAction(t)}function oe(){p.isPlayMode()&&p.pausePlaying(),h.trigger(c.events.ACTION_START)}function ae(){p.isPlayMode()&&p.continuePlaying(),h.trigger(c.events.ACTION_END)}function se(e,t,i){r.data("index")==t&&(objItem=p.getItem(t),k(r,objItem,!0)),o.data("index")==t&&(objItem=p.getItem(t),k(o,objItem,!0)),a.data("index")==t&&(objItem=p.getItem(t),k(a,objItem,!0))}function le(e,t){t=jQuery(t);var i=c.getSlideImage(t),n=ge(t),r=y.getElementSize(i);y.placeElement(n,"center","middle",r.left,r.top,i)}function ue(e){var t=ge(e);y.addClassOnHover(t),y.setButtonOnClick(t,re)}function de(e){switch(e){case 1:return r;case 2:return o;case 3:return a;default:throw new Error("wrong num: "+e)}}function _e(e){if(!e)e=c.getCurrentSlide();return e.children(".ug-slider-preloader")}function ge(e){return e.children(".ug-button-videoplay")}function ce(e){if(!e)e=c.getCurrentSlide();var t=e.data("index");return null==t?null:p.getItem(t)}this.switchSlideNums=function(e){switch(h.trigger(c.events.BEFORE_SWITCH_SLIDES),e){case"left":var t=S.numCurrent;S.numCurrent=S.numNext,S.numNext=S.numPrev,S.numPrev=t;break;case"right":t=S.numCurrent;S.numCurrent=S.numPrev,S.numPrev=S.numNext,S.numNext=t;break;default:throw new Error("wrong direction: "+e)}h.trigger(c.events.ITEM_CHANGED)},this.destroy=function(){h.off(c.events.AFTER_PUT_IMAGE),e.off(p.events.ITEM_IMAGE_UPDATED),e.off(p.events.ITEM_CHANGE),b&&jQuery(b).on(b.events.BULLET_CLICK),i.off("mouseenter"),i.off("mouseleave"),i.off("touchend"),i.off("click"),h.off(c.events.CLICK),d&&h.off(c.events.ZOOM_CHANGE),h.off(c.events.BEFORE_SWITCH_SLIDES),jQuery(v).off(v.events.SHOW),jQuery(v).off(v.events.HIDE),v.destroy(),i.off("mouseenter",".ug-item-wrapper img"),i.off("mouseleave",".ug-item-wrapper img")},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(e,t,i){P(e,t,i)},this.getSlideImage=function(e){if(!e)e=c.getCurrentSlide();return e.find(".ug-item-wrapper img")},this.setHtml=function(e){C(e)},this.run=function(){x()},this.isInnerInPlace=function(){var e=c.getSlidesReference();return-y.getElementSize(e.objCurrentSlide).left==y.getElementSize(n).left},this.isAnimating=function(){return n.is(":animated")},this.isSlideCurrent=function(e){var t=e.data("slidenum");return S.numCurrent==t},this.isSlideHasItem=function(e){var t=e.data("index");return null!=t},this.getObjImagePadding=function(){return{padding_top:E.slider_image_padding_top,padding_bottom:E.slider_image_padding_bottom,padding_left:E.slider_image_padding_left,padding_right:E.slider_image_padding_right}},this.getSlidesReference=function(){return{objPrevSlide:de(S.numPrev),objNextSlide:de(S.numNext),objCurrentSlide:de(S.numCurrent)}},this.getCurrentSlide=function(){return c.getSlidesReference().objCurrentSlide},this.getCurrentItemIndex=function(){var e=c.getSlidesReference().objCurrentSlide.data("index");return null==e&&(e=-1),e},this.getCurrentItem=function(){var e=c.getCurrentItemIndex();return-1==e?null:p.getItem(e)},this.getSlideType=function(e){return null==e&&(e=c.getCurrentSlide()),e.data("type")},this.isMouseInsideSlideImage=function(e){var t=c.getSlideImage(),i=y.getMousePosition(e);void 0===i.pageX&&(i=u.getLastMousePos());var n=y.getMouseElementPoint(i,t),r=y.getElementSize(t);return isMouseInside=y.isPointInsideElement(n,r),isMouseInside},this.isCurrentSlideType=function(e){return c.getSlideType()==e},this.isCurrentSlideLoadingImage=function(){return!0===c.getCurrentSlide().data("isLoading")},this.setItem=function(e,t,i){var n=c.getSlidesReference(),r=n.objCurrentSlide.data("index"),o=e.index;if(o==r)return!0;if(null==r)R(n.objCurrentSlide,e),c.placeNabourItems();else{var a="left";p.getNumItems();"next"==i?a="left":"prev"==i||r>o?a="right":r>o&&(a="right"),F(a,e,t)}},this.placeNabourItems=function(){var e=c.getSlidesReference(),t=e.objCurrentSlide.data("index"),i=p.getPrevItem(t),n=p.getNextItem(t);R(e.objNextSlide,n),R(e.objPrevSlide,i),O()},this.________EXTERNAL_API___________=function(){},this.stopSlideAction=function(e,t){e||(e=c.getCurrentSlide()),!0===t?v.pause():v.hide()},this.startSlideAction=function(e){e||(e=c.getCurrentSlide());var t=ce(e);if("image"==t.type)return!0;switch(1==E.slider_video_constantsize&&B(),W(),v.show(),t.type){case"youtube":v.playYoutube(t.videoid);break;case"vimeo":v.playVimeo(t.videoid);break;case"html5video":v.playHtml5Video(t.videoogv,t.videowebm,t.videomp4,t.urlImage);break;case"soundcloud":v.playSoundCloud(t.trackid);break;case"wistia":v.playWistia(t.videoid)}},this.getScaleMode=function(e){if(!e)e=c.getCurrentSlide();return"image"!=c.getSlideType(e)?E.slider_scale_mode_media:E.slider_scale_mode==E.slider_scale_mode_fullscreen?E.slider_scale_mode:1==p.isFullScreen()?E.slider_scale_mode_fullscreen:E.slider_scale_mode},this.getObjects=function(){return{g_objSlider:i,g_objInner:n,g_options:E,g_objZoomSlider:d}},this.getObjZoom=function(){return d},this.getOptions=function(){return E},this.getElement=function(){return i},this.getVideoObject=function(){return v},this.isCurrentSlideImageFit=function(){var e=c.getCurrentSlide();c.getSlideType(e);!function(e,t){null==t&&(t=c.getCurrentSlide());var i=c.getSlideType(t);if(i!=e)throw new Error("Wrong slide type: "+i+", should be: "+e)}("image",e);var t=c.getSlideImage(e);return 0!=t.length&&y.isImageFitParent(t)},this.isCurrentImageInPlace=function(){var e=c.getSlideImage();if(0==e.length)return!1;var t=c.getScaleMode(),i=c.getObjImagePadding(),n=ce(),r=e.parent(),o=y.getImageInsideParentData(r,n.imageWidth,n.imageHeight,t,i),a=y.getElementSize(e),s=!1;return o.imageWidth==a.width&&(s=!0),s},this.isSlideActionActive=function(){return v.isVisible()},this.isSwiping=function(){return!!u&&u.isTouchActive()},this.isPreloading=function(){return!!_e().is(":visible")},this.setOptions=function(e){g&&(e=y.convertCustomPrefixOptions(e,g,"slider")),E=jQuery.extend(E,e)},this.setSize=function(e,t){if(e<0||t<0)return!0;var s={};s.width=e+"px",s.height=t+"px",i.css(s);var l={};l.height=t+"px",l.top="0px",l.left="0px",n.css(l);var u={};u.height=t+"px",u.width=e+"px",r.css(u),o.css(u),a.css(u);var d=e-E.slider_item_padding_left-E.slider_item_padding_right,_=t-E.slider_item_padding_top-E.slider_item_padding_bottom,g={};if(g.width=d+"px",g.height=_+"px",g.top=E.slider_item_padding_top+"px",g.left=E.slider_item_padding_left+"px",i.find(".ug-item-wrapper").css(g),w&&w.setSizeByParent(),M(),z(r),z(o),z(a),O(),"image"!=c.getSlideType()&&1==E.slider_video_constantsize)B();else{var h=e-E.slider_video_padding_left-E.slider_video_padding_right,p=t-E.slider_video_padding_top-E.slider_video_padding_bottom;v.setSize(h,p)}W()},this.refreshSlideItems=function(){if(1==c.isAnimating())return!0;z(r),z(o),z(a),O()},this.isMouseOver=function(){return i.ismouseover()},this.setPosition=function(e,t){y.placeElement(i,e,t)},this.zoomIn=function(){if(!d)return!0;d.zoomIn()},this.zoomOut=function(){if(!d)return!0;d.zoomOut()},this.zoomBack=function(){if(!d)return!0;d.zoomBack()}}function UGTextPanel(){var e,t,i,n,r,o,a,s=this,l=new UGFunctions,u="",d={textpanel_align:"bottom",textpanel_margin:0,textpanel_text_valign:"middle",textpanel_padding_top:10,textpanel_padding_bottom:10,textpanel_height:null,textpanel_padding_title_description:5,textpanel_padding_right:11,textpanel_padding_left:11,textpanel_fade_duration:200,textpanel_enable_title:!0,textpanel_enable_description:!0,textpanel_title_as_link:!1,textpanel_title_link_newtab:!0,textpanel_enable_bg:!0,textpanel_bg_color:"#000000",textpanel_bg_opacity:.4,textpanel_title_color:null,textpanel_title_font_family:null,textpanel_title_text_align:null,textpanel_title_font_size:null,textpanel_title_bold:null,textpanel_css_title:{},textpanel_desc_color:null,textpanel_desc_font_family:null,textpanel_desc_text_align:null,textpanel_desc_font_size:null,textpanel_desc_bold:null,textpanel_css_description:{},textpanel_desc_style_as_title:!1,textpanel_bg_css:{}},_={isFirstTime:!0,setInternalHeight:!0,lastTitleBottom:0,lastDescHeight:0};function g(t,a){if(!a)a=d.textpanel_padding_top;var s=a;if(i){var u=s;if(l.placeElement(i,0,u),1==i.is(":visible")){(s=l.getElementSize(i).bottom)>0&&(_.lastTitleBottom=s)}else{s=20;_.lastTitleBottom>0&&(s=_.lastTitleBottom)}}var g="";if(n&&(g=jQuery.trim(n.text())),""!=g){var c=s;if(i&&(c+=d.textpanel_padding_title_description),l.placeElement(n,0,c),1==jQuery(n).is(":visible")){var h=l.getElementSize(n);s=h.bottom,h.height>0&&(_.lastDescHeight=h.height)}else{var p=16;_.lastDescHeight>0&&(p=_.lastDescHeight),s=c+p}}d.textpanel_height||1!=_.setInternalHeight||function(t,i){if(!i)var i=!1;if(1==i){if(r){var n=r.height();t>n&&r.height(t)}var a={height:t+"px"};e.add(o).animate(a,d.textpanel_fade_duration)}else r&&r.height(t),e.add(o).height(t)}(s+d.textpanel_padding_bottom,t)}function c(){var e=0;if(i&&(e+=i.outerHeight()),n){var t="";n&&(t=jQuery.trim(n.text())),""!=t&&(i&&(e+=d.textpanel_padding_title_description),e+=n.outerHeight())}return e}function h(){if(1==d.textpanel_enable_bg){(r=e.children(".ug-textpanel-bg")).fadeTo(0,d.textpanel_bg_opacity);var t={"background-color":d.textpanel_bg_color};t=jQuery.extend(t,d.textpanel_bg_css),r.css(t)}if(1==d.textpanel_enable_title){i=o.children(".ug-textpanel-title");var a={};null!==d.textpanel_title_color&&(a.color=d.textpanel_title_color),null!==d.textpanel_title_font_family&&(a["font-family"]=d.textpanel_title_font_family),null!==d.textpanel_title_text_align&&(a["text-align"]=d.textpanel_title_text_align),null!==d.textpanel_title_font_size&&(a["font-size"]=d.textpanel_title_font_size+"px"),null!==d.textpanel_title_bold&&(!0===d.textpanel_title_bold?a["font-weight"]="bold":a["font-weight"]="normal"),d.textpanel_css_title&&(a=jQuery.extend(a,d.textpanel_css_title)),i.css(a)}if(1==d.textpanel_enable_description){n=o.children(".ug-textpanel-description");var s={};null!==d.textpanel_desc_color&&(s.color=d.textpanel_desc_color),null!==d.textpanel_desc_font_family&&(s["font-family"]=d.textpanel_desc_font_family),null!==d.textpanel_desc_text_align&&(s["text-align"]=d.textpanel_desc_text_align),null!==d.textpanel_desc_font_size&&(s["font-size"]=d.textpanel_desc_font_size+"px"),null!==d.textpanel_desc_bold&&(!0===d.textpanel_desc_bold?s["font-weight"]="bold":s["font-weight"]="normal"),d.textpanel_css_title&&(s=jQuery.extend(s,d.textpanel_css_description)),n.css(s)}}function p(){var e=a.getSelectedItem();s.setText(e.title,e.description,e.link)}this.positionElements=function(e){if(!d.textpanel_height||"top"==d.textpanel_text_valign)return g(e),!1;switch(d.textpanel_text_valign){default:case"top":g(!1);break;case"bottom":t=c(),g(!1,o.height()-t-d.textpanel_padding_bottom);break;case"center":case"middle":!function(){var e=c();g(!1,(o.height()-e)/2)}()}var t},this.init=function(e,t,i){if(a=e,i&&(u=i,t=l.convertCustomPrefixOptions(t,u,"textpanel")),t&&(d=jQuery.extend(d,t)),0==d.textpanel_enable_title&&0==d.textpanel_enable_description)throw new Error("Textpanel Error: The title or description must be enabled");d.textpanel_height&&d.textpanel_height<0&&(d.textpanel_height=null),1==d.textpanel_desc_style_as_title&&(d.textpanel_desc_color||(d.textpanel_desc_color=d.textpanel_title_color),d.textpanel_desc_bold||(d.textpanel_desc_bold=d.textpanel_title_bold),d.textpanel_desc_font_family||(d.textpanel_desc_font_family=d.textpanel_title_font_family),d.textpanel_desc_font_size||(d.textpanel_desc_font_size=d.textpanel_title_font_size),d.textpanel_desc_text_align||(d.textpanel_desc_text_align=d.textpanel_title_text_align))},this.appendHTML=function(i,n){t=i;var r="<div class='ug-textpanel"+(n=n?" "+n:"")+"'>";1==d.textpanel_enable_bg&&(r+="<div class='ug-textpanel-bg"+n+"'></div>"),r+="<div class='ug-textpanel-textwrapper"+n+"'>",1==d.textpanel_enable_title&&(r+="<div class='ug-textpanel-title"+n+"'></div>"),1==d.textpanel_enable_description&&(r+="<div class='ug-textpanel-description"+n+"'></div>"),r+="</div></div>",i.append(r),e=i.children(".ug-textpanel"),o=e.children(".ug-textpanel-textwrapper"),h()},this.destroy=function(){jQuery(a).off(a.events.ITEM_CHANGE)},this.run=function(){s.setSizeByParent(),jQuery(a).on(a.events.ITEM_CHANGE,p)},this.setPanelSize=function(t,a){if(_.setInternalHeight=!0,a)_.setInternalHeight=!1;else a=80;d.textpanel_height&&(a=d.textpanel_height),e.width(t),e.height(a),r&&(r.width(t),r.height(a));var u=t-d.textpanel_padding_left-d.textpanel_padding_right,g=d.textpanel_padding_left;l.setElementSizeAndPosition(o,g,0,u,a),i&&i.width(u),n&&n.width(u),0==_.isFirstTime&&s.positionElements(!1)},this.setSizeByParent=function(){var e=l.getElementSize(t);s.setPanelSize(e.width)},this.setTextPlain=function(e,t,r){if(1==d.textpanel_title_as_link&&e&&r){var o="";1==d.textpanel_title_link_newtab&&(o+=' target="blank"'),e='<a class="ug-textpanel-link" href="'+r+'" '+o+">"+e+"</a>"}i&&i.html(e),n&&n.html(t)},this.setText=function(e,t,i){1==_.isFirstTime?(s.setTextPlain(e,t,i),_.isFirstTime=!1,s.positionElements(!1)):o.stop().fadeTo(d.textpanel_fade_duration,0,function(){s.setTextPlain(e,t,i),s.positionElements(!0),jQuery(this).fadeTo(d.textpanel_fade_duration,1)})},this.positionPanel=function(t,i){var n={};if(null!=t)n.top=t,n.bottom="auto";else switch(d.textpanel_align){case"top":n.top=d.textpanel_margin+"px";break;case"bottom":n.top="auto",n.bottom=d.textpanel_margin+"px";break;case"middle":n.top=l.getElementRelativePos(e,"middle",d.textpanel_margin)}null!=i&&(n.left=i),e.css(n)},this.setOptions=function(e){u&&(e=l.convertCustomPrefixOptions(e,u,"textpanel")),d=jQuery.extend(d,e)},this.getElement=function(){return e},this.getSize=function(){return l.getElementSize(e)},this.refresh=function(e,t,i,n){h(),i?s.setPanelSize(i,n):s.setSizeByParent(),s.positionElements(!1),!0!==t&&s.positionPanel(),!0===e&&s.show()},this.hide=function(){e.hide()},this.show=function(){e.show()},this.getOptions=function(){return d},this.getOption=function(e){return 0==d.hasOwnProperty(e)?null:d[e]}}function UGZoomButtonsPanel(){var e,t,i,n,r=new UGSlider,o=new UGFunctions,a={slider_zoompanel_skin:""};function s(e){return!e||!!e.hasClass("ug-zoompanel-button-disabled")}function l(e){e&&e.addClass("ug-zoompanel-button-disabled")}function u(e){e&&e.removeClass("ug-zoompanel-button-disabled")}function d(){if(0==r.isCurrentSlideType("image"))return!0;1==r.isCurrentSlideImageFit()?0==s(i)&&(l(i),l(n)):1==s(i)&&(u(i),u(n))}this.init=function(e,t){r=e,t&&(a=jQuery.extend(a,t))},this.appendHTML=function(r){r;var o="<div class='ug-slider-control ug-zoompanel ug-skin-"+a.slider_zoompanel_skin+"'>";o+="<div class='ug-zoompanel-button ug-zoompanel-plus'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-minus ug-zoompanel-button-disabled'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-return ug-zoompanel-button-disabled'></div>",o+="</div>",r.append(o),e=r.children(".ug-zoompanel"),t=e.children(".ug-zoompanel-plus"),i=e.children(".ug-zoompanel-minus"),n=e.children(".ug-zoompanel-return")},this.setObjects=function(e,r,o){t=e,n=o,(i=r)&&i.addClass("ug-zoompanel-button-disabled"),n&&n.addClass("ug-zoompanel-button-disabled")},this.getElement=function(){return e},this.initEvents=function(){o.addClassOnHover(t,"ug-button-hover"),o.addClassOnHover(i,"ug-button-hover"),o.addClassOnHover(n,"ug-button-hover"),o.setButtonOnClick(t,function(){if(1==s(t))return!0;r.zoomIn()}),o.setButtonOnClick(i,function(){if(1==s(i))return!0;r.zoomOut()}),o.setButtonOnClick(n,function(){if(1==s(n))return!0;r.zoomBack()}),jQuery(r).on(r.events.ZOOM_CHANGE,d),jQuery(r).on(r.events.ITEM_CHANGED,d)}}function UGBullets(){var e,t,i=this,n=0,r=new UniteGalleryMain,o=new UGFunctions,a={isInited:!1},s={bullets_skin:"",bullets_addclass:"",bullets_space_between:-1};function l(){var i="",r="";-1!=s.bullets_space_between&&(r=" style='margin-left:"+s.bullets_space_between+"px'");for(var o=0;o<n;o++)i+=0==o?"<div class='ug-bullet'></div>":"<div class='ug-bullet'"+r+"></div>";if(e.html(i),!t){var a=e.find(".ug-bullet:first-child");a.length&&(t=a.width())}}function u(e){if(1==i.isActive(e))return!0;var t=e.index();jQuery(i).trigger(i.events.BULLET_CLICK,t)}function d(){var t=e.children(".ug-bullet");o.setButtonOnClick(t,u),t.on("mousedown mouseup",function(e){return!1})}function _(e){if(e<0||e>=n)throw new Error("wrong bullet index: "+e)}function g(){if(1==a.isInited)return!0;throw new Error("The bullets are not inited!")}this.events={BULLET_CLICK:"bullet_click"},this.init=function(e,t,i){r=e,n=i||r.getNumItems(),a.isInited=!0,""==(s=jQuery.extend(s,t)).bullets_skin&&(s.bullets_skin=s.gallery_skin)},this.getBulletsWidth=function(){return 0==n?0:t?n*t+(n-1)*s.bullets_space_between:0},this.appendHTML=function(t){t,g();var i="";""!=s.bullets_addclass&&(i=" "+s.bullets_addclass);var n="<div class='ug-slider-control ug-bullets ug-skin-"+s.bullets_skin+i+"'>";e=jQuery(n+="</div>"),t.append(e),l(),d()},this.updateNumBullets=function(e){n=e,l(),d()},this.getElement=function(){return e},this.setActive=function(t){g(),_(t);var i=e.children(".ug-bullet");i.removeClass("ug-bullet-active"),jQuery(i[t]).addClass("ug-bullet-active"),t},this.isActive=function(t){if(_(t),"number"!=typeof t)var i=t;else i=e.children(".ug-bullet")[t];return!!i.hasClass("ug-bullet-active")},this.getNumBullets=function(){return n}}function UGProgressBar(){var e,t,i=this,n=0,r=new UGFunctions,o={slider_progressbar_color:"#ffffff",slider_progressbar_opacity:.6,slider_progressbar_line_width:5};this.put=function(i,n){n&&(o=jQuery.extend(o,n)),i.append("<div class='ug-progress-bar'><div class='ug-progress-bar-inner'></div></div>"),e=i.children(".ug-progress-bar"),(t=e.children(".ug-progress-bar-inner")).css("background-color",o.slider_progressbar_color),e.height(o.slider_progressbar_line_width),t.height(o.slider_progressbar_line_width),t.width("0%");var r=o.slider_progressbar_opacity,a=t[0];a.style.opacity=r,a.style.filter="alpha(opacity="+100*r+")"},this.putHidden=function(t,n){i.put(t,n),e.hide()},this.getElement=function(){return e},this.setSize=function(n){e.width(n),t.width(n),i.draw()},this.setPosition=function(t,i,n,o){r.placeElement(e,t,i,n,o)},this.draw=function(){var e=100*n;t.width(e+"%")},this.setProgress=function(e){n=r.normalizePercent(e),i.draw()},this.getType=function(){return"bar"}}function UGProgressPie(){var e,t=this,i=!1,n=new UGFunctions,r={slider_progresspie_type_fill:!1,slider_progresspie_color1:"#B5B5B5",slider_progresspie_color2:"#E5E5E5",slider_progresspie_stroke_width:6,slider_progresspie_width:30,slider_progresspie_height:30};function o(t){if(!t)t=0;var n=Math.min(r.slider_progresspie_width,r.slider_progresspie_height)/2,o=e[0].getContext("2d");0==i&&(i=!0,o.rotate(1.5*Math.PI),o.translate(-2*n,0)),o.clearRect(0,0,r.slider_progresspie_width,r.slider_progresspie_height);var a=r.slider_progresspie_width/2,s=r.slider_progresspie_height/2,l=0,u=t*Math.PI*2;if(1==r.slider_progresspie_type_fill)o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath();else{o.globalCompositeOperation="source-over",o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath(),o.globalCompositeOperation="destination-out";var d=n-r.slider_progresspie_stroke_width;o.beginPath(),o.moveTo(a,s),o.arc(a,s,d,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath()}1==r.slider_progresspie_type_fill&&(l=u,u=2*Math.PI,o.beginPath(),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color2,o.fill(),o.closePath())}this.put=function(t,i){i&&(r=jQuery.extend(r,i)),t.append("<canvas class='ug-canvas-pie' width='"+r.slider_progresspie_width+"' height='"+r.slider_progresspie_height+"'></canvas>"),e=t.children(".ug-canvas-pie")},this.putHidden=function(i,n){t.put(i,n),o(.1),e.hide()},this.getElement=function(){return e},this.setPosition=function(t,i){n.placeElement(e,t,i)},this.getSize=function(){return{width:r.slider_progresspie_width,height:r.slider_progresspie_height}},this.setProgress=function(e){e=n.normalizePercent(e),e,o(e)},this.getType=function(){return"pie"}}function UGTouchSliderControl(){var e,t,i,n=new UGSlider,r=new UGFunctions,o={slider_transition_continuedrag_speed:250,slider_transition_continuedrag_easing:"linear",slider_transition_return_speed:300,slider_transition_return_easing:"easeInOutQuad"},a={touch_active:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startPosx:0,startTime:0,isInitDataValid:!1,slides:null,lastNumTouches:0,isDragging:!1,storedEventID:"touchSlider",videoStartX:0,isDragVideo:!1,videoObject:null};function s(e){if(!e)e=n.getSlidesReference();return-r.getElementSize(e.objCurrentSlide).left-r.getElementSize(t).left}function l(e){if(1==n.isInnerInPlace())return!1;if(i.trigger(n.events.BEFORE_RETURN),!e)e=n.getSlidesReference();var s=-r.getElementSize(e.objCurrentSlide).left;t.animate({left:s+"px"},{duration:o.slider_transition_return_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(e,i,n){if(1==a.isDragVideo){var o=r.getElementSize(t).left-s,l=a.videoStartX+o;a.videoObject.css("left",l)}},complete:function(){i.trigger(n.events.AFTER_RETURN)}})}function u(){var e=n.getSlidesReference(),u=s(e);if(0==u)return!1;var d=u>0?"left":"right",_=!1;switch(d){case"right":if(n.isSlideHasItem(e.objPrevSlide))var g=-r.getElementSize(e.objPrevSlide).left;else _=!0;break;case"left":if(n.isSlideHasItem(e.objNextSlide))g=-r.getElementSize(e.objNextSlide).left;else _=!0}1==_?l(e):t.stop().animate({left:g+"px"},{duration:o.slider_transition_continuedrag_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(){if(1==a.isDragVideo){var e=r.getElementSize(t).left-a.startPosx,i=a.videoStartX+e;a.videoObject.css("left",i)}},always:function(){!function(e){n.getVideoObject().hide(),n.switchSlideNums(e),n.placeNabourItems()}(d),i.trigger(n.events.AFTER_DRAG_CHANGE)}})}function d(e){var i=r.getMousePosition(e);a.startMouseX=i.pageX,a.startMouseY=i.pageY,a.lastMouseX=a.startMouseX,a.lastMouseY=a.startMouseY,a.startTime=jQuery.now();var n=r.getArrTouches(e);a.startArrTouches=r.getArrTouchPositions(n);var o=r.getElementSize(t);a.startPosx=o.left,a.isInitDataValid=!0,a.isDragVideo=!1,r.storeEventData(e,a.storedEventID)}function _(e){a.touch_active=!1}function g(e,t){a.touch_active=!0,d(t)}function c(e){return e.preventDefault(),a.isDragging=!1,1==n.isAnimating()&&t.stop(!0,!0),r.getArrTouches(e).length>1?(1==a.touch_active&&_(),!0):1==a.touch_active||void g(0,e)}function h(s){if(0==a.touch_active)return!0;if(0==s.buttons)return _(),u(),!0;r.updateStoredEventData(s,a.storedEventID),s.preventDefault();var l=r.getMousePosition(s);a.lastMouseX=l.pageX,a.lastMouseY=l.pageY;var g=null;1==o.slider_vertical_scroll_ondrag&&(g=r.handleScrollTop(a.storedEventID)),"vert"!==g&&function(r){var o=a.lastMouseX-a.startMouseX;if(0==o)return!0;var s=o<0?"left":"right",l=n.getObjZoom();if(l){if(1==l.isPanEnabled(r,s))return a.isInitDataValid=!1,!0;if(0==a.isInitDataValid)return d(r),!0}var u=a.startPosx+o;o>0&&u>0?u/=3:o<0&&u+t.width()<e.width()&&(u=a.startPosx+o/3);if(0==a.isDragging&&(a.isDragging=!0,i.trigger(n.events.START_DRAG)),t.css("left",u+"px"),1==a.isDragVideo){var _=u-a.startPosx,g=a.videoStartX+_;a.videoObject.css("left",g)}}(s)}function p(e){var t=r.getArrTouches(e).length;if(1==n.isInnerInPlace()&&0==a.touch_active&&0==t)return!0;if(0==t&&1==a.touch_active){_();var i=!1;0==r.wasVerticalScroll(a.storedEventID)&&(i=function(){var e=n.getSlidesReference(),t=s(e),i=Math.round(3*e.objCurrentSlide.width()/8);if(Math.abs(t)>=i)return!0;var r=Math.abs(a.lastMouseX-a.startMouseX);return Math.abs(a.lastMouseY-a.startMouseY),!(r<20)&&jQuery.now()-a.startTime<500}()),1==i?u():l()}else 1==t&&0==a.touch_active&&g(0,e)}this.isTapEventOccured=function(e){var t=r.getArrTouches(e).length;if(0!=t||0!=a.lastNumTouches)return a.lastNumTouches=t,!1;a.lastNumTouches=t;s(n.getSlidesReference());var i=Math.abs(a.lastMouseX-a.startMouseX),o=Math.abs(a.lastMouseY-a.startMouseY),l=jQuery.now()-a.startTime;return i<20&&o<50&&l<500},this.init=function(r,a){n=r,i=jQuery(n),g_objects=r.getObjects(),e=g_objects.g_objSlider,t=g_objects.g_objInner,o=jQuery.extend(o,a),e.bind("mousedown touchstart",c),jQuery("body").bind("mousemove touchmove",h),jQuery(window).add("body").bind("mouseup touchend",p)},this.getLastMousePos=function(){return{pageX:a.lastMouseX,pageY:a.lastMouseY}},this.isTouchActive=function(){return a.touch_active}}function UGZoomSliderControl(){var e,t,i=new UGSlider,n=new UGFunctions,r={slider_zoom_step:1.2,slider_zoom_max_ratio:6,slider_zoom_return_pan_duration:400,slider_zoom_return_pan_easing:"easeOutCubic"},o={isPanActive:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startImageX:0,startImageY:0,panXActive:!1,panYActive:!1,objImage:null,objImageSize:null,objParent:null,objParentSize:null,objSlide:null,storeImageLastTime:0,isZoomActive:!1,startDistance:0,startMiddlePoint:null,imageOrientPoint:null,objFitImageSize:null,isZoomedOnce:!1};function a(n,a){i=n,t=jQuery(i),g_objects=n.getObjects(),e=g_objects.g_objSlider,g_objects.g_objInner,r=jQuery.extend(r,a),e.on("mousewheel",b),e.bind("mousedown touchstart",p),jQuery("body").bind("mousemove touchmove",f),jQuery(window).add("body").bind("mouseup touchend",m),t.bind(i.events.BEFORE_RETURN,function(){h()}),t.bind(i.events.ITEM_CHANGED,function(){o.isZoomedOnce=!1}),t.bind(i.events.ZOOM_CHANGE,function(){o.isZoomedOnce=!0})}function s(){var e=i.getScaleMode();return"down"!=e&&(e="fit"),e}function l(){if((r=jQuery.now())-o.storeImageLastTime<20)return!1;var e=i.getSlidesReference();if(o.objSlide=e.objCurrentSlide,o.objImage=e.objCurrentSlide.find("img"),0==o.objImage.length)return!1;o.objImageSize=n.getElementSize(o.objImage),o.objParent=o.objImage.parent(),o.objParentSize=n.getElementSize(o.objParent);var t=s();objPadding=i.getObjImagePadding(),o.objFitImageSize=n.getImageInsideParentDataByImage(o.objImage,t,objPadding);var r=jQuery.now();return o.storeImageLastTime=r,!0}function u(e,o){var a=i.getSlidesReference().objCurrentSlide.find("img"),l=s();t.trigger(i.events.ZOOM_START);var u=!0,d=i.getObjImagePadding();if("back"==e){var _=n.getImageOriginalSize(a);n.scaleImageFitParent(a,_.width,_.height,l,d)}else{var g="in"==e;u=n.zoomImageInsideParent(a,g,r.slider_zoom_step,o,l,r.slider_zoom_max_ratio,d)}1==u&&(t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE),t.trigger(i.events.ZOOM_END))}function d(e,t,i){var r=n.getArrTouches(t);if(!0===i){if(1!=r.length)return!1}else if(r.length>1)return!1;return!!n.isElementBiggerThenParent(e)}function _(e){o.isPanActive=!0,function(e){var t=n.getMousePosition(e);o.startMouseX=t.pageX,o.startMouseY=t.pageY,o.lastMouseX=o.startMouseX,o.lastMouseY=o.startMouseY,o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height}(e)}function g(e){if(0==o.isZoomActive)return!1;2!=n.getArrTouches(e).length&&(o.isZoomActive=!1,t.trigger(i.events.ZOOM_END))}function c(e){if(1==o.isZoomActive)return!0;var r=n.getArrTouches(e);if(2!=r.length)return!0;!function(e){o.isZoomActive=!0,o.startDistance=n.getDistance(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),0==o.startDistance&&(o.startDistance=1),o.startMiddlePoint=n.getMiddlePoint(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),o.objImageSize=n.getElementSize(o.objImage),o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.imageOrientPoint=n.getElementLocalPoint(o.startMiddlePoint,o.objImage),0==n.isPointInsideElement(o.imageOrientPoint,o.objImageSize)&&(o.imageOrientPoint=n.getElementCenterPoint(o.objImage)),t.trigger(i.events.ZOOM_START)}(r)}function h(){if(null==o.objImage||0==o.objImage.length)return!0;if(n.getElementSize(o.objImage).width<o.objFitImageSize.imageWidth){o.objImage.css({position:"absolute",margin:"none"});var e={top:o.objFitImageSize.imageTop+"px",left:o.objFitImageSize.imageLeft+"px",width:o.objFitImageSize.imageWidth+"px",height:o.objFitImageSize.imageHeight+"px"};o.objImage.animate(e,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}else!function(){var e=!1,t=!1,a=0,s=0,l=n.getElementSize(o.objImage),u=i.getObjImagePadding(),d=n.getElementCenterPosition(o.objImage,u);o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height,1==o.panYActive?l.top>0?(s=0,t=!0):l.bottom<o.objParentSize.height&&(s=o.objParentSize.height-l.height,t=!0):l.top!=d.top&&(t=!0,s=d.top),1==o.panXActive?l.left>0?(a=0,e=!0):l.right<o.objParentSize.width&&(a=o.objParentSize.width-l.width,e=!0):l.left!=d.left&&(e=!0,a=d.left);var _={};1==t&&(_.top=s+"px"),1==e&&(_.left=a+"px"),1!=t&&1!=e||o.objImage.animate(_,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}()}function p(e){if(0==i.isCurrentSlideType("image"))return!0;l();if(null==o.objImage||0==o.objImage.length)return!0;e.preventDefault(),1==!(!o.objImage||!o.objImage.is(":animated"))&&o.objImage.stop(!0),1==o.isZoomActive?g(e):c(e),1==o.isZoomActive?o.isPanActive=!1:1==d(o.objImage,e)&&1==o.isZoomedOnce&&_(e)}function m(e){if(0==i.isCurrentSlideType("image"))return!0;if(1==jQuery(e.target).data("ug-button"))return!1;l();if(null==o.objImage||0==o.objImage.length)return!0;var t=o.isPanActive,n=o.isZoomActive;if(0==i.isInnerInPlace())return o.isZoomActive=!1,o.isPanActive=!1,!0;if(1==o.isZoomActive?g(e):c(e),1==o.isZoomActive)o.isPanActive=!1;else{var r=d(o.objImage,e,!0);1==o.isPanActive?o.isPanActive=!1:1==r&&_(e)}(t||n)&&0==o.isZoomActive&&0==o.isPanActive&&h()}function f(e){if(0==i.isCurrentSlideType("image"))return!0;1==o.isZoomActive?function(e){var a=n.getArrTouches(e),s=n.getDistance(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY)/o.startDistance,l=n.getMiddlePoint(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY),u=o.objImageSize.width*s,d=o.objImageSize.height*s,_=n.getImageOriginalSize(o.objImage),g=1;if(_.width>0&&(g=u/_.width),g>r.slider_zoom_max_ratio)return!0;panX=-(o.imageOrientPoint.x*s-o.imageOrientPoint.x),panY=-(o.imageOrientPoint.y*s-o.imageOrientPoint.y);var c=l.x-o.startMiddlePoint.x,h=l.y-o.startMiddlePoint.y,p=o.startImageX+panX+c,m=o.startImageY+panY+h;n.setElementSizeAndPosition(o.objImage,p,m,u,d),t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE)}(e):1==o.isPanActive&&function(e){if(null==o.objImage||0==o.objImage.length)return!0;var t=n.getMousePosition(e),r=(t.pageX,o.startMouseX,t.pageY,o.startMouseY,t.pageX-o.lastMouseX),a=t.pageY-o.lastMouseY,s=r<0?"left":"right",l=a<0?"up":"down";o.lastMouseX=t.pageX,o.lastMouseY=t.pageY;var u=n.getElementSize(o.objImage);0==o.panYActive?a=0:"down"==l&&u.top>0?a/=3:"up"==l&&u.bottom<o.objParentSize.height&&(a/=3),0==o.panXActive||0==i.isInnerInPlace()?r=0:"right"==s&&u.left>0?r/=3:"left"==s&&u.right<o.objParentSize.width&&(r/=3);var d=u.left+r,_=u.top+a;n.placeElement(o.objImage,d,_)}(e)}function b(e,t,o,a){return 0==r.slider_zoom_mousewheel||(0==i.isCurrentSlideType("image")||(e.preventDefault(),void u(1==t>0?"in":"out",n.getMousePosition(e))))}this.________EXTERNAL_____________=function(){},this.isPanEnabled=function(e,t){if(l(),null==o.objImage||0==o.objImage.length)return!1;if(0==o.isZoomedOnce)return!1;if(0==d(o.objImage,e))return!1;if(0==i.isInnerInPlace())return!1;if("left"==t){if(o.objImageSize.right<=o.objParentSize.width)return!1}else if(o.objImageSize.left>=0)return!1;return!0},this.init=function(e,t){a(e,t)},this.zoomIn=function(){u("in")},this.zoomOut=function(){u("out")},this.zoomBack=function(){u("back")}}function UGWistiaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=!1;function o(){return"undefined"!=typeof Wistia}function a(e,o,a,s,l){t=null,r=!1;var u=e+"_video",d="<div id='"+u+"' class='wistia_embed' style='width:"+a+";height:"+s+";' data-video-width='"+a+"' data-video-height='"+s+"'> </div>";jQuery("#"+e).html(d),t=Wistia.embed(o,{version:"v1",videoWidth:a,videoHeight:s,container:u,autoPlay:l}),r=!0,t.bind("play",function(){n.trigger(i.events.START_PLAYING)}),t.bind("pause",function(){n.trigger(i.events.STOP_PLAYING)}),t.bind("end",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugWistiaAPI.isAPILoaded||(o()?(g_ugWistiaAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("fast.wistia.com/assets/external/E-v1.js",!0),void(g_ugWistiaAPI.isAPILoaded=!0)))},this.doCommand=function(e){if(null==t)return!1;if(0==r)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.putVideo=function(t,i,n,r,s){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!r||!t)}}function UGSoundCloudAPI(){this.isAPILoaded=!1;var e,t,i,n=this,r=jQuery(this);function o(){return"undefined"!=typeof SC}function a(e,o,a,s,l){t=null,g_isPlayerReady=!1;var u=e+"_iframe",d=location.protocol+"//w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/"+o;d+="&buying=false&liking=false&download=false&sharing=false&show_artwork=true&show_comments=false&show_playcount=true&show_user=false&hide_related=true&visual=true&start_track=0&callback=true";var _="<iframe id='"+u+"' src="+(d+=!0===l?"&auto_play=true":"&auto_play=false")+" width='"+a+"' height='"+s+"' frameborder='0' scrolling='no' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(_),(t=SC.Widget(u)).bind(SC.Widget.Events.READY,function(){t&&(g_isPlayerReady=!0,t.bind(SC.Widget.Events.PLAY,function(){r.trigger(n.events.START_PLAYING)}),t.bind(SC.Widget.Events.PAUSE,function(){r.trigger(n.events.STOP_PLAYING)}),t.bind(SC.Widget.Events.FINISH,function(){r.trigger(n.events.STOP_PLAYING),r.trigger(n.events.VIDEO_ENDED)}))}),i=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugSoundCloudAPI.isAPILoaded||(o()?(g_ugSoundCloudAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("w.soundcloud.com/player/api.js",!0),void(g_ugSoundCloudAPI.isAPILoaded=!0)))},this.putSound=function(t,i,n,r,s){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){n.doCommand("pause")},this.play=function(){n.doCommand("play")},this.destroy=function(){g_isPlayerReady=!1,t=null,i&&(jQuery("#"+i).html(""),i=null)}}function UGHtml5MediaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this);function r(){return"undefined"!=typeof mejs}function o(e,r,o,a,s){t=null,g_isPlayerReady=!1;var l=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/flashmediaelement-cdn.swf",u=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/silverlightmediaelement.xap",d=e+"_video",_="";s&&!0===s&&(_="autoplay='autoplay'");var g="";r.posterImage&&(g="poster='"+r.posterImage+"'");var c="<video id='"+d+"' width='"+o+"' height='"+a+"' controls='controls' preload='none' "+_+" "+g+">";""!=r.mp4&&(c+="<source type='video/mp4' src='"+r.mp4+"' />"),""!=r.webm&&(c+="<source type='video/webm' src='"+r.webm+"' />"),""!=r.ogv&&(c+="<source type='video/ogg' src='"+r.ogv+"' />"),c+="<object width='"+o+"' height='"+a+"' type='application/x-shockwave-flash' data='"+l+"'>",c+="<param name='movie' value='"+l+"' />",c+="<param name='flashvars' value='controls=true&file="+r.mp4+"' />",c+="</object>",c+="</video>",jQuery("#"+e).html(c),new MediaElement(d,{enablePluginDebug:!1,flashName:l,silverlightName:u,success:function(e,r){g_isPlayerReady=!0,t=e,0==s&&t.pause(),g_ugFunctions.addEvent(t,"play",function(){n.trigger(i.events.START_PLAYING)}),g_ugFunctions.addEvent(t,"pause",function(){n.trigger(i.events.STOP_PLAYING)}),g_ugFunctions.addEvent(t,"ended",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})},error:function(e){trace(e)}})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugHtml5MediaAPI.isAPILoaded||(r()?(g_ugHtml5MediaAPI.isAPILoaded=!0,!0):(!0!==e&&(g_ugFunctions.loadJs("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelement.min.js",!0),g_ugFunctions.loadCss("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelementplayer.min.css",!0)),void(g_ugHtml5MediaAPI.isAPILoaded=!0)))},this.putVideo=function(t,i,n,a,s){if(r())return o(t,i,n,a,s),!0;this.loadAPI(),e=setInterval(function(){r()&&(o(t,i,n,a,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")}}function UGVimeoAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=null,o=!1,a=!1;function s(){return"undefined"!=typeof Froogaloop}function l(e,s,l,u,d){r=null,o=!1;var _=location.protocol+"//player.vimeo.com/video/"+s+"?api=1";!0===d&&(_+="&byline=0&autoplay=1&title=0&portrait=0");var g="<iframe src="+_+" width='"+l+"' height='"+u+"' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(g);var c=jQuery("#"+e+" iframe")[0];(r=Froogaloop(c)).addEvent("ready",function(){r&&(o=!0,function(){if(!r)return!1;r.addEvent("cuechange",function(){1==a&&i.play()}),r.addEvent("play",function(){n.trigger(i.events.START_PLAYING)}),r.addEvent("pause",function(){n.trigger(i.events.STOP_PLAYING)}),r.addEvent("finish",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}())}),t=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugVimeoAPI.isAPILoaded||(s()?(g_ugVimeoAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("f.vimeocdn.com/js/froogaloop2.min.js",!0),void(g_ugVimeoAPI.isAPILoaded=!0)))},this.doCommand=function(e){return null!=r&&(0!=o&&void r.api(e))},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.destroy=function(){r&&(r.api("unload"),r=null,o=!1),t&&jQuery("#"+t).html("")},this.putVideo=function(t,i,n,r,o){if(s())return l(t,i,n,r,o),!0;this.loadAPI(),e=setInterval(function(){s()&&(l(t,i,n,r,o),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!o||!r)},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;a=t,r.api("loadVideo",e)},this.getVideoImages=function(e,t,i){var n=location.protocol+"//vimeo.com/api/v2/video/"+e+".json";jQuery.get(n,{},function(e){var n={};n.preview=e[0].thumbnail_large,n.thumb=e[0].thumbnail_medium,i(t,n)})}}function UGYoutubeAPI(){this.isAPILoaded=!1;var e,t,i=this,n=null,r=!1,o=jQuery(this),a=-1,s={video_youtube_showinfo:!0};function l(e,i,o,a,l){n&&r&&n.destroy();var u={controls:2,showinfo:s.video_youtube_showinfo,rel:0};!0===l&&(u.autoplay=1),r=!1,n=new YT.Player(e,{height:a,width:o,videoId:i,playerVars:u,events:{onReady:d,onStateChange:_}}),t=e}function u(){return"undefined"!=typeof YT&&void 0!==YT.Player}function d(){r=!0}function _(){if("function"!=typeof n.getPlayerState)return trace("Youtube API error: can't get player state"),!1;var e=n.getPlayerState();switch(e){case YT.PlayerState.PLAYING:o.trigger(i.events.START_PLAYING);break;case YT.PlayerState.ENDED:o.trigger(i.events.STOP_PLAYING),o.trigger(i.events.VIDEO_ENDED);break;default:a==YT.PlayerState.PLAYING&&o.trigger(i.events.STOP_PLAYING)}a=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.setOptions=function(e){s=jQuery.extend(s,e)},this.putVideo=function(t,i,n,r,o){if(u())return l(t,i,n,r,o),!0;this.loadAPI(),e=setInterval(function(){u()&&(l(t,i,n,r,o),clearInterval(e))},500)},this.loadAPI=function(e){return 1==g_ugYoutubeAPI.isAPILoaded||("undefined"!=typeof YT?(g_ugYoutubeAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("https://www.youtube.com/player_api",!1),void(g_ugYoutubeAPI.isAPILoaded=!0)))},this.doCommand=function(e,t){if(!n)return!0;if(0==r)return!1;switch(e){case"play":if("function"!=typeof n.playVideo)return!1;n.playVideo();break;case"pause":if("function"!=typeof n.pauseVideo)return!1;n.pauseVideo();break;case"seek":if("function"!=typeof n.seekTo)return!1;n.seekTo(t);break;case"stopToBeginning":var i=n.getPlayerState();switch(n.pauseVideo(),i){case YT.PlayerState.PLAYING:case YT.PlayerState.ENDED:case YT.PlayerState.PAUSED:n.seekTo(0)}}},this.play=function(){i.doCommand("play")},this.pause=function(){i.doCommand("pause")},this.destroy=function(){try{n&&(r=!1,n.clearVideo(),n.destroy())}catch(e){jQuery("#"+t).html("")}},this.stopToBeginning=function(){i.doCommand("stopToBeginning")},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;t&&1==t?n.loadVideoById(e,0,"large"):n.cueVideoById(e,0,"large")},this.isPlayerReady=function(){return!(!r||!n)},this.getVideoImages=function(e){var t={};return t.preview="https://i.ytimg.com/vi/"+e+"/sddefault.jpg",t.thumb="https://i.ytimg.com/vi/"+e+"/default.jpg",t}}function UGVideoPlayer(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UGFunctions,_=new UGYoutubeAPI,g=new UGVimeoAPI,c=new UGHtml5MediaAPI,h=new UGSoundCloudAPI,p=new UGWistiaAPI,m=null,f={video_enable_closebutton:!0};this.events={SHOW:"video_show",HIDE:"video_hide",PLAY_START:"video_play_start",PLAY_STOP:"video_play_stop",VIDEO_ENDED:"video_ended"};var b={standAloneMode:!1,youtubeInnerID:"",vimeoPlayerID:"",html5PlayerID:"",wistiaPlayerID:"",soundCloudPlayerID:""};function v(){l.hide()}function y(){u.trigger(l.events.PLAY_START),o&&o.hide()}function I(){u.trigger(l.events.PLAY_STOP),o&&o.show()}function w(){u.trigger(l.events.VIDEO_ENDED)}function E(e){var t=["youtube","vimeo","html5","soundcloud","wistia"];for(var o in t){var l=t[o];if(l!=e)switch(l){case"youtube":_.pause(),_.destroy(),i.hide();break;case"vimeo":g.pause(),g.destroy(),n.hide();break;case"html5":c.pause(),r.hide();break;case"soundcloud":h.pause(),h.destroy(),a.hide();break;case"wistia":p.pause(),s.hide()}}}this.init=function(t,i,n){if(!(e=n))throw new Error("missing gallery ID for video player, it's a must!");f=jQuery.extend(f,t),_.setOptions(f),i&&1==i&&(b.standAloneMode=!0)},this.setHtml=function(l){b.youtubeInnerID=e+"_youtube_inner",b.vimeoPlayerID=e+"_videoplayer_vimeo",b.html5PlayerID=e+"_videoplayer_html5",b.wistiaPlayerID=e+"_videoplayer_wistia",b.soundCloudPlayerID=e+"_videoplayer_soundcloud";var u="<div class='ug-videoplayer' style='display:none'>";u+="<div class='ug-videoplayer-wrapper ug-videoplayer-youtube' style='display:none'><div id='"+b.youtubeInnerID+"'></div></div>",u+="<div id='"+b.vimeoPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-vimeo' style='display:none'></div>",u+="<div id='"+b.html5PlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-html5'></div>",u+="<div id='"+b.soundCloudPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-soundcloud'></div>",u+="<div id='"+b.wistiaPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-wistia'></div>",0==b.standAloneMode&&1==f.video_enable_closebutton&&(u+="<div class='ug-videoplayer-button-close'></div>"),u+="</div>",l.append(u),t=l.children(".ug-videoplayer"),i=t.children(".ug-videoplayer-youtube"),n=t.children(".ug-videoplayer-vimeo"),r=t.children(".ug-videoplayer-html5"),a=t.children(".ug-videoplayer-soundcloud"),s=t.children(".ug-videoplayer-wistia"),0==b.standAloneMode&&1==f.video_enable_closebutton&&(o=t.children(".ug-videoplayer-button-close"))},this.destroy=function(){o&&(o.off("click"),o.off("touchend")),jQuery(_).off(_.events.START_PLAYING),jQuery(_).off(_.events.STOP_PLAYING),jQuery(g).off(g.events.START_PLAYING),jQuery(g).off(g.events.STOP_PLAYING),jQuery(c).off(c.events.START_PLAYING),jQuery(c).off(c.events.STOP_PLAYING),jQuery(h).off(h.events.START_PLAYING,y),jQuery(h).off(h.events.STOP_PLAYING,I),jQuery(p).off(p.events.START_PLAYING,y),jQuery(p).off(p.events.STOP_PLAYING,I),m=null},this.initEvents=function(){o&&(d.setButtonMobileReady(o),d.setButtonOnClick(o,v)),jQuery(_).on(_.events.START_PLAYING,y),jQuery(_).on(_.events.STOP_PLAYING,I),jQuery(_).on(_.events.VIDEO_ENDED,w),jQuery(g).on(g.events.START_PLAYING,y),jQuery(g).on(g.events.STOP_PLAYING,I),jQuery(g).on(g.events.VIDEO_ENDED,w),jQuery(c).on(c.events.START_PLAYING,y),jQuery(c).on(c.events.STOP_PLAYING,I),jQuery(c).on(c.events.VIDEO_ENDED,w),jQuery(h).on(h.events.START_PLAYING,y),jQuery(h).on(h.events.STOP_PLAYING,I),jQuery(h).on(h.events.VIDEO_ENDED,w),jQuery(p).on(p.events.START_PLAYING,y),jQuery(p).on(p.events.STOP_PLAYING,I),jQuery(p).on(p.events.VIDEO_ENDED,w)},this.setSize=function(e,i){d.setElementSize(t,e,i),o&&d.placeElement(o,"right","top")},this.setPosition=function(e,i){d.placeElement(t,e,i)},this.getObject=function(){return t},this.show=function(){if(1==l.isVisible())return!0;t.show(),t.fadeTo(0,1),o&&o.show(),u.trigger(l.events.SHOW)},this.hide=function(){if(0==l.isVisible())return!0;E(),m=null,t.hide(),u.trigger(l.events.HIDE)},this.getActiveAPI=function(){switch(m){case"youtube":return _;case"vimeo":return g;case"wistia":return p;case"soundcloud":return h;case"html5":return c;default:return null}},this.pause=function(){var e=l.getActiveAPI();if(null==e)return!1;"function"==typeof e.pause&&e.pause()},this.isVisible=function(){return t.is(":visible")},this.playYoutube=function(e,t){if(void 0===t)t=!0;E("youtube"),i.show(),0==i.children("#"+b.youtubeInnerID).length&&i.append("<div id='"+b.youtubeInnerID+"'></div>"),1==_.isPlayerReady()&&1==b.standAloneMode?_.changeVideo(e,t):_.putVideo(b.youtubeInnerID,e,"100%","100%",t),m="youtube"},this.playVimeo=function(e,t){if(void 0===t)t=!0;E("vimeo"),n.show(),g.putVideo(b.vimeoPlayerID,e,"100%","100%",t),m="vimeo"},this.playHtml5Video=function(e,t,i,n,o){if(void 0===o)o=!0;E("html5"),r.show();var a={ogv:e,webm:t,mp4:i,posterImage:n};c.putVideo(b.html5PlayerID,a,"100%","100%",o),m="html5"},this.playSoundCloud=function(e,t){if(void 0===t)t=!0;E("soundcloud"),a.show(),h.putSound(b.soundCloudPlayerID,e,"100%","100%",t),m="soundcloud"},this.playWistia=function(e,t){if(void 0===t)t=!0;E("wistia"),s.show(),p.putVideo(b.wistiaPlayerID,e,"100%","100%",t),m="wistia"}}var g_ugYoutubeAPI=new UGYoutubeAPI,g_ugVimeoAPI=new UGVimeoAPI,g_ugHtml5MediaAPI=new UGHtml5MediaAPI,g_ugSoundCloudAPI=new UGSoundCloudAPI,g_ugWistiaAPI=new UGWistiaAPI;function ugCheckForMinJQueryVersion(){if(0==g_ugFunctions.checkMinJqueryVersion("1.8.0"))throw new Error("The gallery can run from jquery 1.8 You have jQuery "+jQuery.fn.jquery+" Please update your jQuery library.")}function ugCheckForErrors(e,t){try{"jquery"==t?(!function(){if("undefined"==typeof jQuery)throw new Error("jQuery library not included")}(),ugCheckForMinJQueryVersion()):(ugCheckForMinJQueryVersion(),function(){if("function"==typeof jQuery.fn.unitegallery)return!0;var e="You have some jquery.js library include that comes after the gallery files js include.";throw e+="<br> This include eliminates the gallery libraries, and make it not work.","cms"==t?(e+="<br><br> To fix it you can:<br> 1. In the Gallery Settings -> Troubleshooting set option: <strong><b>Put JS Includes To Body</b></strong> option to true.",e+="<br> 2. Find the double jquery.js include and remove it."):e+="<br><br> Please find and remove this jquery.js include and the gallery will work. <br> * There should be only one jquery.js include before all other js includes in the page.",new Error(e)}())}catch(r){var i=r.message;if(i="<div style='font-size:16px;color:#BC0C06;max-width:900px;border:1px solid red;padding:10px;'>"+(i="Unite Gallery Error: "+i)+"</div>","jquery"==t){var n=document.getElementById(e);n.innerHTML=i,n.style.display="block"}else jQuery(e).show().html(i);return!1}return!0}function UniteGalleryMain(){var t=this,g_galleryID,g_objGallery=jQuery(t),g_objWrapper,g_objParent,g_objThumbs,g_objSlider,g_objLightbox,g_functions=new UGFunctions,g_objTabs,g_objLoadMore,g_arrItems=[],g_numItems,g_selectedItem=null,g_selectedItemIndex=-1,g_objTheme,g_objCache={};this.events={ITEM_CHANGE:"item_change",SIZE_CHANGE:"size_change",ENTER_FULLSCREEN:"enter_fullscreen",EXIT_FULLSCREEN:"exit_fullscreen",START_PLAY:"start_play",STOP_PLAY:"stop_play",PAUSE_PLAYING:"pause_playing",CONTINUE_PLAYING:"continue_playing",SLIDER_ACTION_START:"slider_action_start",SLIDER_ACTION_END:"slider_action_end",ITEM_IMAGE_UPDATED:"item_image_updated",GALLERY_KEYPRESS:"gallery_keypress",GALLERY_BEFORE_REQUEST_ITEMS:"gallery_before_request_items",OPEN_LIGHTBOX:"open_lightbox",CLOSE_LIGHTBOX:"close_lightbox"};var g_options={gallery_width:900,gallery_height:500,gallery_min_width:150,gallery_min_height:100,gallery_theme:"default",gallery_skin:"default",gallery_images_preload_type:"minimal",gallery_autoplay:!1,gallery_play_interval:3e3,gallery_pause_on_mouseover:!0,gallery_mousewheel_role:"zoom",gallery_control_keyboard:!0,gallery_carousel:!0,gallery_preserve_ratio:!0,gallery_background_color:"",gallery_debug_errors:!1,gallery_shuffle:!1,gallery_urlajax:null,gallery_enable_tabs:!1,gallery_enable_loadmore:!1,gallery_enable_cache:!0,gallery_initial_catid:"",load_api_externally:!1},g_temp={objCustomOptions:{},isAllItemsPreloaded:!1,isFreestyleMode:!1,lastWidth:0,lastHeigh:0,handleResize:null,isInited:!1,isPlayMode:!1,isPlayModePaused:!1,playTimePassed:0,playTimeLastStep:0,playHandle:"",playStepInterval:33,objProgress:null,isFakeFullscreen:!1,thumbsType:null,isYoutubePresent:!1,isVimeoPresent:!1,isHtml5VideoPresent:!1,isSoundCloudPresent:!1,isWistiaPresent:!1,resizeDelay:100,isRunFirstTime:!0,originalOptions:{},funcCustomHeight:null};function __________INIT_GALLERY_______(){}function getThemeFunction(e){var t=e;return-1==t.indexOf("UGTheme_")&&(t="UGTheme_"+t),t}function initTheme(objCustomOptions){if(objCustomOptions.hasOwnProperty("gallery_theme"))g_options.gallery_theme=objCustomOptions.gallery_theme;else{var defaultTheme=g_options.gallery_theme;0==g_ugFunctions.isThemeRegistered(defaultTheme)&&(g_options.gallery_theme=g_ugFunctions.getFirstRegisteredTheme())}var themeFunction=getThemeFunction(g_options.gallery_theme);try{g_options.gallery_theme=eval(themeFunction)}catch(e){}g_options.gallery_theme=eval(themeFunction),g_objTheme=new g_options.gallery_theme,g_objTheme.init(t,objCustomOptions)}function resetOptions(){g_options=jQuery.extend({},g_temp.originalOptions),g_selectedItemIndex=-1,g_selectedItem=null,g_objSlider=void 0,g_objThumbs=void 0,g_objLightbox=void 0}function checkForStartupErrors(){try{ugCheckForMinJQueryVersion()}catch(e){throwErrorShowMessage(e.message)}"object"==typeof g_objWrapper.outerWidth()&&throwErrorShowMessage("You have some buggy script. most chances jquery-ui.js that destroy jquery outerWidth, outerHeight functions. The gallery can't run. Please update jquery-ui.js to latest version."),setTimeout(function(){ugCheckForErrors(g_galleryID,"cms")},5e3)}function runGallery(e,i,n,r){var o="object"==typeof i;if(o&&(g_temp.objCustomOptions=i),1==g_temp.isRunFirstTime){if(g_galleryID=e,0==(g_objWrapper=jQuery(g_galleryID)).length)return trace("div with id: "+g_galleryID+" not found"),!1;g_objParent=g_objWrapper.parent(),checkForStartupErrors(),g_temp.originalOptions=jQuery.extend({},g_options),o&&(g_options=jQuery.extend(g_options,i)),1==g_options.gallery_enable_cache&&g_options.gallery_initial_catid&&cacheItems(g_options.gallery_initial_catid),t.setSizeClass(),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.find("img").fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}else if(t.destroy(),resetOptions(),g_options=jQuery.extend(g_options,g_temp.objCustomOptions),n){if(r&&1==g_options.gallery_enable_cache&&cacheItems(r,n),"noitems"==n)return showErrorMessage("No items in this category",""),!1;g_objWrapper.html(n),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.children().fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_tabs&&(g_objTabs=new UGTabs).init(t,g_options),1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_loadmore&&(g_objLoadMore=new UGLoadMore).init(t,g_options),o&&modifyInitParams(g_temp.objCustomOptions),validateParams(),1==g_options.gallery_shuffle&&t.shuffleItems(),initTheme(g_temp.objCustomOptions),setGalleryHtml(),setHtmlObjectsProperties(),0==g_objWrapper.width()?g_functions.waitForWidth(g_objWrapper,runGalleryActually):runGalleryActually()}function runGalleryActually(){t.setSizeClass(),0==g_temp.isFreestyleMode&&1==g_options.gallery_preserve_ratio&&setHeightByOriginalRatio(),g_objTheme.run(),g_objTabs&&g_temp.isRunFirstTime&&g_objTabs.run(),preloadBigImages(),initEvents(),g_numItems>0&&t.selectItem(0),1==g_options.gallery_autoplay&&t.startPlayMode(),g_temp.isRunFirstTime=!1}function showErrorMessage(e,t){if(void 0===t)t="<b>Unite Gallery Error: </b>";else t="<b>"+t+": </b>";var i="<div class='ug-error-message-wrapper'><div class='ug-error-message'>"+(e=t+e)+"</div></div>";g_objWrapper.children().remove(),g_objWrapper.html(i),g_objWrapper.show()}function throwErrorShowMessage(e){throw showErrorMessage(e),new Error(e)}function modifyInitParams(){g_options.gallery_images_preload_type||(g_options.gallery_images_preload_type="minimal"),(null==g_options.gallery_min_height||g_options.gallery_height<g_options.gallery_min_height)&&(g_options.gallery_min_height=0),(null==g_options.gallery_min_width||g_options.gallery_width<g_options.gallery_min_width)&&(g_options.gallery_min_width=0)}function validateParams(){if(!g_options.gallery_theme)throw new Error("The gallery can't run without theme");if(jQuery.isNumeric(g_options.gallery_height)&&g_options.gallery_height<g_options.gallery_min_height)throw new Error("The <b>gallery_height</b> option must be bigger then <b>gallery_min_height option</b>");if(g_options.gallery_width<g_options.gallery_min_width)throw new Error("The <b>gallery_width</b> option must be bigger then <b>gallery_min_width option</b>")}function setGalleryHtml(){g_objWrapper.addClass("ug-gallery-wrapper"),g_objWrapper.append("<div class='ug-overlay-disabled' style='display:none'></div>"),t.setSizeClass()}function clearInitData(){g_objWrapper.children().remove()}function storeLastSize(){var e=t.getSize();g_temp.lastWidth=e.width,g_temp.lastHeight=e.height}function setHeightByOriginalRatio(){var e=t.getSize();if(e.width/e.height!=e.orig_ratio){var i=e.width/e.orig_ratio;(i=Math.round(i))<g_options.gallery_min_height&&(i=g_options.gallery_min_height),g_objWrapper.height(i)}}function setHtmlObjectsProperties(){var e={"max-width":g_functions.getCssSizeParam(g_options.gallery_width),"min-width":g_functions.getCssSizeParam(g_options.gallery_min_width)};if(0==g_temp.isFreestyleMode){var t=g_functions.getCssSizeParam(g_options.gallery_height);e.height=t}else e.overflow="visible";g_options.gallery_background_color&&(e["background-color"]=g_options.gallery_background_color),g_objWrapper.css(e)}function fillItemByChild(e){var i=t.isMobileMode(),n="";if("a"==(r=e.prop("tagName").toLowerCase())){n=e.attr("href");var r=(e=e.children()).prop("tagName").toLowerCase()}var o=e.data("type");null==o&&(o="image");var a={};if(a.type=o,"img"==r){var s=e.data("lazyload-src");s&&""!=s&&(e.attr("src",s),jQuery.removeData(e,"lazyload-src"));var l=e.data("image"),u=e.data("thumb");void 0===l&&(l=null),void 0===u&&(u=null);var d=e.attr("src");l||(l=d),u||(u=d),u||(u=l),l||(l=u),a.urlThumb=u,a.urlImage=l,a.title=e.attr("alt"),a.objThumbImage=e,a.objThumbImage.attr("src",a.urlThumb)}else{if("image"==o)throw trace("Problematic gallery item found:"),trace(e),trace("Please look for some third party js script that could add this item to the gallery"),new Error("The item should not be image type");a.urlThumb=e.data("thumb"),a.title=e.data("title"),a.objThumbImage=null,a.urlImage=e.data("image")}if(1==i){var _=e.data("thumb-mobile");void 0!==_&&""!=_&&(a.urlThumb=_,"img"==r&&e.attr("src",a.urlThumb));var g=e.data("image-mobile");void 0!==g&&""!=g&&(a.urlImage=g)}a.link=n,a.description=e.attr("title"),a.description||(a.description=e.data("description")),a.description||(a.description=""),a.isNewAdded=!1,a.isLoaded=!1,a.isThumbImageLoaded=!1,a.objPreloadImage=null,a.isBigImageLoadStarted=!1,a.isBigImageLoaded=!1,a.isBigImageLoadError=!1,a.imageWidth=0,a.imageHeight=0,a.thumbWidth=0,a.thumbHeight=0,a.thumbRatioByWidth=0,a.thumbRatioByHeight=0;var c=e.data("width"),h=e.data("height");c&&"number"==typeof c&&h&&"number"==typeof h&&(a.thumbWidth=c,a.thumbHeight=h,a.thumbRatioByWidth=c/h,a.thumbRatioByHeight=h/c),a.addHtml=null;var p=null==a.urlImage||""==a.urlImage,m=null==a.urlThumb||""==a.urlThumb;switch(a.type){case"youtube":if(a.videoid=e.data("videoid"),p||m){var f=g_ugYoutubeAPI.getVideoImages(a.videoid);p&&(a.urlImage=f.preview),m&&(a.urlThumb=f.thumb,"img"==r&&e.attr("src",a.urlThumb))}g_temp.isYoutubePresent=!0;break;case"vimeo":a.videoid=e.data("videoid"),g_temp.isVimeoPresent=!0;break;case"html5video":a.videoogv=e.data("videoogv"),a.videowebm=e.data("videowebm"),a.videomp4=e.data("videomp4"),g_temp.isHtml5VideoPresent=!0;break;case"soundcloud":a.trackid=e.data("trackid"),g_temp.isSoundCloudPresent=!0;break;case"wistia":a.videoid=e.data("videoid"),g_temp.isWistiaPresent=!0;break;case"custom":var b=e.children("img");b.length&&(b=jQuery(b[0]),a.urlThumb=b.attr("src"),a.title=b.attr("alt"),a.objThumbImage=b);var v=e.children().not("img:first-child");v.length&&(a.addHtml=v.clone())}return a.objThumbImage&&(a.objThumbImage.removeAttr("data-description",""),a.objThumbImage.removeAttr("data-image",""),a.objThumbImage.removeAttr("data-thumb",""),a.objThumbImage.removeAttr("title","")),a}function fillItemsArray(e,t){if(!0!==t)g_arrItems=[];else for(var i=0;i<g_numItems;i++)g_arrItems[i].isNewAdded=!1;for(i=0;i<e.length;i++){var n=fillItemByChild(jQuery(e[i]));numIndex=g_arrItems.length,n.index=numIndex,!0===t&&(n.isNewAdded=!0),g_arrItems.push(n)}g_numItems=g_arrItems.length}function loadAPIs(){var e=g_options.load_api_externally;g_temp.isYoutubePresent&&g_ugYoutubeAPI.loadAPI(e),g_temp.isVimeoPresent&&g_ugVimeoAPI.loadAPI(e),g_temp.isHtml5VideoPresent&&g_ugHtml5MediaAPI.loadAPI(e),g_temp.isSoundCloudPresent&&g_ugSoundCloudAPI.loadAPI(e),g_temp.isWistiaPresent&&g_ugWistiaAPI.loadAPI(e)}function preloadBigImages(){if("visible"!=g_options.gallery_images_preload_type||g_objThumbs||(g_options.gallery_images_preload_type="minimal"),1==g_temp.isAllItemsPreloaded)return!0;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":jQuery(g_arrItems).each(function(){preloadItemImage(this)});break;case"visible":jQuery(g_arrItems).each(function(){1==g_objThumbs.isItemThumbVisible(this)&&preloadItemImage(this)})}}function checkPreloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!1;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":preloadItemImage(e);break;case"visible":1==g_objThumbs.isItemThumbVisible(e)&&preloadItemImage(e)}}function preloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!0;var i=e.urlImage;if(""==i||null==i)return e.isBigImageLoadError=!0,!1;e.isBigImageLoadStarted=!0,e.objPreloadImage=jQuery("<img/>").attr("src",i),e.objPreloadImage.data("itemIndex",e.index),e.objPreloadImage.on("load",t.onItemBigImageLoaded),e.objPreloadImage.on("error",function(){var e=jQuery(this).data("itemIndex"),i=g_arrItems[e];i.isBigImageLoadError=!0,i.isBigImageLoaded=!1;var n=jQuery(this).attr("src");console.log("Can't load image: "+n),g_objGallery.trigger(t.events.ITEM_IMAGE_UPDATED,[e,i.urlImage]),i.objThumbImage.attr("src",i.urlThumb)}),checkAllItemsStartedPreloading()}function preloadNearBigImages(e){if(1==g_temp.isAllItemsPreloaded)return!1;if(!e)e=g_selectedItem;if(!e)return!0;var t=e.index,i=t-1,n=t+1;i>0&&preloadItemImage(g_arrItems[i]),n<g_numItems&&preloadItemImage(g_arrItems[n])}function checkAllItemsStartedPreloading(){if(1==g_temp.isAllItemsPreloaded)return!1;for(var e in g_arrItems)if(0==g_arrItems[e].isBigImageLoadStarted)return!1;g_temp.isAllItemsPreloaded=!0}function __________END_INIT_GALLERY_______(){}function __________EVENTS_____________(){}function onSliderMouseEnter(e){1==g_options.gallery_pause_on_mouseover&&0==t.isFullScreen()&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&t.pausePlaying()}function onSliderMouseLeave(e){1==g_options.gallery_pause_on_mouseover&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&(0==g_objSlider.isCurrentSlideLoadingImage()&&t.continuePlaying())}function onKeyPress_isStopEventScanAllPageGalleries(){trace(window.ugArrGalleriesObjects),jQuery.each(window.ugArrGalleriesObjects,function(){})}function onKeyPress(e){var i=jQuery(e.target);if(i.is("textarea")||i.is("select")||i.is("input"))return!0;var n=e.charCode?e.charCode:e.keyCode?e.keyCode:e.which?e.which:0,r=!1;switch(n){case 39:1==t.isGalleryInsideScreen()&&(t.nextItem(),r=!0);break;case 37:1==t.isGalleryInsideScreen()&&(t.prevItem(),r=!0);break;default:r=!1}1==r&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()),g_objGallery.trigger(t.events.GALLERY_KEYPRESS,[n,e])}function onGalleryResized(){var e;if(0==(e=t.getSize()).width)return!0;if(t.setSizeClass(),(e=t.getSize()).width!=g_temp.lastWidth||0==g_temp.isFreestyleMode&&e.height!=g_temp.lastHeight){var i=!1;if(g_temp.funcCustomHeight){var n=g_temp.funcCustomHeight(e);n&&(g_objWrapper.height(n),i=!0)}0==i&&1==g_options.gallery_preserve_ratio&&0==g_temp.isFreestyleMode&&setHeightByOriginalRatio(),storeLastSize(),g_objGallery.trigger(t.events.SIZE_CHANGE)}}function onThumbsChange(e){"visible"==g_options.gallery_images_preload_type&&0==g_temp.isAllItemsPreloaded&&preloadBigImages()}function onFullScreenChange(){var e=g_functions.isFullScreen(),i=e?t.events.ENTER_FULLSCREEN:t.events.EXIT_FULLSCREEN,n=g_functions.getGlobalData("fullscreenID");if(g_galleryID!==n)return!0;e?g_objWrapper.addClass("ug-fullscreen"):g_objWrapper.removeClass("ug-fullscreen"),g_objGallery.trigger(i),onGalleryResized()}function onItemImageUpdated(e,i){checkPreloadItemImage(t.getItem(i))}function onCurrentSlideImageLoadEnd(){1==t.isPlayMode()&&t.continuePlaying()}function initEvents(){if(g_objWrapper.on("dragstart",function(e){e.preventDefault()}),g_objGallery.on(t.events.ITEM_IMAGE_UPDATED,onItemImageUpdated),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).on(g_objThumbs.events.STRIP_MOVE,onThumbsChange);break;case"grid":jQuery(g_objThumbs).on(g_objThumbs.events.PANE_CHANGE,onThumbsChange)}if("advance"==g_options.gallery_mousewheel_role&&0==g_temp.isFreestyleMode&&g_objWrapper.on("mousewheel",t.onGalleryMouseWheel),storeLastSize(),jQuery(window).resize(function(){g_objWrapper.css("width","auto"),g_functions.whenContiniousEventOver("gallery_resize",onGalleryResized,g_temp.resizeDelay)}),setTimeout(function(){setInterval(onGalleryResized,2e3)},1e4),g_functions.addFullScreenChangeEvent(onFullScreenChange),g_objSlider){if(jQuery(g_objSlider).on(g_objSlider.events.ITEM_CHANGED,function(){var e=g_objSlider.getCurrentItemIndex();-1!=e&&t.selectItem(e)}),1==g_options.gallery_pause_on_mouseover)g_objSlider.getElement().hover(onSliderMouseEnter,onSliderMouseLeave),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){onSliderMouseLeave()});retriggerEvent(g_objSlider,g_objSlider.events.ACTION_START,t.events.SLIDER_ACTION_START),retriggerEvent(g_objSlider,g_objSlider.events.ACTION_END,t.events.SLIDER_ACTION_END),jQuery(g_objSlider).on(g_objSlider.events.CURRENTSLIDE_LOAD_END,onCurrentSlideImageLoadEnd)}1==g_options.gallery_control_keyboard&&jQuery(document).keydown(onKeyPress)}function __________GENERAL_______(){}function cacheItems(e,t){if(t)"noitems"!=(i=t)&&(i=jQuery(t).clone());else var i=g_objWrapper.children().clone();g_objCache[e]=i}function removeAllSizeClasses(e){e||(e=g_objWrapper),e.removeClass("ug-under-480"),e.removeClass("ug-under-780"),e.removeClass("ug-under-960")}function retriggerEvent(e,t,i){jQuery(e).on(t,function(e){g_objGallery.trigger(i,[this])})}function advanceNextStep(){var e=jQuery.now(),i=e-g_temp.playTimeLastStep;if(g_temp.playTimeLastStep=e,0==t.isGalleryVisible())return!1;if(g_temp.playTimePassed+=i,g_temp.objProgress){var n=g_temp.playTimePassed/g_options.gallery_play_interval;g_temp.objProgress.setProgress(n)}g_temp.playTimePassed>=g_options.gallery_play_interval&&(t.nextItem(),g_temp.playTimePassed=0)}function unselectSeletedItem(){if(null==g_selectedItem)return!0;g_objThumbs&&g_objThumbs.setThumbUnselected(g_selectedItem.objThumbWrapper),g_selectedItem=null,g_selectedItemIndex=-1}function toFakeFullScreen(){jQuery("body").addClass("ug-body-fullscreen"),g_objWrapper.addClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!0,g_objGallery.trigger(t.events.ENTER_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}function exitFakeFullscreen(){jQuery("body").removeClass("ug-body-fullscreen"),g_objWrapper.removeClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!1,g_objGallery.trigger(t.events.EXIT_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}this.onItemBigImageLoaded=function(e,t){if(!t)t=jQuery(this);var i=t.data("itemIndex"),n=g_arrItems[i];n.isBigImageLoaded=!0;var r=g_functions.getImageOriginalSize(t);n.imageWidth=r.width,n.imageHeight=r.height},this.checkFillImageSize=function(e,t){if(!t){var i=e.data("itemIndex");if(void 0===i)throw new Error("Wrong image given to gallery.checkFillImageSize");t=g_arrItems[i]}var n=g_functions.getImageOriginalSize(e);t.imageWidth=n.width,t.imageHeight=n.height},this.setFreestyleMode=function(){g_temp.isFreestyleMode=!0},this.attachThumbsPanel=function(e,t){g_temp.thumbsType=e,g_objThumbs=t},this.initSlider=function(e,i){if(!e)e={};e=jQuery.extend(g_temp.objCustomOptions,e),(g_objSlider=new UGSlider).init(t,e,i)},this.onGalleryMouseWheel=function(e,i,n,r){e.preventDefault(),i>0?t.prevItem():t.nextItem()},this.destroy=function(){if(g_objWrapper.off("dragstart"),g_objGallery.off(t.events.ITEM_IMAGE_UPDATED),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).off(g_objThumbs.events.STRIP_MOVE);break;case"grid":jQuery(g_objThumbs).off(g_objThumbs.events.PANE_CHANGE)}if(g_objWrapper.off("mousewheel"),jQuery(window).off("resize"),g_functions.destroyFullScreenChangeEvent(),g_objSlider){jQuery(g_objSlider).off(g_objSlider.events.ITEM_CHANGED);var e=g_objSlider.getElement();e.off("mouseenter"),e.off("mouseleave"),g_objGallery.off(t.events.ENTER_FULLSCREEN),jQuery(g_objSlider).off(g_objSlider.events.ACTION_START),jQuery(g_objSlider).off(g_objSlider.events.ACTION_END),jQuery(g_objSlider).off(g_objSlider.events.CURRENTSLIDE_LOAD_END)}1==g_options.gallery_control_keyboard&&jQuery(document).off("keydown"),g_objTheme&&"function"==typeof g_objTheme.destroy&&g_objTheme.destroy(),g_objWrapper.html("")},this.getArrItems=function(){return g_arrItems},this.getObjects=function(){return{g_galleryID:g_galleryID,g_objWrapper:g_objWrapper,g_objThumbs:g_objThumbs,g_objSlider:g_objSlider,g_options:g_options,g_arrItems:g_arrItems,g_numItems:g_numItems}},this.getObjSlider=function(){return g_objSlider},this.getItem=function(e){if(e<0)throw new Error("item with index: "+e+" not found");if(e>=g_numItems)throw new Error("item with index: "+e+" not found");return g_arrItems[e]},this.getWidth=function(){return t.getSize().width},this.getHeight=function(){return t.getSize().height},this.getSize=function(){var e=g_functions.getElementSize(g_objWrapper);return e.orig_width=g_options.gallery_width,e.orig_height=g_options.gallery_height,e.orig_ratio=e.orig_width/e.orig_height,e},this.getGalleryID=function(){return g_galleryID.replace("#","")},this.getNextItem=function(e,t){"object"==typeof e&&(e=e.index);var i=e+1;if(!0!==t&&1==g_numItems)return null;if(i>=g_numItems){if(1!=g_options.gallery_carousel&&!0!==t)return null;i=0}return g_arrItems[i]},this.getPrevItem=function(e){"object"==typeof e&&(e=e.index);var t=e-1;if(t<0){if(1!=g_options.gallery_carousel&&!0!==forceCarousel)return null;t=g_numItems-1}return g_arrItems[t]},this.getSelectedItem=function(){return g_selectedItem},this.getSelectedItemIndex=function(){return g_selectedItemIndex},this.getNumItems=function(){return g_numItems},this.isLastItem=function(){return g_selectedItemIndex==g_numItems-1},this.isFirstItem=function(){return 0==g_selectedItemIndex},this.getOptions=function(){return g_options},this.getElement=function(){return g_objWrapper},this.___________SET_CONTROLS___________=function(){},this.setNextButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.nextItem)},this.setPrevButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.prevItem)},this.setFullScreenToggleButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnTap(e,t.toggleFullscreen),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){e.addClass("ug-fullscreenmode")}),g_objGallery.on(t.events.EXIT_FULLSCREEN,function(){e.removeClass("ug-fullscreenmode")})},this.destroyFullscreenButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.ENTER_FULLSCREEN),g_objGallery.off(t.events.EXIT_FULLSCREEN)},this.setPlayButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.togglePlayMode),g_objGallery.on(t.events.START_PLAY,function(){e.addClass("ug-stop-mode")}),g_objGallery.on(t.events.STOP_PLAY,function(){e.removeClass("ug-stop-mode")})},this.destroyPlayButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.START_PLAY),g_objGallery.off(t.events.STOP_PLAY)},this.setProgressIndicator=function(e){g_temp.objProgress=e},this.setTextContainers=function(e,i){g_objGallery.on(t.events.ITEM_CHANGE,function(){var n=t.getSelectedItem();e.html(n.title),i.html(n.description)})},this.showDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").show()},this.hideDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").hide()},this.___________END_SET_CONTROLS___________=function(){},this.___________PLAY_MODE___________=function(){},this.startPlayMode=function(){if(g_temp.isPlayMode=!0,g_temp.isPlayModePaused=!1,g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval),g_temp.objProgress){var e=g_temp.objProgress.getElement();g_temp.objProgress.setProgress(0),e.show()}g_objGallery.trigger(t.events.START_PLAY),g_objSlider&&1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying()},this.resetPlaying=function(){if(0==g_temp.isPlayMode)return!0;g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now()},this.pausePlaying=function(){if(1==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!0,clearInterval(g_temp.playHandle),g_objGallery.trigger(t.events.PAUSE_PLAYING)},this.continuePlaying=function(){if(0==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!1,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval)},this.stopPlayMode=function(){(g_temp.isPlayMode=!1,clearInterval(g_temp.playHandle),g_temp.playTimePassed=0,g_temp.objProgress)&&g_temp.objProgress.getElement().hide();g_objGallery.trigger(t.events.STOP_PLAY)},this.isPlayMode=function(){return g_temp.isPlayMode},this.togglePlayMode=function(){0==t.isPlayMode()?t.startPlayMode():t.stopPlayMode()},this.___________GENERAL_EXTERNAL___________=function(){},this.shuffleItems=function(){for(var e in g_arrItems=g_functions.arrayShuffle(g_arrItems))g_arrItems[e].index=parseInt(e)},this.setOptions=function(e){g_options=jQuery.extend(g_options,e)},this.selectItem=function(e,i){"number"==typeof e&&(e=t.getItem(e));var n=e.index;if(n==g_selectedItemIndex)return!0;(unselectSeletedItem(),g_selectedItem=e,g_selectedItemIndex=n,g_objGallery.trigger(t.events.ITEM_CHANGE,[e,i]),1==g_temp.isPlayMode)&&(t.resetPlaying(),1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying())},this.nextItem=function(){var e=g_selectedItemIndex+1;return 0==g_numItems||(0==g_options.gallery_carousel&&e>=g_numItems||(e>=g_numItems&&(e=0),void t.selectItem(e,"next")))},this.prevItem=function(){var e=g_selectedItemIndex-1;return-1==g_selectedItemIndex&&(e=0),0==g_numItems||(0==g_options.gallery_carousel&&e<0||(e<0&&(e=g_numItems-1),void t.selectItem(e,"prev")))},this.isFullScreen=function(){return 1==g_temp.isFakeFullscreen||1==g_functions.isFullScreen()},this.isFakeFullscreen=function(){return g_temp.isFakeFullscreen},this.toFullScreen=function(){g_functions.setGlobalData("fullscreenID",g_galleryID);var e=g_objWrapper.get(0);0==g_functions.toFullscreen(e)&&toFakeFullScreen()},this.exitFullScreen=function(){1==g_temp.isFakeFullscreen?exitFakeFullscreen():g_functions.exitFullscreen()},this.toggleFullscreen=function(){0==t.isFullScreen()?t.toFullScreen():t.exitFullScreen()},this.resize=function(e,t,i){g_objWrapper.css("width","auto"),g_objWrapper.css("max-width",e+"px"),t&&g_objWrapper.height(t),i||!0===i||onGalleryResized()},this.setSizeClass=function(e,i){if(!e)e=g_objWrapper;if(!i)i=t.getSize().width;if(0==i)i=jQuery(window).width();var n="";if(i<=480?n="ug-under-480":i<=780?n="ug-under-780":i<960&&(n="ug-under-960"),1==e.hasClass(n))return!0;removeAllSizeClasses(e),""!=n&&e.addClass(n)},this.isMobileMode=function(){return!!g_objWrapper.hasClass("ug-under-480")},this.isSmallWindow=function(){var e=jQuery(window).width();return!e||e<=480},this.isGalleryVisible=function(){return g_objWrapper.is(":visible")},this.isGalleryInsideScreen=function(){return!!g_objSlider&&g_functions.isElementInsideScreen(g_objWrapper)},this.changeItems=function(e,t){if(!e)e="noitems";runGallery(g_galleryID,"nochange",e,t)},this.addItems=function(e){if(!e||0==e.length)return!1;var t=g_objWrapper.children(".ug-newitems-wrapper");if(0==t.length&&g_objWrapper.append("<div class='ug-newitems-wrapper' style='display:none'></div>"),(t=g_objWrapper.children(".ug-newitems-wrapper")).append(e),fillItemsArray(jQuery(t.children()),!0),loadAPIs(),!g_objTheme||"function"!=typeof g_objTheme.addItems)throw new Error("addItems function not found in the theme");t.remove(),g_objTheme.addItems()},this.getNewAddedItemsIndexes=function(){var e=[];return jQuery.each(g_arrItems,function(t,i){1==i.isNewAdded&&e.push(t)}),e},this.showErrorMessageReplaceGallery=function(e){showErrorMessage(e)},this.setFuncCustomHeight=function(e){g_temp.funcCustomHeight=e},this.setObjLightbox=function(e){g_objLightbox=e},this.isLightboxOpened=function(){if(!g_objLightbox)return!1},this.__________EXTERNAL_EVENTS_______=function(){},this.triggerEvent=function(e,t){t?("array"!=jQuery.type(t)&&(t=[t]),g_objGallery.trigger(e,t)):g_objGallery.trigger(e)},this.onEvent=function(e,t){g_objGallery.on(e,t)},this.destroyEvent=function(e){g_objGallery.off(e)},this.__________AJAX_REQUEST_______=function(){},this.ajaxRequest=function(e,t,i,n){if(!i||"function"!=typeof i)throw new Error("ajaxRequest error: success function should be passed");var r=g_options.gallery_urlajax;if(!r||""==r)throw new Error("ajaxRequest error: Ajax url don't passed");if(void 0===t)t={};var o={action:"unitegallery_ajax_action",client_action:e,galleryID:g_galleryID,data:t};jQuery.ajax({type:"post",url:g_options.gallery_urlajax,dataType:"json",data:o,success:function(e){if(!e)throw new Error("Empty ajax response!");if(-1==e||0===e)throw new Error("ajax error!!!");if(void 0===e.success)throw new Error("ajax error!!!");if(0==e.success)return showErrorMessage(e.message,"ajax error"),!1;i(e)},error:function(e,t,i){console.log("Ajax Error!!! "+t),responseText=e.responseText,n&&"function"==typeof n?n(responseText):trace(responseText)}})},this.requestNewItems=function(e,i,n){var r=g_options.gallery_enable_cache;if(n||(n=e),1==i&&(r=!1),1==r&&g_objCache.hasOwnProperty(n)){var o=g_objCache[n];t.changeItems(o,n)}else g_objGallery.trigger(t.events.GALLERY_BEFORE_REQUEST_ITEMS),t.ajaxRequest("front_get_cat_items",{catid:e},function(e){var i=e.html;t.changeItems(i,n)})},this.run=function(e,t){if(t&&t.hasOwnProperty("gallery_debug_errors")&&(g_options.gallery_debug_errors=t.gallery_debug_errors),1==g_options.gallery_debug_errors)try{runGallery(e,t)}catch(e){if("object"==typeof e){var i=e.message,n=e.lineNumber,r=e.fileName;e.stack;i+=" <br><br> in file: "+r,i+=" <b> line "+n+"</b>",trace(e)}else i=e;showErrorMessage(i=i.replace("Error:",""))}else runGallery(e,t)}}function UGLightbox(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UniteGalleryMain,_=new UGSlider,g=new UGFunctions,c=new UGTextPanel,h={lightbox_type:"wide",lightbox_show_textpanel:!0,lightbox_textpanel_width:550,lightbox_hide_arrows_onvideoplay:!0,lightbox_arrows_position:"sides",lightbox_arrows_offset:10,lightbox_arrows_inside_offset:10,lightbox_arrows_inside_alwayson:!1,lightbox_overlay_color:null,lightbox_overlay_opacity:1,lightbox_top_panel_opacity:null,lightbox_show_numbers:!0,lightbox_numbers_size:null,lightbox_numbers_color:null,lightbox_numbers_padding_top:null,lightbox_numbers_padding_right:null,lightbox_compact_closebutton_offsetx:1,lightbox_compact_closebutton_offsety:1,lightbox_close_on_emptyspace:!0};this.events={LIGHTBOX_INIT:"lightbox_init"};var p={topPanelHeight:44,initTextPanelHeight:26,isOpened:!1,isRightNowOpened:!1,putSlider:!0,isCompact:!1,fadeDuration:300,positionFrom:null,textPanelTop:null,textPanelLeft:null,isArrowsInside:!1,isArrowsOnHoverMode:!1,lastMouseX:null,lastMouseY:null,originalOptions:null,isSliderChangedOnce:!1,isTopPanelEnabled:!0},m={lightbox_slider_controls_always_on:!0,lightbox_slider_enable_bullets:!1,lightbox_slider_enable_arrows:!1,lightbox_slider_enable_progress_indicator:!1,lightbox_slider_enable_play_button:!1,lightbox_slider_enable_fullscreen_button:!1,lightbox_slider_enable_zoom_panel:!1,lightbox_slider_enable_text_panel:!1,lightbox_slider_scale_mode_media:"down",lightbox_slider_scale_mode:"down",lightbox_slider_loader_type:3,lightbox_slider_loader_color:"black",lightbox_slider_transition:"fade",lightbox_slider_image_padding_top:p.topPanelHeight,lightbox_slider_image_padding_bottom:0,lightbox_slider_video_padding_top:0,lightbox_slider_video_padding_bottom:0,lightbox_textpanel_align:"middle",lightbox_textpanel_padding_top:5,lightbox_textpanel_padding_bottom:5,slider_video_constantsize:!1,lightbox_slider_image_border:!1,lightbox_textpanel_enable_title:!0,lightbox_textpanel_enable_description:!1,lightbox_textpanel_desc_style_as_title:!0,lightbox_textpanel_enable_bg:!1,video_enable_closebutton:!1,lightbox_slider_video_enable_closebutton:!1,video_youtube_showinfo:!1,lightbox_slider_enable_links:!1},f={lightbox_overlay_opacity:.6,lightbox_slider_image_border:!0,lightbox_slider_image_shadow:!0,lightbox_slider_image_padding_top:30,lightbox_slider_image_padding_bottom:30,slider_video_constantsize:!0,lightbox_textpanel_align:"bottom",lightbox_textpanel_title_text_align:"left",lightbox_textpanel_desc_text_align:"left",lightbox_textpanel_padding_left:10,lightbox_textpanel_padding_right:10};function b(){1==p.isCompact&&1==h.lightbox_show_textpanel&&(h.lightbox_slider_image_padding_bottom=p.initTextPanelHeight),1==p.isCompact&&"inside"==h.lightbox_arrows_position&&(p.isArrowsInside=!0),1==p.isArrowsInside&&0==h.lightbox_arrows_inside_alwayson&&(p.isArrowsOnHoverMode=!0),0==h.lightbox_show_textpanel&&(p.isTopPanelEnabled=!1,p.topPanelHeight=0,h.lightbox_slider_image_padding_top=0)}function v(e){if(!_)return!0;var t={slider_image_padding_top:e};_.setOptions(t),_.refreshSlideItems()}function y(e){if(!s)return!1;if(!c)return!1;var t=s.height();if(0==t)return!1;if(0==s.is(":visible"))return!1;var i=t,n=c.getSize().height;t!=p.topPanelHeight&&(i=p.topPanelHeight),n>i&&(i=n),t!=i&&(s.height(i),_&&0==_.isAnimating()&&v(i))}function I(e){if(0==p.isOpened)return!1;if(!c)return!1;if(!_)return!1;var i=g.getElementSize(t),n=c.getSize();if(0==n.width||n.height>120)return!1;if(!e){var r=_.getSlideImage();e=g.getElementSize(r)}if(0==e.height||0==e.width)return!1;if(e.bottom+n.height<i.height)return!1;var o=_.getOptions(),a=n.height;if(a!=o.slider_image_padding_bottom){var s={slider_image_padding_bottom:a};if(0==_.isAnimating())return _.setOptions(s),_.refreshSlideItems(),!0}return!1}function w(e){g.getElementSize(t);var i=_.getSlideImage(),n=g.getElementSize(i);if(0==n.width)return!1;p.textPanelLeft=n.left,p.textPanelTop=n.bottom;var r=n.width;if(a){var o=g.getElementSize(a);r-=o.width;var s=n.right-o.width;g.placeElement(a,s,p.textPanelTop)}c&&(c.show(),c.refresh(!0,!0,r),function(e,t){if(!e){var i=_.getSlideImage();e=g.getElementSize(i)}p.textPanelTop=e.bottom,!0===t&&c.positionPanel(p.textPanelTop,p.textPanelLeft)}(n)),0==I(n)&&(p.positionFrom="handleCompactTextpanelSizes",c&&(c.positionPanel(p.textPanelTop,p.textPanelLeft),!0===e&&(e(),N())))}function E(){return 0==_.isCurrentSlideType("image")||1==_.isCurrentImageInPlace()}function T(e,t){if(0==p.isArrowsInside)return!1;if(!n)return!1;var i=E();if(n.show(),r.show(),p.positionFrom="positionArrowsInside",1==p.isArrowsOnHoverMode&&1==i&&0==A()&&M(!0),0==i)var o=g.getElementRelativePos(n,"left",h.lightbox_arrows_offset),a=g.getElementRelativePos(n,"middle"),s=g.getElementRelativePos(r,"right",h.lightbox_arrows_offset),l=a;else{var u=_.getSlideImage(),d=g.getElementSize(u);g.getElementSize(_.getElement()),o=g.getElementRelativePos(n,"left",0,u)+d.left+h.lightbox_arrows_inside_offset,a=g.getElementRelativePos(n,"middle",0,u)+d.top,s=g.getElementRelativePos(n,"right",0,u)+d.left-h.lightbox_arrows_inside_offset,l=a}if(!0===t){var c={left:o,top:a},m={left:s,top:l};n.stop().animate(c,{duration:p.fadeDuration}),r.stop().animate(m,{duration:p.fadeDuration})}else n.stop(),r.stop(),g.placeElement(n,o,a),g.placeElement(r,s,l);1==e&&O(t)}function S(e,i){p.positionFrom=null;var n=E(),r=g.getElementRelativePos(o,"right",2,t);if(0==n)var a=2,s=r;else{var l=_.getSlideImage(),u=g.getElementSize(l),d=g.getElementSize(_.getElement()),c=g.getElementSize(o);d.top==d.height&&(d.top=0);s=d.left+u.right-c.width/2+h.lightbox_compact_closebutton_offsetx;(a=d.top+u.top-c.height/2-h.lightbox_compact_closebutton_offsety)<2&&(a=2),s>r&&(s=r)}if(!0===i){var m={left:s,top:a};o.stop().animate(m,{duration:p.fadeDuration})}else o.stop(),g.placeElement(o,s,a);!0===e&&function(e){!0!==e&&o.stop();o.fadeTo(p.fadeDuration,1)}(i)}function P(){o&&o.stop().fadeTo(p.fadeDuration,0),j(),C(),p.positionFrom="hideCompactElements",1==p.isArrowsInside&&M()}function x(){var e=g.getElementSize(t);s&&g.setElementSizeAndPosition(s,0,0,e.width,p.topPanelHeight),n&&0==p.isArrowsInside&&(1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show()),g.placeElement(n,"left","middle",h.lightbox_arrows_offset),g.placeElement(r,"right","middle",h.lightbox_arrows_offset)),0==p.isCompact&&g.placeElement(o,"right","top",2,2),c&&(p.positionFrom="positionElements",0==p.isCompact?function(e){var t={},i=h.lightbox_textpanel_width;i>e.width-47-40?(t.textpanel_padding_left=47,t.textpanel_padding_right=40,t.textpanel_title_text_align="center",t.textpanel_desc_text_align="center"):(t.textpanel_padding_left=Math.floor((e.width-i)/2),t.textpanel_padding_right=t.textpanel_padding_left,t.textpanel_title_text_align="left",t.textpanel_desc_text_align="left",h.lightbox_textpanel_title_text_align&&(t.textpanel_title_text_align=h.lightbox_textpanel_desc_text_align),h.lightbox_textpanel_desc_text_align&&(t.textpanel_desc_text_align=h.lightbox_textpanel_desc_text_align)),c.setOptions(t),c.refresh(!0,!0),y(),c.positionPanel()}(e):(H(),N()));var i=e.width,a=e.height;if(_){if(s){var l={slider_image_padding_top:s.height()};_.setOptions(l)}_.setSize(i,a),_.setPosition(0,0)}}function j(){c&&c.getElement().stop().fadeTo(p.fadeDuration,0)}function C(){a&&a.stop().fadeTo(p.fadeDuration,0)}function A(){if(!p.lastMouseX)return!0;var e={pageX:p.lastMouseX,pageY:p.lastMouseY};return _.isMouseInsideSlideImage(e)}function M(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!1===t?(A(),!0):void(!0===e?(n.stop().fadeTo(0,0),r.stop().fadeTo(0,0)):(n.stop().fadeTo(p.fadeDuration,0),r.stop().fadeTo(p.fadeDuration,0))))}function O(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!0!==t&&1==E()||(1==_.isSwiping()||(!0!==e&&(n.stop(),r.stop()),n.fadeTo(p.fadeDuration,1),void r.fadeTo(p.fadeDuration,1))))}function z(e){if(!c)return!1;if(!e)e=_.getCurrentItem();c.setTextPlain(e.title,e.description)}function L(e){if(!a)return!1;if(!e)e=_.getCurrentItem();var t=d.getNumItems(),i=e.index+1;a.html(i+" / "+t)}function H(){if(!c)return!1;c.getElement().show().stop().fadeTo(p.fadeDuration,1)}function N(){a&&a.stop().fadeTo(p.fadeDuration,1)}function k(){if(0==p.isCompact)return!0;P()}function R(){if(0==p.isCompact)return!0;(p.positionFrom="onZoomChange",S(!1,!0),T(!1,!0),1==p.isCompact)&&(0==(_.isCurrentSlideType("image")&&1==_.isCurrentImageInPlace())?(j(),C()):(p.positionFrom="onZoomChange",H(),N()))}function G(){if(0==p.isCompact)return!0;p.positionFrom="onSliderAfterReturn",S(!0),T(!0),0==I()&&w(),H(),N()}function D(e,t){return t=jQuery(t),0==p.isCompact||(0==_.isSlideCurrent(t)||(p.positionFrom="onSliderAfterPutImage",S(!0),T(!0),void w()))}function Q(){var e=_.getOptions().slider_image_padding_top;if(s){var t=s.height();t!=e&&v(t)}if(1==p.isCompact){if(z(),L(),p.positionFrom="onSliderTransitionEnd",S(!0),T(!0),0==_.isSlideActionActive())0==I()&&w();H(),N()}}function W(e,t){0==p.isCompact?(a&&L(t),c&&(z(t),0==p.isRightNowOpened&&(c.positionElements(!1),y(),c.positionPanel()))):0==_.isAnimating()&&(c&&z(t),a&&L(t)),0==p.isSliderChangedOnce&&(p.isSliderChangedOnce=!0,u.trigger(l.events.LIGHTBOX_INIT))}function B(e,t){if("image"!=_.getSlideType()&&0==p.isCompact&&_.isSlideActionActive())return!0;if(1==_.isPreloading())return l.close("slider"),!0;1==h.lightbox_close_on_emptyspace&&(0==_.isMouseInsideSlideImage(t)&&l.close("slider_inside"))}function F(){x()}function Y(){s?function(){if(!s)return!1;s.hide()}():a&&a.hide(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.hide(),r.hide())}function U(){s?(!function(){if(!s)return!1;s.show()}(),y()):a&&a.show(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show())}function V(e,t,i){var n=!1;switch(t){case 27:1==p.isOpened&&l.close("keypress");break;case 38:case 40:case 33:case 34:n=!0}1==p.isOpened&&1==n&&i.preventDefault()}function X(){1==p.isArrowsOnHoverMode&&O(!1,!0)}function Z(e){p.positionFrom="hideCompactElements",1==p.isArrowsOnHoverMode&&1==E()&&M(!1,!0)}function q(e){p.lastMouseX=e.pageX,p.lastMouseY=e.pageY,1==(!n||0==n.is(":visible")||1!=n.css("opacity"))&&A()&&0==_.isAnimating()&&(p.positionFrom="onMouseMove",n&&0==n.is(":animated")&&O(!1,!0))}function K(e,t,i,n){if(0==p.isOpened)return!0;switch(h.gallery_mousewheel_role){default:case"zoom":"image"!=_.getSlideType()&&e.preventDefault();break;case"none":e.preventDefault();break;case"advance":d.onGalleryMouseWheel(e,t,i,n)}}this.destroy=function(){if(jQuery(document).unbind("mousemove"),i.off("touchstart"),i.off("touchend"),o.off("click"),e.off(d.events.ITEM_CHANGE),_){jQuery(_).off(_.events.TRANSITION_END),jQuery(_).off(_.events.CLICK),jQuery(_).off(_.events.START_DRAG),jQuery(_).off(_.events.TRANSITION_START),jQuery(_).off(_.events.AFTER_DRAG_CHANGE),jQuery(_).off(_.events.AFTER_RETURN);var n=_.getVideoObject();jQuery(n).off(n.events.PLAY_START),jQuery(n).off(n.events.PLAY_STOP),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z),_.destroy()}jQuery(window).unbind("resize"),e.off(d.events.GALLERY_KEYPRESS,V),t.off("mousewheel"),t.remove()},this.isOpened=function(){return p.isOpened},this.open=function(s){var l=d.getItem(s);(p.isOpened=!0,p.isRightNowOpened=!0,setTimeout(function(){p.isRightNowOpened=!1},100),_&&_.setItem(l,"lightbox_open"),c&&c.setTextPlain(l.title,l.description),i.stop().fadeTo(0,0),t.show(),t.fadeTo(0,1),i.stop().fadeTo(p.fadeDuration,h.lightbox_overlay_opacity),x(),1==p.isCompact)&&(1==_.isPreloading()?(o&&o.hide(),n&&1==p.isArrowsInside&&(n.hide(),r.hide()),a&&a.hide(),c&&c.hide()):1==p.isArrowsInside&&(n.hide(),r.hide()));_&&_.startSlideAction(),e.trigger(d.events.OPEN_LIGHTBOX,l)},this.close=function(i){p.isOpened=!1,1==p.isCompact&&P(),_&&_.stopSlideAction(),"image"!=_.getSlideType()?t.hide():t.fadeTo(p.fadeDuration,0,function(){t.hide()}),e.trigger(d.events.CLOSE_LIGHTBOX)},this.init=function(t,i){!function(t,i){d=t,e=jQuery(t),d.setObjLightbox(l),h=jQuery.extend(h,m),h=jQuery.extend(h,i),p.originalOptions=jQuery.extend({},h),"compact"==h.lightbox_type&&(p.isCompact=!0,h=jQuery.extend(h,f),h=jQuery.extend(h,i)),b(),1==p.putSlider?(d.initSlider(h,"lightbox"),g_objects=t.getObjects(),_=g_objects.g_objSlider):_=null,1==h.lightbox_show_textpanel?c.init(d,h,"lightbox"):c=null}(t,i)},this.putHtml=function(){var e,l;d.isSmallWindow()&&1==p.isCompact&&(p.isCompact=!1,b(),p.isArrowsInside=!1,p.isArrowsOnHoverMode=!1,(h=jQuery.extend({},p.originalOptions)).lightbox_arrows_position="sides",_.setOptions(h)),e="",l="",1==p.isCompact&&(l=" ug-lightbox-compact"),e+="<div class='ug-gallery-wrapper ug-lightbox"+l+"'>",e+="<div class='ug-lightbox-overlay'></div>",0==p.isCompact&&p.isTopPanelEnabled?(e+="<div class='ug-lightbox-top-panel'>",e+="<div class='ug-lightbox-top-panel-overlay'></div>",h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="</div>"):h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="<div class='ug-lightbox-button-close'></div>",e+="<div class='ug-lightbox-arrow-left'></div>",e+="<div class='ug-lightbox-arrow-right'></div>",e+="</div>",t=jQuery(e),jQuery("body").append(t),_&&_.setHtml(t),i=t.children(".ug-lightbox-overlay"),0==p.isCompact&&1==p.isTopPanelEnabled&&0==(s=t.children(".ug-lightbox-top-panel")).length&&(s=null),o=t.find(".ug-lightbox-button-close"),h.lightbox_show_numbers&&(a=t.find(".ug-lightbox-numbers")),n=t.children(".ug-lightbox-arrow-left"),r=t.children(".ug-lightbox-arrow-right"),c&&(s?c.appendHTML(s):c.appendHTML(t))},this.run=function(){!function(){if(null!==h.lightbox_overlay_color&&i.css("background-color",h.lightbox_overlay_color),null!==h.lightbox_overlay_opacity&&i.fadeTo(0,h.lightbox_overlay_opacity),s&&null!==h.lightbox_top_panel_opacity&&s.children(".ug-lightbox-top-panel-overlay").fadeTo(0,h.lightbox_top_panel_opacity),a){var e={};null!==h.lightbox_numbers_size&&(e["font-size"]=h.lightbox_numbers_size+"px"),h.lightbox_numbers_color&&(e.color=h.lightbox_numbers_color),null!==h.lightbox_numbers_padding_right&&(e["padding-right"]=h.lightbox_numbers_padding_right+"px"),null!==h.lightbox_numbers_padding_top&&(e["padding-top"]=h.lightbox_numbers_padding_top+"px"),a.css(e)}}(),_&&_.run(),function(){if(i.on("touchstart",function(e){e.preventDefault()}),i.on("touchend",function(e){l.close("overlay")}),g.addClassOnHover(r,"ug-arrow-hover"),g.addClassOnHover(n,"ug-arrow-hover"),g.addClassOnHover(o),d.setNextButton(r),d.setPrevButton(n),o.click(function(){l.close("button")}),e.on(d.events.ITEM_CHANGE,W),_){jQuery(_).on(_.events.TRANSITION_END,Q),jQuery(_).on(_.events.CLICK,B);var a=_.getVideoObject();jQuery(a).on(a.events.PLAY_START,Y),jQuery(a).on(a.events.PLAY_STOP,U),jQuery(_).on(_.events.START_DRAG,k),jQuery(_).on(_.events.TRANSITION_START,k),jQuery(_).on(_.events.AFTER_DRAG_CHANGE,G),jQuery(_).on(_.events.AFTER_RETURN,G),jQuery(_).on(_.events.AFTER_PUT_IMAGE,D),jQuery(_).on(_.events.ZOOM_CHANGE,R),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z)}jQuery(window).resize(function(){if(0==p.isOpened)return!0;g.whenContiniousEventOver("lightbox_resize",F,100)}),e.on(d.events.GALLERY_KEYPRESS,V),1==p.isArrowsOnHoverMode&&jQuery(document).bind("mousemove",q),t.on("mousewheel",K)}()}}function UGCarousel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGTileDesign,u=new UGThumbsGeneral,d={carousel_padding:8,carousel_space_between_tiles:20,carousel_navigation_numtiles:3,carousel_scroll_duration:500,carousel_scroll_easing:"easeOutCubic",carousel_autoplay:!0,carousel_autoplay_timeout:3e3,carousel_autoplay_direction:"right",carousel_autoplay_pause_onhover:!0,carousel_vertical_scroll_ondrag:!1};this.events={START_PLAY:"carousel_start_play",PAUSE_PLAY:"carousel_pause_play",STOP_PLAY:"carousel_stop_play"};var _={eventSizeChange:"thumb_size_change",isFirstTimeRun:!0,carouselMaxWidth:null,tileWidth:0,initTileWidth:0,initTileHeight:0,sideSpace:1500,spaceActionSize:500,numCurrent:0,touchActive:!1,startInnerPos:0,lastTime:0,startTime:0,startMousePos:0,lastMousePos:0,scrollShortDuration:200,scrollShortEasing:"easeOutQuad",handle:null,isPlayMode:!1,isPaused:!1,storedEventID:"carousel"};function g(e,t){if(!t)t=_.initTileHeight/_.initTileWidth*e;_.tileWidth=e;var i={tile_width:e,tile_height:t};l.setOptions(i),d.tile_width=e,d.tile_height=t,l.resizeAllTiles(e),I(!0)}function c(){if(null===_.carouselMaxWidth)throw new Error("The carousel width not set");if(_.tileWidth<_.initTileWidth){(a=_.carouselMaxWidth-2*d.carousel_padding)>_.initTileWidth&&(a=_.initTileWidth),g(a);var o=s.getNumItemsInSpace(_.carouselMaxWidth,a,d.carousel_space_between_tiles)}else{var a;if((o=s.getNumItemsInSpace(_.carouselMaxWidth,_.tileWidth,d.carousel_space_between_tiles))<=0)o=1,g(a=_.carouselMaxWidth-2*d.carousel_padding)}var u=s.getSpaceByNumItems(o,_.tileWidth,d.carousel_space_between_tiles);u+=2*d.carousel_padding,i.width(u),1==_.isFirstTimeRun?(l.initEvents(),i.bind("mousedown touchstart",C),jQuery("body").bind("mousemove touchmove",A),jQuery(window).add("body").bind("mouseup touchend",M),i.hover(O,z),l.run(),jQuery.each(t,function(t,i){i.objThumbWrapper.data("index",t),e.trigger(_.eventSizeChange,[i.objThumbWrapper,!0]),i.objTileOriginal=i.objThumbWrapper.clone(!0,!0)}),I(!0),1==d.carousel_autoplay&&r.startAutoplay()):(1==d.carousel_autoplay&&r.pauseAutoplay(),S(0,!1),1==d.carousel_autoplay&&r.startAutoplay()),s.placeElement(n,0,d.carousel_padding),x(),_.isFirstTimeRun=!1}function h(){return s.getElementSize(n).left}function p(e){return s.getMousePosition(e).pageX}function m(){return n.children(".ug-thumb-wrapper")}function f(e){return s.getNumItemsInSpace(e,_.tileWidth,d.carousel_space_between_tiles)}function b(){return m().length}function v(e){w(e);var t=m();return jQuery(t[e])}function y(){return f(s.getElementSize(i).width)}function I(e){if(!e)e=!1;var t,r=m(),o=0,a=0;return jQuery.each(r,function(e,i){i=jQuery(i),s.placeElement(i,o,0);var n=s.getElementSize(i);o+=n.width+d.carousel_space_between_tiles,a=Math.max(a,n.height),e==r.length-1&&(t=n.right)}),n.width(t),a+=2*d.carousel_padding,!0===e&&(n.height(a),i.height(a)),S(_.numCurrent,!1),t}function w(e){if(e>m().length-1)throw new Error("Wrogn tile number: "+e)}function E(t,i){if("left"==i)var r=n.children(".ug-thumb-wrapper").first();else r=n.children(".ug-thumb-wrapper").last();var o=function(e,t,i){var n=e.data("index");if(null==n)throw new Error("every tile should have index!");for(var r=[],o=0;o<t;o++){if("prev"==i)var s=a.getPrevItem(n,!0);else s=a.getNextItem(n,!0);if(!s)throw new Error("the item to add is empty");var l=s.objTileOriginal.clone(!0,!0);n=s.index,l.addClass("cloned"),r.push(l)}return r}(r,t,"left"==i?"prev":"next");jQuery.each(o,function(t,r){"left"==i?n.prepend(r):n.append(r),e.trigger(_.eventSizeChange,r),l.loadTileImage(r)})}function T(e,t){w(n);for(var i=m(),n=i.length,r=0;r<e;r++)"left"==t?jQuery(i[r]).remove():jQuery(i[n-1-r]).remove()}function S(e,t,i){if(void 0===t){t=!0;if(n.is(":animated"))return!0}var r=v(e),o={left:-s.getElementSize(r).left+d.carousel_padding+"px"};if(!0===t){var a=d.carousel_scroll_duration,l=d.carousel_scroll_easing;!0===i&&(a=_.scrollShortDuration,l=_.scrollShortEasing),n.stop(!0).animate(o,{duration:a,easing:l,queue:!1,complete:function(){_.numCurrent=e,x()}})}else _.numCurrent=e,n.css(o)}function P(){var e,t,i,n;S((e=-h(),t=f(e),i=s.getElementSize(v(t)).left,n=s.getElementSize(v(t+1)).left,Math.abs(i-e)<Math.abs(n-e)?t:t+1),!0,!0)}function x(){var e,t=(e=-h(),_.sideSpace-e),r=function(){var e=s.getElementSize(i),t=s.getElementSize(n),r=t.width-e.width+t.left;return _.sideSpace-r}(),o=0,a=0,l=0,u=0,d=b();if(t>_.spaceActionSize)E(o=f(t),"left"),_.numCurrent+=o;else if(t<-_.spaceActionSize){T(l=f(Math.abs(t)),"left"),_.numCurrent-=l}if(r>_.spaceActionSize?E(a=f(r),"right"):r<-_.spaceActionSize&&T(u=f(Math.abs(r)),"right"),u>d)throw new Error("Can't remove more then num tiles");var g=!1;return(o||a||l||u)&&(I(),g=!0),g}function j(){"left"==d.carousel_autoplay_direction?r.scrollRight(1):r.scrollLeft(1)}function C(e){if(1==_.touchActive)return!0;_.touchActive=!0,r.pauseAutoplay(),_.startTime=jQuery.now(),_.startMousePos=p(e),_.startInnerPos=h(),_.lastTime=_.startTime,_.lastMousePos=_.startMousePos,s.storeEventData(e,_.storedEventID)}function A(e){if(0==_.touchActive)return!0;s.updateStoredEventData(e,_.storedEventID),e.preventDefault();var t=null;if(1==d.carousel_vertical_scroll_ondrag&&(t=s.handleScrollTop(_.storedEventID)),"vert"===t)return!0;_.lastMousePos=p(e);var i,r=_.lastMousePos-_.startMousePos,o=_.startInnerPos+r,a=r>0?"prev":"next";o>0&&"prev"==a&&(o/=3),o<-s.getElementSize(n).width&&"next"==a&&(o=_.startInnerPos+r/3),i={left:o+"px"},n.css(i)}function M(e){if(0==_.touchActive)return!0;_.touchActive=!1,P(),r.unpauseAutoplay()}function O(e){if(0==d.carousel_autoplay_pause_onhover)return!0;1==_.isPlayMode&&0==_.isPaused&&r.pauseAutoplay()}function z(e){if(0==d.carousel_autoplay_pause_onhover)return!0;r.unpauseAutoplay()}function L(){var e=_.lastTime-_.startTime,t=Math.abs(_.lastMousePos-_.startMousePos);return!(e>300)&&!(t>30)}this.startAutoplay=function(){_.isPlayMode=!0,_.isPaused=!1,o.trigger(r.events.START_PLAY),_.handle&&clearInterval(_.handle),_.handle=setInterval(j,d.carousel_autoplay_timeout)},this.unpauseAutoplay=function(){return 0==_.isPlayMode||(0==_.isPaused||void r.startAutoplay())},this.pauseAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!0,_.handle&&clearInterval(_.handle),o.trigger(r.events.PAUSE_PLAY)},this.stopAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!1,_.isPlayMode=!1,_.handle&&clearInterval(_.handle),o.trigger(r.events.STOP_PLAY)},this.destroy=function(){_.handle&&clearInterval(_.handle),o.off(r.events.START_PLAY),o.off(r.events.STOP_PLAY),i.unbind("mousedown"),i.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),i.off("mouseenter").off("mouseleave"),l.destroy()},this.init=function(i,n,r){r&&this.setMaxWidth(r),function(i,n){g_objects=i.getObjects(),a=i,jQuery(i),e=g_objects.g_objWrapper,t=g_objects.g_arrItems,d=jQuery.extend(d,n),l.setFixedMode(),l.setApproveClickFunction(L),l.init(i,d),u=l.getObjThumbs(),d=l.getOptions(),_.initTileWidth=d.tile_width,_.initTileHeight=d.tile_height,_.tileWidth=d.tile_width}(i,n)},this.setMaxWidth=function(e){_.carouselMaxWidth=e},this.setHtml=function(t){!function(t){t||(t=e);e.append("<div class='ug-carousel-wrapper'><div class='ug-carousel-inner'></div></div>"),i=e.children(".ug-carousel-wrapper"),n=i.children(".ug-carousel-inner"),l.setHtml(n),u.getThumbs().fadeTo(0,1)}(t)},this.getElement=function(){return i},this.getObjTileDesign=function(){return l},this.getEstimatedHeight=function(){return d.tile_height+2*d.carousel_padding},this.run=function(){c()},this.scrollRight=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=_.numCurrent-e;i<=0&&(i=0),S(i)},this.scrollLeft=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=b(),n=_.numCurrent+e;n>=i&&(n=i-1),S(n)},this.setScrollLeftButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollLeft)},this.setScrollRightButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollRight)},this.setPlayPauseButton=function(e){s.setButtonMobileReady(e),1==_.isPlayMode&&0==_.isPaused&&e.addClass("ug-pause-icon"),o.on(r.events.START_PLAY,function(){e.addClass("ug-pause-icon")}),o.on(r.events.STOP_PLAY,function(){e.removeClass("ug-pause-icon")}),s.setButtonOnClick(e,function(){0==_.isPlayMode||1==_.isPaused?r.startAutoplay():r.stopAutoplay()})}}function UGLoadMore(){jQuery(this);var e,t,i,n,r=new UniteGalleryMain,o=(new UGFunctions,{isInited:!1}),a={loadmore_container:"ug_loadmore_wrapper"};function s(){e.show()}function l(){t.hide(),i.show();var o={numitems:r.getNumItems()};r.ajaxRequest("front_loadmore",o,function(n){i.hide();var o=n.html_items;1==n.show_loadmore?(t.blur().show(),i.hide()):e.hide(),r.addItems(o)},function(e){e="Ajax Error!"+e,i.hide(),n.show(),n.html(e)})}this.events={},this.destroy=function(){if(0==o.isInited)return!1},this.init=function(u,d){if(r=u,jQuery(r),a=jQuery.extend(a,d),0!=(e=jQuery("#"+a.loadmore_container)).length&&0!=(t=e.find(".ug-loadmore-button")).length&&0!=(i=e.find(".ug-loadmore-loader")).length&&0!=(n=e.find(".ug-loadmore-error")).length&&(o.isInited=!0),0==o.isInited)return trace("load more not inited, something is wrong"),!1;r.onEvent("tiles_first_placed",s),t.click(l)}}function UGTabs(){jQuery(this);var e,t,i=new UniteGalleryMain,n=(new UGFunctions,{tabs_type:"tabs",tabs_container:"#ug_tabs",tabs_class_selected:"ug-tab-selected"});function r(){"select"==n.tabs_type?t.change(s):e.click(a)}function o(e){i.requestNewItems(e)}function a(){var t=n.tabs_class_selected,i=jQuery(this);if(i.hasClass(t))return!0;e.not(i).removeClass(t),i.addClass(t);var r=i.data("catid");if(!r)return!0;o(r)}function s(){var e=jQuery(this).val();if(!e)return!0;o(e)}this.events={},this.destroy=function(){t&&t.off("change"),e&&e.off("click")},this.init=function(r,o){!function(r,o){i=r,jQuery(i),"select"==(n=jQuery.extend(n,o)).tabs_type?t=jQuery(n.tabs_container):e=jQuery(n.tabs_container+" .ug-tab")}(r,o)},this.run=function(){r()}}function UG_API(e){var t,i=this,n=(jQuery(i),new UniteGalleryMain),r=[];function o(e){var t={index:e.index,title:e.title,description:e.description,urlImage:e.urlImage,urlThumb:e.urlThumb},i=e.objThumbImage.data();for(var n in i){switch(n){case"image":case"description":continue}t[n]=i[n]}return t}n=e,t=jQuery(e),this.events={API_INIT_FUNCTIONS:"api_init",API_ON_EVENT:"api_on_event"},this.on=function(e,a,s){switch(!0!==s&&r.push({event:e,func:a}),e){case"item_change":t.on(n.events.ITEM_CHANGE,function(){var e=o(n.getSelectedItem());a(e.index,e)});break;case"resize":t.on(n.events.SIZE_CHANGE,a);break;case"enter_fullscreen":t.on(n.events.ENTER_FULLSCREEN,a);break;case"exit_fullscreen":t.on(n.events.EXIT_FULLSCREEN,a);break;case"play":t.on(n.events.START_PLAY,a);break;case"stop":t.on(n.events.STOP_PLAY,a);break;case"pause":t.on(n.events.PAUSE_PLAYING,a);break;case"continue":t.on(n.events.CONTINUE_PLAYING,a);break;case"open_lightbox":t.on(n.events.OPEN_LIGHTBOX,a);break;case"close_lightbox":t.on(n.events.CLOSE_LIGHTBOX,a);break;default:console&&console.log("wrong api event: "+e)}t.trigger(i.events.API_ON_EVENT,[e,a])},this.play=function(){n.startPlayMode()},this.stop=function(){n.stopPlayMode()},this.togglePlay=function(){n.togglePlayMode()},this.enterFullscreen=function(){n.toFullScreen()},this.exitFullscreen=function(){n.exitFullScreen()},this.toggleFullscreen=function(){n.toggleFullscreen()},this.resetZoom=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomBack()},this.zoomIn=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomIn()},this.zoomOut=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomOut()},this.nextItem=function(){n.nextItem()},this.prevItem=function(){n.prevItem()},this.selectItem=function(e){n.selectItem(e)},this.resize=function(e,t){t?n.resize(e,t):n.resize(e)},this.getItem=function(e){return o(n.getItem(e))},this.getNumItems=function(){return n.getNumItems()},this.reloadGallery=function(e){if(!e)e={};n.run(null,e),r.map(function(e){i.on(e.event,e.func,!0)})},this.destroy=function(){n.destroy()},t.trigger(i.events.API_INIT_FUNCTIONS,i)}jQuery.fn.unitegallery=function(e){var t="#"+jQuery(this).attr("id");if(!e)e={};var i=new UniteGalleryMain;return i.run(t,e),void 0===window.ugArrGalleriesObjects&&(window.ugArrGalleriesObjects={}),window.ugArrGalleriesObjects[t]=i,new UG_API(i)};
|
1 |
+
//Unite Gallery, Version: 1.7.56, released 20 January 2022
|
2 |
+
|
3 |
+
function debugLine(e,t,i){!0===e&&(e="true"),!1===e&&(e="false");var n=e;if("object"==typeof e)for(name in n="",e){var r=e[name];n+=" "+name+": "+r}if(1!=t||i||(n+=" "+Math.random()),1==i){var o=jQuery("#debug_line");o.width(200),o.height()>=500&&o.html(""),n=o.html()+"<br> -------------- <br>"+n}jQuery("#debug_line").show().html(n)}function debugSide(e){var t="";for(name in e){var i=e[name];t+=name+" : "+i+"<br>"}jQuery("#debug_side").show().html(t)}function trace(e){"undefined"!=typeof console&&console.log(e)}function UGFunctions(){var e=null,t=this,i={starTime:0,arrThemes:[],isTouchDevice:-1,isRgbaSupported:-1,timeCache:{},dataCache:{},lastEventType:"",lastEventTime:0,lastTouchStartElement:null,touchThreshold:700,handle:null};function n(e,t,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent?t.attachEvent("on"+e,i):t[e]=i}this.debugVar="",this.getvalopt={FORCE_BOOLEAN:"force_boolean",FORCE_NUMERIC:"force_numeric",TRIM:"trim"},this.z__________GENERAL___________=function(){},this.getVal=function(e,i,n,r){if(!n)n="";var o="";switch(o=e&&"object"==typeof e?0==e.hasOwnProperty(i)?n:e[i]:n,r){case t.getvalopt.FORCE_BOOLEAN:o=t.strToBool(o);break;case t.getvalopt.TRIM:o=String(o),o=jQuery.trim(o);break;case t.getvalopt.FORCE_NUMERIC:"string"==typeof(o=jQuery.trim(o))&&(o.replace("px",""),o=Number(o))}return o},this.z__________FULL_SCREEN___________=function(){},this.toFullscreen=function(e,t){if(e.requestFullscreen)e.requestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},this.exitFullscreen=function(){if(0==t.isFullScreen())return!1;if(document.exitFullscreen)document.exitFullscreen();else if(document.cancelFullScreen)document.cancelFullScreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},this.addFullScreenChangeEvent=function(e){document.webkitCancelFullScreen?n("webkitfullscreenchange",document,e):document.msExitFullscreen?n("MSFullscreenChange",document,e):document.mozCancelFullScreen?n("mozfullscreenchange",document,e):n("fullscreenchange",document,e)},this.destroyFullScreenChangeEvent=function(){jQuery(document).unbind("fullscreenChange"),jQuery(document).unbind("mozfullscreenchange"),jQuery(document).unbind("webkitfullscreenchange"),jQuery(document).unbind("MSFullscreenChange")},this.getFullScreenElement=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},this.isFullScreen=function(){var e=document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement;return e=!!e},this.z__________GET_PROPS___________=function(){},this.getBrowserPrefix=function(){if(null!==e)return e;var t=["webkit","Moz","ms","O"],i=document.createElement("div");for(var n in t){var r=t[n];if(r+"Transform"in i.style)return r=r.toLowerCase(),e=r,r}return e="",""},this.getImageInsideParentDataByImage=function(e,i,n){var r=e.parent(),o=t.getImageOriginalSize(e);return t.getImageInsideParentData(r,o.width,o.height,i,n)},this.getImageInsideParentData=function(e,t,i,n,r,o,a){if(!r)r={};var s={};if(void 0===o)o=e.width();if(void 0===a)a=e.height();r.padding_left&&(o-=r.padding_left),r.padding_right&&(o-=r.padding_right),r.padding_top&&(a-=r.padding_top),r.padding_bottom&&(a-=r.padding_bottom);var l=null,u="100%",d=null,_=null,g="display:block;margin:0px auto;";if(t>0&&i>0){if("down"==n&&t<o&&i<a)_=(o-(l=t))/2,d=(a-(u=i))/2;else if("fill"==n){(l=(u=a)*(c=t/i))<o?(u=(l=o)/c,_=0,d=Math.round((u-a)/2*-1)):(d=0,_=Math.round((l-o)/2*-1))}else{var c;d=0,_=(o-(l=(u=a)*(c=t/i)))/2,"fitvert"!=n&&l>o&&(_=0,d=(a-(u=(l=o)/c))/2)}l=Math.floor(l),u=Math.floor(u),d=Math.floor(d),_=Math.floor(_),g="position:absolute;"}return r.padding_top&&(d+=r.padding_top),r.padding_left&&(_+=r.padding_left),s.imageWidth=l,s.imageHeight=u,s.imageTop=d,s.imageLeft=_,s.imageRight=_+l,s.imageBottom=0==d||"100%"==u?null:d+u,s.style=g,s},this.getElementCenterPosition=function(e,i){var n=e.parent(),r=t.getElementSize(e),o=t.getElementSize(n),a=o.width,s=o.height;i&&void 0!==i.padding_top&&(s-=i.padding_top),i&&void 0!==i.padding_bottom&&(s-=i.padding_bottom),i&&void 0!==i.padding_left&&(a-=i.padding_left),i&&void 0!==i.padding_right&&(a-=i.padding_right);var l={};return l.left=Math.round((a-r.width)/2),l.top=Math.round((s-r.height)/2),i&&void 0!==i.padding_top&&(l.top+=i.padding_top),i&&void 0!==i.padding_left&&(l.left+=i.padding_left),l},this.getElementCenterPoint=function(e,i){if(!i)i=!1;var n=t.getElementSize(e),r={};return r.x=n.width/2,r.y=n.height/2,1==i&&(r.x+=n.left,r.y+=n.top),r.x=Math.round(r.x),r.y=Math.round(r.y),r},this.getMousePosition=function(e,t){var i={pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY};if(e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(i.pageX=e.originalEvent.touches[0].pageX,i.pageY=e.originalEvent.touches[0].pageY,i.clientX=e.originalEvent.touches[0].clientX,i.clientY=e.originalEvent.touches[0].clientY),t){var n=t.offset();i.mouseX=i.pageX-n.left,i.mouseY=i.pageY-n.top}return i},this.getMouseElementPoint=function(e,i){var n={x:e.pageX,y:e.pageY};return t.getElementLocalPoint(n,i)},this.getElementLocalPoint=function(e,t){var i={},n=t.offset();return i.x=Math.round(e.x-n.left),i.y=Math.round(e.y-n.top),i},this.getImageOriginalSize=function(e,t,i){if(void 0!==t&&void 0!==i)return{width:t,height:i};var n=e[0];if(void 0===n)throw new Error("getImageOriginalSize error - Image not found");var r={};if(void 0===n.naturalWidth){if("number"==typeof e.data("naturalWidth"))return(r={}).width=e.data("naturalWidth"),r.height=e.data("naturalHeight"),r;var o=new Image;return o.src=n.src,o.complete?(r.width=o.width,r.height=o.height,e.data("naturalWidth",r.width),e.data("naturalHeight",r.height),r):{width:0,height:0}}return r.width=n.naturalWidth,r.height=n.naturalHeight,r},this.getimageRatio=function(e){var i=t.getImageOriginalSize(e);return t.getElementSize(e).width/i.width},this.isImageFitParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width<=r.width&&n.height<=r.height},this.getElementSize=function(e){if(void 0===e)throw new Error("Can't get size, empty element");var t=e.position();return t.height=e.outerHeight(),t.width=e.outerWidth(),t.left=Math.round(t.left),t.top=Math.round(t.top),t.right=t.left+t.width,t.bottom=t.top+t.height,t},this.isElementBiggerThenParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width>r.width||n.height>r.height},this.isPointInsideElement=function(e,t){return 0!=(e.x>=0&&e.x<t.width)&&0!=(e.y>=0&&e.y<t.height)},this.getElementRelativePos=function(e,i,n,r){if(!r)r=e.parent();if("number"==typeof e)var o={width:e,height:e};else o=t.getElementSize(e);var a=t.getElementSize(r);switch(i){case"top":case"left":i=0,n&&(i+=n);break;case"center":i=Math.round((a.width-o.width)/2),n&&(i+=n);break;case"right":i=a.width-o.width,n&&(i-=n);break;case"middle":i=Math.round((a.height-o.height)/2),n&&(i+=n);break;case"bottom":i=a.height-o.height,n&&(i-=n)}return i},this.getScreenVisibleSize=function(){document.body.clientWidth,document.body.clientHeight,jQuery(document).scrollTop();var e=jQuery(document),t=e.scrollLeft(),i=e.scrollTop();t=Math.round(t);var n=(i=Math.round(i))+window.innerHeight,r=t+window.innerWidth;return{top:i,left:t,height:n-i,width:r-t,right:r,bottom:n}},this.isElementsIntersect=function(e,t){return!(e.right<t.left)&&(!(e.left>t.right)&&(!(e.bottom<t.top)&&!(e.top>t.bottom)))},this.isElementInsideScreen=function(e){var i=t.getElementSize(e),n=t.getScreenVisibleSize();return t.isElementsIntersect(n,i)},this.z_________SET_ELEMENT_PROPS_______=function(){},this.zoomImageInsideParent=function(e,i,n,r,o,a,s){if(!n)n=1.2;if(!o)o="fit";var l,u,d,_,g=n,c=e.parent(),h=t.getElementSize(e),p=t.getImageOriginalSize(e),m=!1,f=0,b=0,v=0,y=0;if(r){var I=t.getMouseElementPoint(r,e);m=t.isPointInsideElement(I,h),v=I.x,y=I.y}else m=!1;if(0==m){var w=t.getElementCenterPoint(e);v=w.x,y=w.y}if(1==i)l=h.height*g,u=h.width*g,0!=v&&(f=-(v*g-v)),0!=y&&(b=-(y*g-y));else{if(l=h.height/g,(u=h.width/g)<t.getImageInsideParentData(c,p.width,p.height,o,s).imageWidth)return t.scaleImageFitParent(e,p.width,p.height,o,s),!0;1==m&&(0!=v&&(f=-(v/g-v)),0!=y&&(b=-(y/g-y)))}if(a){var E=1;if(0!=p.width&&(E=u/p.width),E>a)return!1}if(t.setElementSize(e,u,l),0==i&&0==m){var T=t.getElementCenterPosition(e);d=T.left,_=T.top}else d=h.left+f,_=h.top+b;return t.placeElement(e,d,_),!0},this.placeElement=function(e,i,n,r,o,a){if(0==jQuery.isNumeric(i)||0==jQuery.isNumeric(n)){if(!a)a=e.parent();var s=t.getElementSize(e),l=t.getElementSize(a)}if(0==jQuery.isNumeric(i))switch(i){case"left":i=0,r&&(i+=r);break;case"center":i=Math.round((l.width-s.width)/2),r&&(i+=r);break;case"right":i=l.width-s.width,r&&(i-=r)}if(0==jQuery.isNumeric(n))switch(n){case"top":n=0,o&&(n+=o);break;case"middle":case"center":n=Math.round((l.height-s.height)/2),o&&(n+=o);break;case"bottom":n=l.height-s.height,o&&(n-=o)}var u={position:"absolute",margin:"0px"};null!==i&&(u.left=i),null!==n&&(u.top=n),e.css(u)},this.placeElementInParentCenter=function(e){t.placeElement(e,"center","middle")},this.setElementSizeAndPosition=function(e,t,i,n,r){var o={width:n+"px",height:r+"px",left:t+"px",top:i+"px",position:"absolute",margin:"0px"};e.css(o)},this.setElementSize=function(e,t,i){var n={width:t+"px"};null!=i&&(n.height=i+"px"),e.css(n)},this.cloneElementSizeAndPos=function(e,i,n,r,o){var a=e.position();if(null==a)throw new Error("Can't get size, empty element");!0===n?(a.height=e.outerHeight(),a.width=e.outerWidth()):(a.height=e.height(),a.width=e.width()),a.left=Math.round(a.left),a.top=Math.round(a.top),r&&(a.left+=r),o&&(a.top+=o),t.setElementSizeAndPosition(i,a.left,a.top,a.width,a.height)},this.placeImageInsideParent=function(e,i,n,r,o,a){var s=t.getImageInsideParentData(i,n,r,o,a),l="<img";return null!==s.imageWidth&&(l+=" width = '"+s.imageWidth+"'",s.style+="width:"+s.imageWidth+";"),null!=s.imageHeight&&("100%"==s.imageHeight?(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+";"):(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+"px;")),null!==s.imageTop&&(s.style+="top:"+s.imageTop+"px;"),null!==s.imageLeft&&(s.style+="left:"+s.imageLeft+"px;"),e=t.escapeDoubleSlash(e),l+=" style='"+s.style+"'",l+=' src="'+e+'"',l+=">",i.html(l),i.children("img")},this.scaleImageCoverParent=function(e,i,n){if("number"==typeof i)var r=i,o=n;else r=i.outerWidth(),o=i.outerHeight();var a=t.getImageOriginalSize(e),s=a.width/a.height,l=o,u=l*s,d=0,_=0;u<r?(l=(u=r)/s,_=0,d=Math.round((l-o)/2*-1)):(d=0,_=Math.round((u-r)/2*-1)),u=Math.round(u),l=Math.round(l),e.css({width:u+"px",height:l+"px",left:_+"px",top:d+"px"})},this.scaleImageFitParent=function(e,i,n,r,o){var a=e.parent(),s=t.getImageInsideParentData(a,i,n,r,o),l=!1,u={};return null!==s.imageWidth&&(l=!0,e.removeAttr("width"),u.width=s.imageWidth+"px"),null!=s.imageHeight&&(l=!0,e.removeAttr("height"),u.height=s.imageHeight+"px"),null!==s.imageTop&&(l=!0,u.top=s.imageTop+"px"),null!==s.imageLeft&&(l=!0,u.left=s.imageLeft+"px"),1==l&&(u.position="absolute",u.margin="0px 0px",e.css(u)),s},this.scaleImageByHeight=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i*a);i=Math.round(i),t.setElementSize(e,s,i)},this.scaleImageByWidth=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i/a);i=Math.round(i),t.setElementSize(e,i,s)},this.scaleImageExactSizeInParent=function(e,i,n,r,o,a){var s=e.parent(),l=t.getElementSize(s);l.width<r&&(r=l.width),l.height<o&&(o=l.height);var u,d=t.getImageInsideParentData(null,i,n,a,null,r,o),_=r,g=o,c=d.imageLeft,h=d.imageLeft,p=d.imageTop,m=d.imageTop,f=Math.round((l.width-r)/2),b=Math.round((l.height-o)/2);0!=(u=r-(d.imageWidth+c+h))&&(h+=u),0!=(u=o-(d.imageHeight+p+m))&&(m+=u),e.removeAttr("width"),e.removeAttr("height");var v={position:"absolute",margin:"0px 0px"};v.width=_+"px",v.height=g+"px",v.left=f+"px",v.top=b+"px",v["padding-left"]=c+"px",v["padding-top"]=p+"px",v["padding-right"]=h+"px",v["padding-bottom"]=m+"px",e.css(v);var y={};return y.imageWidth=_,y.imageHeight=g,y},this.showElement=function(e,t,i){e.show().fadeTo(0,1),t&&t.show().fadeTo(0,1),i&&i.show().fadeTo(0,1)},this.z_________GALLERY_RELATED_FUNCTIONS_______=function(){},this.disableButton=function(e,i){if(!i)i="ug-button-disabled";0==t.isButtonDisabled(e,i)&&e.addClass(i)},this.convertCustomPrefixOptions=function(e,t,i){if(!t)return e;var n={};return jQuery.each(e,function(e,r){if(0===e.indexOf(t+"_"+i+"_")){var o=e.replace(t+"_"+i+"_",i+"_");n[o]=r}else n[e]=r}),n},this.enableButton=function(e,i){if(!i)i="ug-button-disabled";1==t.isButtonDisabled(e,i)&&e.removeClass(i)},this.isButtonDisabled=function(e,t){if(!t)t="ug-button-disabled";return!!e.hasClass(t)},this.z_________MATH_FUNCTIONS_______=function(){},this.normalizeSetting=function(e,t,i,n,r,o){if(!o)o=!1;return r=e+(t-e)*((r-i)/(n-i)),1==o&&(r<e&&(r=e),r>t&&(r=t)),r},this.getNormalizedValue=function(e,t,i,n,r){return r=e+(n-i)*((r-e)/(t-e))},this.getDistance=function(e,t,i,n){return Math.round(Math.sqrt(Math.abs((i-e)*(i-e)+(n-t)*(n-t))))},this.getMiddlePoint=function(e,t,i,n){var r={};return r.x=e+Math.round((i-e)/2),r.y=t+Math.round((n-t)/2),r},this.getNumItemsInSpace=function(e,t,i){return Math.floor((e+i)/(t+i))},this.getNumItemsInSpaceRound=function(e,t,i){return Math.round((e+i)/(t+i))},this.getSpaceByNumItems=function(e,t,i){return e*t+(e-1)*i},this.getItemSizeInSpace=function(e,t,i){return Math.floor((e-(t-1)*i)/t)},this.getColX=function(e,t,i){return e*(t+i)},this.getColByIndex=function(e,t){return t%e},this.getColRowByIndex=function(e,t){var i=Math.floor(e/t);return{col:Math.floor(e%t),row:i}},this.getIndexByRowCol=function(e,t,i){return e<0?-1:t<0?-1:e*i+t},this.getPrevRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row-1,n.col,i)},this.getNextRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row+1,n.col,i)},this.z_________DATA_FUNCTIONS_______=function(){},this.setGlobalData=function(e,t){jQuery.data(document.body,e,t)},this.getGlobalData=function(e){return jQuery.data(document.body,e)},this.z_________EVENT_DATA_FUNCTIONS_______=function(){},this.handleScrollTop=function(e){if(0==t.isTouchDevice())return null;var n=t.getStoredEventData(e);if(null===n.scrollDir&&(Math.abs(n.diffMouseX)>15?n.scrollDir="hor":Math.abs(n.diffMouseY)>15&&Math.abs(n.diffMouseY)>Math.abs(n.diffMouseX)&&(n.scrollDir="vert",n.scrollStartY=n.lastMouseClientY,n.scrollOrigin=jQuery(document).scrollTop(),i.dataCache[e].scrollStartY=n.lastMouseClientY,i.dataCache[e].scrollOrigin=n.scrollOrigin),i.dataCache[e].scrollDir=n.scrollDir),"vert"!==n.scrollDir)return n.scrollDir;jQuery(document).scrollTop();var r=n.scrollOrigin-(n.lastMouseClientY-n.scrollStartY);return r>=0&&jQuery(document).scrollTop(r),n.scrollDir},this.wasVerticalScroll=function(e){return"vert"===t.getStoredEventData(e).scrollDir},this.storeEventData=function(e,n,r){var o=t.getMousePosition(e),a=jQuery.now(),s={startTime:a,lastTime:a,startMouseX:o.pageX,startMouseY:o.pageY,lastMouseX:o.pageX,lastMouseY:o.pageY,startMouseClientY:o.clientY,lastMouseClientY:o.clientY,scrollTop:jQuery(document).scrollTop(),scrollDir:null};r&&(s=jQuery.extend(s,r)),i.dataCache[n]=s},this.updateStoredEventData=function(e,n,r){if(!i.dataCache[n])throw new Error("updateEventData error: must have stored cache object");var o=i.dataCache[n],a=t.getMousePosition(e);o.lastTime=jQuery.now(),void 0!==a.pageX&&(o.lastMouseX=a.pageX,o.lastMouseY=a.pageY,o.lastMouseClientY=a.clientY),r&&(o=jQuery.extend(o,r)),i.dataCache[n]=o},this.getStoredEventData=function(e,t){if(!i.dataCache[e])throw new Error("updateEventData error: must have stored cache object");var n=i.dataCache[e];return n.diffMouseX=n.lastMouseX-n.startMouseX,n.diffMouseY=n.lastMouseY-n.startMouseY,n.diffMouseClientY=n.lastMouseClientY-n.startMouseClientY,n.diffTime=n.lastTime-n.startTime,!0===t?(n.startMousePos=n.lastMouseY,n.lastMousePos=n.lastMouseY,n.diffMousePos=n.diffMouseY):(n.startMousePos=n.lastMouseX,n.lastMousePos=n.lastMouseX,n.diffMousePos=n.diffMouseX),n},this.isApproveStoredEventClick=function(e,n){if(!i.dataCache[e])return!0;var r=t.getStoredEventData(e,n),o=Math.abs(r.diffMousePos);return!(r.diffTime>400)&&!(o>30)},this.clearStoredEventData=function(e){i.dataCache[e]=null},this.z_________CHECK_SUPPORT_FUNCTIONS_______=function(){},this.isCanvasExists=function(){return"function"==typeof jQuery('<canvas width="500" height="500" > </canvas>')[0].getContext},this.isScrollbarExists=function(){return window.innerWidth>document.documentElement.clientWidth},this.isTouchDevice=function(){if(-1!==i.isTouchDevice)return i.isTouchDevice;try{document.createEvent("TouchEvent"),i.isTouchDevice=!0}catch(e){i.isTouchDevice=!1}return i.isTouchDevice},this.isRgbaSupported=function(){if(-1!==i.isRgbaSupported)return i.isRgbaSupported;var e=document.getElementsByTagName("script")[0],t=e.style.color;try{e.style.color="rgba(1,5,13,0.44)"}catch(e){}var n=e.style.color!=t;return e.style.color=t,i.isRgbaSupported=n,n},this.z_________GENERAL_FUNCTIONS_______=function(){},this.checkMinJqueryVersion=function(e){for(var t=jQuery.fn.jquery.split("."),i=e.split("."),n=0,r=t.length;n<r;n++){var o=parseInt(t[n]),a=parseInt(i[n]);if(void 0===i[n])return!0;if(a>o)return!1;if(o>a)return!0}return!0},this.getCssSizeParam=function(e){return jQuery.isNumeric(e)?e+"px":e},this.convertHexToRGB=function(e,t){var i=e.replace("#","");return i===e?e:(r=parseInt(i.substring(0,2),16),g=parseInt(i.substring(2,4),16),b=parseInt(i.substring(4,6),16),result="rgba("+r+","+g+","+b+","+t+")",result)},this.timestampToString=function(e){var t=new Date(e),i=t.getDate()+"/"+t.getMonth();return i+=" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()+":"+t.getMilliseconds()},this.getArrTouches=function(e){var t=[];return e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(t=e.originalEvent.touches),t},this.getArrTouchPositions=function(e){for(var t=[],i=0;i<e.length;i++){var n={pageX:e[i].pageX,pageY:e[i].pageY};t.push(n)}return t},this.startTimeDebug=function(){i.starTime=jQuery.now()},this.showTimeDebug=function(){debugLine({"Time Passed":jQuery.now()-i.starTime},!0)},this.initProgressIndicator=function(e,i,n){switch("bar"!=e&&0==t.isCanvasExists()&&(e="bar"),e){case"bar":(r=new UGProgressBar).putHidden(n,i);break;default:case"pie":(r=new UGProgressPie).putHidden(n,i);break;case"pie2":var r;i.type_fill=!0,(r=new UGProgressPie).putHidden(n,i)}return r},this.setButtonMobileReady=function(e){e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover")}),e.on("mousedown touchend",function(e){return e.stopPropagation(),e.stopImmediatePropagation(),!1})},this.registerTheme=function(e){i.arrThemes.push(e)},this.getArrThemes=function(){return i.arrThemes},this.isThemeRegistered=function(e){return-1!==jQuery.inArray(e,i.arrThemes)},this.getFirstRegisteredTheme=function(){return 0==i.arrThemes.length?"":i.arrThemes[0]},this.isTimePassed=function(e,t){if(!t)t=100;var n=jQuery.now();0==i.timeCache.hasOwnProperty(e)?lastTime=0:lastTime=i.timeCache[e];var r=n-lastTime;return i.timeCache[e]=n,!(r<=t)},this.whenContiniousEventOver=function(e,t,n){if(!n)n=300;1==i.timeCache.hasOwnProperty(e)&&null!=i.timeCache[e]&&(clearTimeout(i.timeCache[e]),i.timeCache[e]=null),i.timeCache[e]=setTimeout(t,n)},this.validateClickTouchstartEvent=function(e){var t=!0,n=jQuery.now()-i.lastEventTime;return"click"==e&&"touchstart"==i.lastEventType&&n<1e3&&(t=!1),i.lastEventTime=jQuery.now(),i.lastEventType=e,t},this.addClassOnHover=function(e,t){if(!t)t="ug-button-hover";e.hover(function(){jQuery(this).addClass(t)},function(){jQuery(this).removeClass(t)})},this.destroyButton=function(e){e.off("mouseenter"),e.off("mouseleave"),e.off("click"),e.off("touchstart"),e.off("touchend"),e.off("mousedown"),e.off("tap")},this.setButtonOnClick=function(e,i){t.setButtonMobileReady(e),e.on("click touchstart",function(e){if(objThis=jQuery(this),e.stopPropagation(),e.stopImmediatePropagation(),0==t.validateClickTouchstartEvent(e.type))return!0;i(objThis,e)})},this.setButtonOnTap=function(e,n){e.on("tap",n),0==t.isTouchDevice()?e.on("click",function(e){var i=jQuery(this);if(0==t.validateClickTouchstartEvent(e.type))return!0;i.trigger("tap")}):(e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover"),i.lastTouchStartElement=jQuery(this),i.lastEventTime=jQuery.now()}),e.on("touchend",function(e){var t=jQuery(this);return 0==t.is(i.lastTouchStartElement)||(!i.lastEventTime||(jQuery.now()-i.lastEventTime>i.touchThreshold||void t.trigger("tap")))}))},this.loadJs=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("script");i.src=e;var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)},this.loadCss=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(i)},this.addEvent=function(e,t,i){void 0!==e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent&&e.attachEvent("on"+t,i)},this.checkImagesLoaded=function(e,t,i){var n=0,r=e.length;if(0==r&&t)return t(),!1;function o(e,o){n++,"function"==typeof i&&setTimeout(function(){i(e,o)}),n==r&&"function"==typeof t&&setTimeout(function(){t()})}setTimeout(function(){for(var t=0;t<r;t++){var i=e[t];if(void 0!==i.naturalWidth&&0!==i.naturalWidth)o(e[t],!1);else{var n=jQuery("<img/>");n.data("index",t),n.on("load",function(){var t=jQuery(this).data("index");o(e[t],!1)}),n.on("error",function(){var t=jQuery(this).data("index");o(e[t],!0)}),n.attr("src",i.src)}}})},this.waitForWidth=function(e,t){var n=e.width();if(0!=n)return t(),!1;i.handle=setInterval(function(){0!=(n=e.width())&&(clearInterval(i.handle),t())},300)},this.arrayShuffle=function(e){if("object"!=typeof e)return e;for(var t,i,n=e.length;n;t=parseInt(Math.random()*n),i=e[--n],e[n]=e[t],e[t]=i);return e},this.getObjectLength=function(e){var t=0;for(var i in e)t++;return t},this.normalizePercent=function(e){return e<0&&(e=0),e>1&&(e=1),e},this.stripTags=function(e){return e.replace(/(<([^>]+)>)/gi,"")},this.escapeDoubleSlash=function(e){return e.replace('"','"')},this.htmlentitles=function(e){return jQuery("<div/>").text(e).html()},this.z_________END_GENERAL_FUNCTIONS_______=function(){}}!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var a=t||window.event,s=l.call(arguments,1),u=0,d=0,_=0,g=0;if((t=e.event.fix(a)).type="mousewheel","detail"in a&&(_=-1*a.detail),"wheelDelta"in a&&(_=a.wheelDelta),"wheelDeltaY"in a&&(_=a.wheelDeltaY),"wheelDeltaX"in a&&(d=-1*a.wheelDeltaX),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(d=-1*_,_=0),u=0===_?d:_,"deltaY"in a&&(u=_=-1*a.deltaY),"deltaX"in a&&(d=a.deltaX,0===_&&(u=-1*d)),0!==_||0!==d){if(1===a.deltaMode){var c=e.data(this,"mousewheel-line-height");u*=c,_*=c,d*=c}else if(2===a.deltaMode){var h=e.data(this,"mousewheel-page-height");u*=h,_*=h,d*=h}return g=Math.max(Math.abs(_),Math.abs(d)),(!o||o>g)&&(o=g,n(a,g)&&(o/=40)),n(a,g)&&(u/=40,d/=40,_/=40),u=Math[u>=1?"floor":"ceil"](u/o),d=Math[d>=1?"floor":"ceil"](d/o),_=Math[_>=1?"floor":"ceil"](_/o),t.deltaX=d,t.deltaY=_,t.deltaFactor=o,t.deltaMode=0,s.unshift(t,u,d,_),r&&clearTimeout(r),r=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){o=null}function n(e,t){return d.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}var r,o,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var u=a.length;u;)e.event.fixHooks[a[--u]]=e.event.mouseHooks;var d=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",d.getLineHeight(this)),e.data(this,"mousewheel-page-height",d.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=s.length;e;)this.removeEventListener(s[--e],t,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e(t)}):"object"==typeof module&&"object"==typeof module.exports?exports=e(require("jquery")):e(jQuery)}(function(e){e.easing.jswing=e.easing.swing;var t=Math.pow,i=Math.sqrt,n=Math.sin,r=Math.cos,o=Math.PI,a=1.70158,s=1.525*a,l=2*o/3,u=2*o/4.5;function d(e){var t=7.5625,i=2.75;return e<1/i?t*e*e:e<2/i?t*(e-=1.5/i)*e+.75:e<2.5/i?t*(e-=2.25/i)*e+.9375:t*(e-=2.625/i)*e+.984375}e.extend(e.easing,{def:"easeOutQuad",swing:function(t){return e.easing[e.easing.def](t)},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return 1-(1-e)*(1-e)},easeInOutQuad:function(e){return e<.5?2*e*e:1-t(-2*e+2,2)/2},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return 1-t(1-e,3)},easeInOutCubic:function(e){return e<.5?4*e*e*e:1-t(-2*e+2,3)/2},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1-t(1-e,4)},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-t(-2*e+2,4)/2},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1-t(1-e,5)},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1-t(-2*e+2,5)/2},easeInSine:function(e){return 1-r(e*o/2)},easeOutSine:function(e){return n(e*o/2)},easeInOutSine:function(e){return-(r(o*e)-1)/2},easeInExpo:function(e){return 0===e?0:t(2,10*e-10)},easeOutExpo:function(e){return 1===e?1:1-t(2,-10*e)},easeInOutExpo:function(e){return 0===e?0:1===e?1:e<.5?t(2,20*e-10)/2:(2-t(2,-20*e+10))/2},easeInCirc:function(e){return 1-i(1-t(e,2))},easeOutCirc:function(e){return i(1-t(e-1,2))},easeInOutCirc:function(e){return e<.5?(1-i(1-t(2*e,2)))/2:(i(1-t(-2*e+2,2))+1)/2},easeInElastic:function(e){return 0===e?0:1===e?1:-t(2,10*e-10)*n((10*e-10.75)*l)},easeOutElastic:function(e){return 0===e?0:1===e?1:t(2,-10*e)*n((10*e-.75)*l)+1},easeInOutElastic:function(e){return 0===e?0:1===e?1:e<.5?-t(2,20*e-10)*n((20*e-11.125)*u)/2:t(2,-20*e+10)*n((20*e-11.125)*u)/2+1},easeInBack:function(e){return 2.70158*e*e*e-a*e*e},easeOutBack:function(e){return 1+2.70158*t(e-1,3)+a*t(e-1,2)},easeInOutBack:function(e){return e<.5?t(2*e,2)*(7.189819*e-s)/2:(t(2*e-2,2)*((s+1)*(2*e-2)+s)+2)/2},easeInBounce:function(e){return 1-d(1-e)},easeOutBounce:d,easeInOutBounce:function(e){return e<.5?(1-d(1-2*e))/2:(1+d(2*e-1))/2}})}),function(e,t){if(void 0===e.cssHooks)return!1;function i(e,t,i){var n=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=n.floor?~~e:parseFloat(e),isNaN(e)?t.def:n.mod?(e+n.mod)%n.mod:0>e?0:n.max<e?n.max:e)}function n(t){var i=l(),n=i._rgba=[];return t=t.toLowerCase(),c(s,function(e,r){var o,a=r.re.exec(t),s=a&&r.parse(a),l=r.space||"rgba";return s?(o=i[l](s),i[u[l].cache]=o[u[l].cache],n=i._rgba=o._rgba,!1):void 0}),n.length?("0,0,0,0"===n.join()&&e.extend(n,o.transparent),i):o[t]}function r(e,t,i){return 1>6*(i=(i+1)%1)?e+(t-e)*i*6:1>2*i?t:2>3*i?e+(t-e)*(2/3-i)*6:e}var o,a=/^([\-+])=\s*(\d+\.?\d*)/,s=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,n,r){return new e.Color.fn.parse(t,i,n,r)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},_=l.support={},g=e("<p>")[0],c=e.each;g.style.cssText="background-color:rgba(1,1,1,.5)",_.rgba=g.style.backgroundColor.indexOf("rgba")>-1,c(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(r,a,s,d){if(r===t)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=e(r).css(a),a=t);var _=this,g=e.type(r),h=this._rgba=[];return a!==t&&(r=[r,a,s,d],g="array"),"string"===g?this.parse(n(r)||o._default):"array"===g?(c(u.rgba.props,function(e,t){h[t.idx]=i(r[t.idx],t)}),this):"object"===g?(c(u,r instanceof l?function(e,t){r[t.cache]&&(_[t.cache]=r[t.cache].slice())}:function(t,n){var o=n.cache;c(n.props,function(e,t){if(!_[o]&&n.to){if("alpha"===e||null==r[e])return;_[o]=n.to(_._rgba)}_[o][t.idx]=i(r[e],t,!0)}),_[o]&&e.inArray(null,_[o].slice(0,3))<0&&(_[o][3]=1,n.from&&(_._rgba=n.from(_[o])))}),this):void 0},is:function(e){var t=l(e),i=!0,n=this;return c(u,function(e,r){var o,a=t[r.cache];return a&&(o=n[r.cache]||r.to&&r.to(n._rgba)||[],c(r.props,function(e,t){return null!=a[t.idx]?i=a[t.idx]===o[t.idx]:void 0})),i}),i},_space:function(){var e=[],t=this;return c(u,function(i,n){t[n.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var n=l(e),r=n._space(),o=u[r],a=0===this.alpha()?l("transparent"):this,s=a[o.cache]||o.to(a._rgba),_=s.slice();return n=n[o.cache],c(o.props,function(e,r){var o=r.idx,a=s[o],l=n[o],u=d[r.type]||{};null!==l&&(null===a?_[o]=l:(u.mod&&(l-a>u.mod/2?a+=u.mod:a-l>u.mod/2&&(a-=u.mod)),_[o]=i((l-a)*t+a,r)))}),this[r](_)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),n=i.pop(),r=l(t)._rgba;return l(e.map(i,function(e,t){return(1-n)*r[t]+n*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),n=i.pop();return t&&i.push(~~(255*n)),"#"+e.map(i,function(e){return 1===(e=(e||0).toString(16)).length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,n=e[0]/255,r=e[1]/255,o=e[2]/255,a=e[3],s=Math.max(n,r,o),l=Math.min(n,r,o),u=s-l,d=s+l,_=.5*d;return t=l===s?0:n===s?60*(r-o)/u+360:r===s?60*(o-n)/u+120:60*(n-r)/u+240,i=0===u?0:.5>=_?u/d:u/(2-d),[Math.round(t)%360,i,_,null==a?1:a]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],n=e[2],o=e[3],a=.5>=n?n*(1+i):n+i-n*i,s=2*n-a;return[Math.round(255*r(s,a,t+1/3)),Math.round(255*r(s,a,t)),Math.round(255*r(s,a,t-1/3)),o]},c(u,function(n,r){var o=r.props,s=r.cache,u=r.to,d=r.from;l.fn[n]=function(n){if(u&&!this[s]&&(this[s]=u(this._rgba)),n===t)return this[s].slice();var r,a=e.type(n),_="array"===a||"object"===a?n:arguments,g=this[s].slice();return c(o,function(e,t){var n=_["object"===a?e:t.idx];null==n&&(n=g[t.idx]),g[t.idx]=i(n,t)}),d?((r=l(d(g)))[s]=g,r):l(g)},c(o,function(t,i){l.fn[t]||(l.fn[t]=function(r){var o,s=e.type(r),l="alpha"===t?this._hsla?"hsla":"rgba":n,u=this[l](),d=u[i.idx];return"undefined"===s?d:("function"===s&&(r=r.call(this,d),s=e.type(r)),null==r&&i.empty?this:("string"===s&&((o=a.exec(r))&&(r=d+parseFloat(o[2])*("+"===o[1]?1:-1))),u[i.idx]=r,this[l](u)))})})}),l.hook=function(t){var i=t.split(" ");c(i,function(t,i){e.cssHooks[i]={set:function(t,r){var o,a,s="";if("transparent"!==r&&("string"!==e.type(r)||(o=n(r)))){if(r=l(o||r),!_.rgba&&1!==r._rgba[3]){for(a="backgroundColor"===i?t.parentNode:t;(""===s||"transparent"===s)&&a&&a.style;)try{s=e.css(a,"backgroundColor"),a=a.parentNode}catch(e){}r=r.blend(s&&"transparent"!==s?s:"_default")}r=r.toRgbaString()}try{t.style[i]=r}catch(e){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),e.cssHooks.borderColor={expand:function(e){var t={};return c(["Top","Right","Bottom","Left"],function(i,n){t["border"+n+"Color"]=e}),t}},o=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(e){e.mlp={x:0,y:0},e(function t(){try{var i=this===document?e(this):e(this).contents()}catch(e){return!1}i.mousemove(function(t){e.mlp={x:t.pageX,y:t.pageY}}),i.find("iframe").on("load",t)}),e.fn.ismouseover=function(){var t=!1;return this.eq(0).each(function(){var i=e(this).is("iframe")?e(this).contents().find("body"):e(this),n=i.offset();t=n.left<=e.mlp.x&&n.left+i.outerWidth()>e.mlp.x&&n.top<=e.mlp.y&&n.top+i.outerHeight()>e.mlp.y}),t}}(jQuery);var g_ugFunctions=new UGFunctions;function UGThumbsGeneral(){var e,t,i,n,r=this,o=jQuery(r),a=new UniteGalleryMain,s=new UGFunctions;this.type={GET_THUMBS_ALL:"all",GET_THUMBS_RATIO:"ratio",GET_THUMBS_NO_RATIO:"no_ratio",GET_THUMBS_NEW:"new"},this.events={SETOVERSTYLE:"thumbmouseover",SETNORMALSTYLE:"thumbmouseout",SETSELECTEDSTYLE:"thumbsetselected",PLACEIMAGE:"thumbplaceimage",AFTERPLACEIMAGE:"thumb_after_place_image",IMAGELOADERROR:"thumbimageloaderror",THUMB_IMAGE_LOADED:"thumb_image_loaded"};var l={thumb_width:88,thumb_height:50,thumb_fixed_size:!0,thumb_resize_by:"height",thumb_border_effect:!0,thumb_border_width:0,thumb_border_color:"#000000",thumb_over_border_width:0,thumb_over_border_color:"#d9d9d9",thumb_selected_border_width:1,thumb_selected_border_color:"#d9d9d9",thumb_round_corners_radius:0,thumb_color_overlay_effect:!0,thumb_overlay_color:"#000000",thumb_overlay_opacity:.4,thumb_overlay_reverse:!1,thumb_image_overlay_effect:!1,thumb_image_overlay_type:"bw",thumb_transition_duration:200,thumb_transition_easing:"easeOutQuad",thumb_show_loader:!0,thumb_loader_type:"dark",thumb_wrapper_as_link:!1,thumb_link_newpage:!1},u={touchEnabled:!1,num_thumbs_checking:0,customThumbs:!1,funcSetCustomThumbHtml:null,isEffectBorder:!1,isEffectOverlay:!1,isEffectImage:!1,colorOverlayOpacity:1,thumbInnerReduce:0,allowOnResize:!0,classNewThumb:"ug-new-thumb"},d="thumb_size_change";function _(e,t){var r=i[e],o="";0==u.customThumbs&&(o=" ug-thumb-generated");var a="<div class='ug-thumb-wrapper"+o+"' "+("style='z-index:"+(r.index+1)+";'")+"></div>";if(1==l.thumb_wrapper_as_link){var s=r.link;""==r.link&&(s="javascript:void(0)");var d="";1==l.thumb_link_newpage&&r.link&&(d=" target='_blank'");a="<a href='"+s+"'"+d+" class='ug-thumb-wrapper"+o+"'></a>"}var _=jQuery(a),g=r.objThumbImage;if(0==u.customThumbs){if(1==l.thumb_show_loader&&g){var c="ug-thumb-loader-dark";"bright"==l.thumb_loader_type&&(c="ug-thumb-loader-bright"),_.append("<div class='ug-thumb-loader "+c+"'></div>"),_.append("<div class='ug-thumb-error' style='display:none'></div>")}if(g){if(g.addClass("ug-thumb-image"),1==l.thumb_image_overlay_effect){var h=g.clone().appendTo(_);h.addClass("ug-thumb-image-overlay "+t).removeClass("ug-thumb-image"),h.fadeTo(0,0),r.objImageOverlay=h}_.append(g)}}return u.isEffectBorder&&_.append("<div class='ug-thumb-border-overlay'></div>"),u.isEffectOverlay&&_.append("<div class='ug-thumb-overlay'></div>"),n.append(_),u.customThumbs&&u.funcSetCustomThumbHtml(_,r),i[e].objThumbWrapper=_,_}function g(e,t,i,r){var o={width:e+"px",height:t+"px"},a={width:e-u.thumbInnerReduce+"px",height:t-u.thumbInnerReduce+"px"},s=".ug-thumb-loader, .ug-thumb-error, .ug-thumb-border-overlay, .ug-thumb-overlay";i?(!0!==r&&i.css(o),i.find(s).css(a)):(n.children(".ug-thumb-wrapper").css(o),n.find(s).css(a))}function c(e,t,i,n){if(!n)n=!1;a.isFakeFullscreen()&&(n=!0);var r=e.children(".ug-thumb-border-overlay"),o={};o["border-width"]=t+"px",0!=t&&(o["border-color"]=i),n&&!0===n?(r.css(o),0==t?r.hide():r.show()):(0==t?r.stop().fadeOut(l.thumb_transition_duration):r.show().stop().fadeIn(l.thumb_transition_duration),function(e,t){e.stop(!0).animate(t,{duration:l.thumb_transition_duration,easing:l.thumb_transition_easing,queue:!1})}(r,o))}function h(e,t,i){var n=e.children(".ug-thumb-overlay"),r=l.thumb_transition_duration;i&&!0===i&&(r=0),t?n.stop(!0).fadeTo(r,u.colorOverlayOpacity):n.stop(!0).fadeTo(r,0)}function p(e,t,i){var n=e.children("img.ug-thumb-image"),r=e.children("img.ug-thumb-image-overlay"),o=l.thumb_transition_duration;i&&!0===i&&(o=0),t?r.stop(!0).fadeTo(o,1):(n.fadeTo(0,1),r.stop(!0).fadeTo(o,0))}function m(e,t){(u.isEffectBorder&&c(e,l.thumb_selected_border_width,l.thumb_selected_border_color,t),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!1,t),o.trigger(r.events.SETSELECTEDSTYLE,e)}function f(e){1==v(e)?m(e,!0):r.setThumbNormalStyle(e,!0,"redraw")}function b(e,t,i){if(1==l.thumb_fixed_size)s.scaleImageCoverParent(t,e);else{"height"==l.thumb_resize_by?s.scaleImageByHeight(t,l.thumb_height):s.scaleImageByWidth(t,l.thumb_width);var n=s.getElementSize(t);s.placeElement(t,0,0),g(n.width,n.height,e)}e.children(".ug-thumb-loader").hide(),t.show(),0==l.thumb_image_overlay_effect?t.fadeTo(0,1):(1==l.thumb_image_overlay_effect&&function(e){var t=e.siblings(".ug-thumb-image-overlay");if(0==t.length)return!1;var i=s.getElementSize(e),n={width:i.width+"px",height:i.height+"px",left:i.left+"px",top:i.top+"px"};t.css(n),0==u.customThumbs&&t.fadeTo(0,1)}(t),t.fadeTo(0,0),f(e)),o.trigger(r.events.AFTERPLACEIMAGE,e)}function v(e){return!!e.hasClass("ug-thumb-selected")}function y(e,t){t=jQuery(t);r.getItemByThumb(t);var i=s.getElementSize(t);g(i.width,i.height,t,!0),f(t)}function I(e,t){if(!t)t=!1;var i=jQuery(e),n=i.parents(".ug-thumb-wrapper");return 0!=n.parent().length&&(objItem=r.getItemByThumb(n),(1!=objItem.isLoaded||!1!==t)&&(r.triggerImageLoadedEvent(n,i),void(1==u.customThumbs?o.trigger(r.events.PLACEIMAGE,[n,i]):b(n,i,objItem))))}function w(e,t,i){objItem=r.getItemByThumb(t),objItem.isLoaded=!0,objItem.isThumbImageLoaded=!0;var n=s.getImageOriginalSize(i);objItem.thumbWidth=n.width,objItem.thumbHeight=n.height,objItem.thumbRatioByWidth=n.width/n.height,objItem.thumbRatioByHeight=n.height/n.width,t.addClass("ug-thumb-ratio-set")}this.init=function(n,r){e=n.getObjects(),a=n,jQuery(n),t=e.g_objWrapper,i=e.g_arrItems,l=jQuery.extend(l,r),u.isEffectBorder=l.thumb_border_effect,u.isEffectOverlay=l.thumb_color_overlay_effect,u.isEffectImage=l.thumb_image_overlay_effect},this._____________EXTERNAL_SETTERS__________=function(){},this.setHtmlThumbs=function(e,t){if(n=e,1==u.isEffectImage)var i=function(){var e="",t=l.thumb_image_overlay_type.split(",");for(var i in t){var n=t[i];switch(n){case"bw":e+=" ug-bw-effect";break;case"blur":e+=" ug-blur-effect";break;case"sepia":e+=" ug-sepia-effect"}}return e}();if(!0!==t)for(var o=a.getNumItems(),s=0;s<o;s++)_(s,i);else{r.getThumbs().removeClass(u.classNewThumb);var d=a.getNewAddedItemsIndexes();jQuery.each(d,function(e,t){_(t,i).addClass(u.classNewThumb)})}},this.setThumbNormalStyle=function(e,t,i){(1==u.customThumbs&&e.removeClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_border_width,l.thumb_border_color,t),u.isEffectOverlay)&&h(e,1!=l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!0,t),o.trigger(r.events.SETNORMALSTYLE,e)},this.setThumbOverStyle=function(e){(1==u.customThumbs&&e.addClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_over_border_width,l.thumb_over_border_color),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse);1==u.isEffectImage&&p(e,!1),o.trigger(r.events.SETOVERSTYLE,e)},this.setHtmlProperties=function(e){if(!e)e=r.getThumbs();if(0==u.customThumbs){1==l.thumb_fixed_size&&g(l.thumb_width,l.thumb_height,e),function(e){if(l.thumb_round_corners_radius<=0)return!1;var t={"border-radius":l.thumb_round_corners_radius+"px"};e?(e.css(t),e.find(".ug-thumb-border-overlay").css(t)):n.find(".ug-thumb-wrapper, .ug-thumb-wrapper .ug-thumb-border-overlay").css(t)}(e)}if(e.each(function(){f(jQuery(this))}),u.isEffectOverlay&&l.thumb_overlay_color){var t={};if(s.isRgbaSupported()){var i=s.convertHexToRGB(l.thumb_overlay_color,l.thumb_overlay_opacity);t["background-color"]=i}else t["background-color"]=l.thumb_overlay_color,u.colorOverlayOpacity=l.thumb_overlay_opacity;e.find(".ug-thumb-overlay").css(t)}},this.setThumbSelected=function(e){if(1==u.customThumbs&&e.removeClass("ug-thumb-over"),1==v(e))return!0;e.addClass("ug-thumb-selected"),m(e)},this.setThumbUnselected=function(e){e.removeClass("ug-thumb-selected"),r.setThumbNormalStyle(e,!1,"set unselected")},this.setOptions=function(e){l=jQuery.extend(l,e)},this.setThumbInnerReduce=function(e){u.thumbInnerReduce=e},this.setCustomThumbs=function(e,t,i){if(u.customThumbs=!0,"function"!=typeof e)throw new Error("The argument should be function");u.funcSetCustomThumbHtml=e,-1==jQuery.inArray("overlay",t)&&(u.isEffectOverlay=!1),-1==jQuery.inArray("border",t)&&(u.isEffectBorder=!1),u.isEffectImage=!1,i&&!1===i.allow_onresize&&(u.allowOnResize=!1)},this._____________EXTERNAL_GETTERS__________=function(){},this.getOptions=function(){return l},this.getNumThumbs=function(){return i.length},this.getThumbImage=function(e){return e.find(".ug-thumb-image")},this.getThumbByIndex=function(e){var t=r.getThumbs();if(e>=t.length||e<0)throw new Error("Wrong thumb index");return jQuery(t[e])},this.getThumbs=function(e){switch(e){default:case r.type.GET_THUMBS_ALL:var t=n.children(".ug-thumb-wrapper");break;case r.type.GET_THUMBS_NO_RATIO:t=n.children(".ug-thumb-wrapper").not(".ug-thumb-ratio-set");break;case r.type.GET_THUMBS_RATIO:t=n.children(".ug-thumb-wrapper.ug-thumb-ratio-set");break;case r.type.GET_THUMBS_NEW:t=n.children("."+u.classNewThumb)}return t},this.getItemByThumb=function(e){var t=e.data("index");return void 0===t&&(t=e.index()),i[t]},this.isThumbLoaded=function(e){return r.getItemByThumb(e).isLoaded},this.getGlobalThumbSize=function(){return{width:l.thumb_width,height:l.thumb_height}},this._____________EXTERNAL_OTHERS__________=function(){},this.initEvents=function(){1==u.allowOnResize&&t.on(d,y),o.on(r.events.THUMB_IMAGE_LOADED,w),n.on("touchstart",".ug-thumb-wrapper",function(){u.touchEnabled=!0,n.off("mouseenter").off("mouseleave")}),n.on("mouseenter",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return objThumbs.off("mouseenter").off("mouseleave"),!0;0==v(e)&&r.setThumbOverStyle(e)}(jQuery(this))}),n.on("mouseleave",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return!0;0==v(e)&&r.setThumbNormalStyle(e,!1)}(jQuery(this))})},this.destroy=function(){n.off("touchstart",".ug-thumb-wrapper"),t.off(d),n.off("mouseenter",".ug-thumb-wrapper"),n.off("mouseleave",".ug-thumb-wrapper"),o.off(r.events.THUMB_IMAGE_LOADED)},this.loadThumbsImages=function(){var e=n.find(".ug-thumb-image");s.checkImagesLoaded(e,null,function(e,t){0==t?I(e,!0):function(e){var t=r.getItemByThumb(e);if(t.isLoaded=!0,t.isThumbImageLoaded=!1,1==u.customThumbs)return o.trigger(r.events.IMAGELOADERROR,e),!0;e.children(".ug-thumb-loader").hide(),e.children(".ug-thumb-error").show()}(jQuery(e).parent())})},this.triggerImageLoadedEvent=function(e,t){o.trigger(r.events.THUMB_IMAGE_LOADED,[e,t])},this.hideThumbs=function(){n.find(".ug-thumb-wrapper").hide()}}function UGThumbsStrip(){var e,t,n,r,o,a,s,l,u=this,d=new UniteGalleryMain,_=new UGFunctions,g=!1,c=new UGThumbsGeneral,h=(_=new UGFunctions,{strip_vertical_type:!1,strip_thumbs_align:"left",strip_space_between_thumbs:6,strip_thumb_touch_sensetivity:15,strip_scroll_to_thumb_duration:500,strip_scroll_to_thumb_easing:"easeOutCubic",strip_control_avia:!0,strip_control_touch:!0,strip_padding_top:0,strip_padding_bottom:0,strip_padding_left:0,strip_padding_right:0}),p={isRunOnce:!1,is_placed:!1,isNotFixedThumbs:!1,handle:null},m={stripSize:0,stripActiveSize:0,stripInnerSize:0,thumbSize:0,thumbSecondSize:0};this.events={STRIP_MOVE:"stripmove",INNER_SIZE_CHANGE:"size_change"};var f={strip_thumbs_align:"top",thumb_resize_by:"width"};function b(){var e=c.getOptions();p.isNotFixedThumbs=!1===e.thumb_fixed_size,g=h.strip_vertical_type}function v(){var t,i,n,r,_;c.setHtmlProperties(),t=a.children(".ug-thumb-wrapper"),i=jQuery(t[0]),n=i.outerWidth(),r=i.outerHeight(),_=c.getOptions(),0==g?(m.thumbSize=n,1==_.thumb_fixed_size?m.thumbSecondSize=r:m.thumbSecondSize=_.thumb_height,y(o.width()),m.stripInnerSize=a.width()):(m.thumbSize=r,1==_.thumb_fixed_size?m.thumbSecondSize=n:m.thumbSecondSize=_.thumb_width,y(o.height()),m.stripInnerSize=a.height()),function(){if(0==g){var e=m.thumbSecondSize,t={};t.height=e+"px";var i={};i.height=e+"px"}else{var n=m.thumbSecondSize,t={};t.width=n+"px";var i={};i.width=n+"px"}o.css(t),a.css(i)}(),I(),0==p.isRunOnce&&(1==h.strip_control_touch&&(l=new UGTouchThumbsControl).init(u),1==h.strip_control_avia&&(s=new UGAviaControl).init(u),P(),c.loadThumbsImages(),c.initEvents(),o.find(".ug-thumb-wrapper").on("click touchend",function(e){!function(e){if(u.isTouchMotionActive()){var t=l.isSignificantPassed();if(1==t)return!0}var i=c.getItemByThumb(e);d.selectItem(i)}(jQuery(this))}),e.on(d.events.ITEM_CHANGE,j),p.isNotFixedThumbs&&jQuery(c).on(c.events.AFTERPLACEIMAGE,x)),p.isRunOnce=!0}function y(e){m.stripSize=e,m.stripActiveSize=0==g?m.stripSize-h.strip_padding_left-h.strip_padding_right:m.stripSize-h.strip_padding_top-h.strip_padding_bottom,m.stripActiveSize<0&&(m.stripActiveSize=0)}function I(){var e,t=a.children(".ug-thumb-wrapper"),n=0,r=0;for(0==g&&(r=h.strip_padding_top),i=0;i<t.length;i++){var o=jQuery(t[i]);if(1==p.isNotFixedThumbs){if(objItem=c.getItemByThumb(o),0==objItem.isLoaded)continue;o.show()}_.placeElement(o,n,r),0==g?n+=o.outerWidth()+h.strip_space_between_thumbs:r+=o.outerHeight()+h.strip_space_between_thumbs}if(0==g)var s=n-h.strip_space_between_thumbs;else s=r-h.strip_space_between_thumbs;e=s,0==g?a.width(e):a.height(e),m.stripInnerSize=e,P(),jQuery(u).trigger(u.events.INNER_SIZE_CHANGE)}function w(e){var t=u.getInnerStripPos()+e;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function E(e){var t=-1*A(e).min;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function T(e){var t=-1*A(e).max+m.stripSize;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function S(e){if(0==C())return!1;var t,i,n=(t={},i=u.getInnerStripPos(),t.minPosThumbs=-1*i+1,t.maxPosThumbs=-1*i+m.stripSize-1,t),r=A(e);if(r.min<n.minPosThumbs){var o=e.prev();o.length?E(o):E(e)}else if(r.max>n.maxPosThumbs){var a=e.next();a.length?T(a):T(e)}}function P(){1==C()?(s&&s.enable(),l&&l.enable()):(s&&s.disable(),l&&l.disable())}function x(){clearTimeout(p.handle),p.handle=setTimeout(function(){I()},50)}function j(){var e=d.getSelectedItem();c.setThumbSelected(e.objThumbWrapper),S(e.objThumbWrapper)}function C(){return m.stripInnerSize>m.stripActiveSize}function A(e){var t={},i=e.position();return 0==g?(t.min=i.left,t.max=i.left+m.thumbSize):(t.min=i.top,t.max=i.top+m.thumbSize),t}this.setHtml=function(e){if(!e){e=n;null!=h.parent_container&&(e=h.parent_container)}e.append("<div class='ug-thumbs-strip'><div class='ug-thumbs-strip-inner'></div></div>"),o=e.children(".ug-thumbs-strip"),a=o.children(".ug-thumbs-strip-inner"),c.setHtmlThumbs(a),1==p.isNotFixedThumbs&&c.hideThumbs()},this.destroy=function(){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.off(d.events.ITEM_CHANGE),jQuery(c).off(c.events.AFTERPLACEIMAGE),l&&l.destroy(),s&&s.destroy(),c.destroy()},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(i,o){!function(i,o){t=i.getObjects(),(d=i).attachThumbsPanel("strip",u),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,h=jQuery.extend(h,o),1==(g=h.strip_vertical_type)&&(h=jQuery.extend(h,f),h=jQuery.extend(h,o),o.thumb_resize_by="width"),c.init(i,o),b()}(i,o)},this.run=function(){v()},this.positionInnerStrip=function(e,t){if(void 0===t)t=!1;if(0==g)var i={left:e+"px"};else i={top:e+"px"};0==t?(a.css(i),u.triggerStripMoveEvent()):(u.triggerStripMoveEvent(),a.stop(!0).animate(i,{duration:h.strip_scroll_to_thumb_duration,easing:h.strip_scroll_to_thumb_easing,queue:!1,progress:function(){u.triggerStripMoveEvent()},always:function(){u.triggerStripMoveEvent()}}))},this.triggerStripMoveEvent=function(){jQuery(u).trigger(u.events.STRIP_MOVE)},this.isTouchMotionActive=function(){return!!l&&l.isTouchActive()},this.isItemThumbVisible=function(e){var t=e.objThumbWrapper,i=t.position(),n=-1*u.getInnerStripPos();if(0==g)var r=n+m.stripSize,o=i.left,a=i.left+t.width();else r=n+m.stripSize,o=i.top,a=i.top+t.height();var s=!1;return a>=n&&o<=r&&(s=!0),s},this.getInnerStripPos=function(){return 0==g?a.position().left:a.position().top},this.getInnerStripLimits=function(){var e={};return e.maxPos=0==g?h.strip_padding_left:h.strip_padding_top,e.minPos=-(m.stripInnerSize-m.stripActiveSize),e},this.fixInnerStripLimits=function(e){var t=u.getInnerStripLimits();return e>t.maxPos&&(e=t.maxPos),e<t.minPos&&(e=t.minPos),e},this.scrollForeward=function(){w(-m.stripSize)},this.scrollBack=function(){w(m.stripSize)},this.________EXTERNAL_SETTERS___________=function(){},this.setOptions=function(e){h=jQuery.extend(h,e),c.setOptions(e),b()},this.setSizeVertical=function(e){if(0==g)throw new Error("setSizeVertical error, the strip size is not vertical");var t=m.thumbSecondSize,i={};i.width=t+"px",i.height=e+"px",o.css(i),y(e);var n={};n.width=t+"px",n.left="0px",n.top="0px",a.css(n),p.is_placed=!0,P()},this.setSizeHorizontal=function(e){if(1==g)throw new Error("setSizeHorizontal error, the strip size is not horizontal");var t=m.thumbSecondSize+h.strip_padding_top+h.strip_padding_bottom,i={};i.width=e+"px",i.height=t+"px",o.css(i),y(e);var n=h.strip_padding_left,r={};r.height=t+"px",r.left=n+"px",r.top="0px",a.css(r),p.is_placed=!0,P()},this.setPosition=function(e,t,i,n){_.placeElement(o,e,t,i,n)},this.resize=function(e){0==g?(o.width(e),m.stripActiveSize=e-h.strip_padding_left-h.strip_padding_right):(o.height(e),m.stripActiveSize=e-h.strip_padding_top-h.strip_padding_bottom),y(e),P(),function(){if(0==C())return!1;var e=u.getInnerStripPos(),t=u.fixInnerStripLimits(e);e!=t&&u.positionInnerStrip(t,!0)}(),function(){if(C())return!1;0==g?_.placeElement(a,h.strip_thumbs_align,0):_.placeElement(a,0,h.strip_thumbs_align)}(),function(){var e=d.getSelectedItem();if(null==e)return!0;var t=e.objThumbWrapper;t&&S(t)}(),s&&s.onResize()},this.setThumbUnselected=function(e){c.setThumbUnselected(e)},this.setCustomThumbs=function(e){c.setCustomThumbs(e)},this.________EXTERNAL_GETTERS___________=function(){},this.getObjects=function(){var t=c.getOptions(),i=jQuery.extend(h,t);return{g_gallery:d,g_objGallery:e,g_objWrapper:n,g_arrItems:r,g_objStrip:o,g_objStripInner:a,g_aviaControl:s,g_touchThumbsControl:l,isVertical:g,g_options:i,g_thumbs:c}},this.getObjThumbs=function(){return c},this.getSelectedThumb=function(){var e=d.getSelectedItemIndex();return-1==e?null:c.getThumbByIndex(e)},this.getSizeAndPosition=function(){return _.getElementSize(o)},this.getHeight=function(){return o.outerHeight()},this.getWidth=function(){return o.outerWidth()},this.getSizes=function(){return m},this.isVertical=function(){return g},this.isPlaced=function(){return p.is_placed},this.isMoveEnabled=function(){return C()}}function UGTouchThumbsControl(){var e,t,i,n,r,o,a=new UGFunctions,s={touch_portion_time:200,thumb_touch_slowFactor:0,minDeltaTime:70,minPath:10,limitsBreakAddition:30,returnAnimateSpeed:500,animationEasing:"easeOutCubic",returnAnimationEasing:"easeOutCubic"},l={touch_active:!1,loop_active:!1,mousePos:0,innerPos:0,startPos:0,startTime:0,lastTime:0,buttonReleaseTime:0,lastPos:0,lastPortionPos:0,lastDeltaTime:0,lastDeltaPos:0,speed:0,handle:"",touchEnabled:!1,isControlEnabled:!0};function u(){var e=jQuery.now(),t={};return t.passedTime=l.lastTime-l.startTime,t.lastActiveTime=e-l.buttonReleaseTime,t.passedDistance=l.lastPos-l.startPos,t.passedDistanceAbs=Math.abs(t.passedDistance),t}function d(e){return 0==o?a.getMousePosition(e).pageX:a.getMousePosition(e).pageY}function _(){var e=jQuery.now();e-l.lastTime>=s.touch_portion_time&&(l.lastDeltaTime=e-l.lastTime,l.lastDeltaTime>s.touch_portion_time&&(l.lastDeltaTime=s.touch_portion_time),l.lastDeltaPos=l.lastPos-l.lastPortionPos,l.lastPortionPos=l.lastPos,l.lastTime=e)}function g(){l.lastPos=e.getInnerStripPos(),e.triggerStripMoveEvent()}function c(t){if(0==l.loop_active)return!0;if(t){d(t);!function(){var t=s.thumb_touch_slowFactor,i=s.minDeltaTime,r=s.minPath,a=e.getInnerStripPos(),u=jQuery.now()-l.lastTime,d=a-l.lastPortionPos;u<i&&l.lastDeltaTime>0&&(u=l.lastDeltaTime,d=l.lastDeltaPos+d),u<i&&(u=i);var _=0;u>0&&(_=d/u);var c=_*_/(2*t)*(d>0?1:-1);Math.abs(c)<=r&&(c=0);var h=e.getInnerStripPos(),p=h+c,m=e.fixInnerStripLimits(p),f=e.getInnerStripLimits(),b=s.limitsBreakAddition,v=!1,y=m;if(p>f.maxPos&&(v=!0,m=b,p<b&&(m=p)),p<f.minPos){v=!0;var I=f.minPos-b;m=I,p>I&&(m=p)}var w=m-h,E=Math.abs(Math.round(_/t));if(0!=c&&(E=E*w/c),h!=m){var T={left:m+"px"};1==o&&(T={top:m+"px"}),n.animate(T,{duration:E,easing:s.animationEasing,queue:!0,progress:g})}if(1==v){var S=s.returnAnimateSpeed,P={left:y+"px"};1==o&&(P={top:y+"px"}),n.animate(P,{duration:S,easing:s.returnAnimationEasing,queue:!0,progress:g})}}()}l.loop_active=!1,l.handle=clearInterval(l.handle)}function h(e){return 0==l.isControlEnabled||(l.buttonReleaseTime=jQuery.now(),0==l.touch_active?(c(e),!0):(e.preventDefault(),l.touch_active=!1,c(e),void i.removeClass("ug-dragging")))}function p(t){if(0==l.isControlEnabled)return!0;t.preventDefault(),l.touch_active=!0;var r=d(t);n.stop(!0),function(t){var i=e.getInnerStripPos();l.mousePos=t,l.innerPos=i,l.lastPortionPos=i,l.lastDeltaTime=0,l.lastDeltaPos=0,l.startTime=jQuery.now(),l.startPos=l.innerPos,l.lastTime=l.startTime,l.lastPos=l.startPos,l.speed=0}(r),function(){if(1==l.loop_active)return!0;l.loop_active=!0,l.handle=setInterval(_,10)}(),i.addClass("ug-dragging")}function m(t){if(0==l.isControlEnabled)return!0;if(0==l.touch_active)return!0;if(t.preventDefault(),0==t.buttons)return l.touch_active=!1,c(t),!0;var i=d(t);l.lastPos=e.getInnerStripPos(),function(t){var i=l.mousePos-t,n=l.innerPos-i,r=e.getInnerStripLimits();if(n>r.maxPos){var o=n-r.maxPos;n=r.maxPos+o/3}n<r.minPos&&(o=r.minPos-n,n=r.minPos-o/3);e.positionInnerStrip(n)}(i),_()}this.enable=function(){l.isControlEnabled=!0},this.disable=function(){l.isControlEnabled=!1},this.init=function(l){e=l,t=l.getObjects(),t.g_gallery,t.g_objGallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,s.thumb_touch_slowFactor=a.normalizeSetting(5e-5,.01,1,100,r.strip_thumb_touch_sensetivity,!0),i.bind("mousedown touchstart",p),jQuery(window).add("body").bind("mouseup touchend",h),jQuery("body").bind("mousemove touchmove",m)},this.isSignificantPassed=function(){var e=u();return e.passedTime>300||e.passedDistanceAbs>30},this.isTouchActive=function(){return 1==l.touch_active||(1==n.is(":animated")||u().lastActiveTime<50)},this.destroy=function(){i.unbind("mousedown"),i.unbind("touchstart"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),jQuery("body").unbind("mousemove").unbind("touchmove")}}function UGPanelsBase(){var e,t,i,n,r,o,a,s=new UniteGalleryMain,l=this,u=new UGFunctions;function d(t,n){switch(e.orientation){case"right":case"left":var r={left:t+"px"};break;case"top":case"bottom":r={top:t+"px"}}i.stop(!0).animate(r,{duration:300,easing:"easeInOutQuad",queue:!1,complete:function(){n&&n()}})}function _(t){switch(e.orientation){case"right":case"left":u.placeElement(i,t,null);break;case"top":case"bottom":u.placeElement(i,null,t)}}function g(){r.trigger(t.events.FINISH_MOVE)}this.init=function(i,o,l,u,d){e=o,t=l,s=i,n=u,r=d,a=jQuery(s)},this.setHtml=function(r){if(i=r,"strip"==e.panelType)var a=n.strippanel_enable_handle;else a=n.gridpanel_enable_handle;if(1==a&&((o=new UGPanelHandle).init(t,i,n,e.panelType,s),o.setHtml()),!0===e.isDisabledAtStart){i.append("<div class='ug-overlay-disabled'></div>"),setTimeout(function(){i.children(".ug-overlay-disabled").hide()},e.disabledAtStartTimeout)}},this.placeElements=function(){o&&o.placeHandle()},this.initEvents=function(){o&&(o.initEvents(),a.on(s.events.SLIDER_ACTION_START,function(){o.hideHandle()}),a.on(s.events.SLIDER_ACTION_END,function(){o.showHandle()}))},this.destroy=function(){o&&(o.destroy(),a.off(s.events.SLIDER_ACTION_START),a.off(s.events.SLIDER_ACTION_END))},this.openPanel=function(n){if(!n)n=!1;return!i.is(":animated")&&(0!=e.isClosed&&(e.isClosed=!1,r.trigger(t.events.OPEN_PANEL),void(!1===n?d(e.originalPos,g):(_(e.originalPos),g()))))},this.closePanel=function(n){if(!n)n=!1;if(i.is(":animated"))return!1;if(1==e.isClosed)return!1;var o=l.getClosedPanelDest();e.isClosed=!0,r.trigger(t.events.CLOSE_PANEL),!1===n?d(o,g):(_(o),g())},this.setClosedState=function(i){e.originalPos=i,r.trigger(t.events.CLOSE_PANEL),e.isClosed=!0},this.setOpenedState=function(i){r.trigger(t.events.OPEN_PANEL),e.isClosed=!1},this.getClosedPanelDest=function(){var t,n=u.getElementSize(i);switch(e.orientation){case"left":e.originalPos=n.left,t=-e.panelWidth;break;case"right":e.originalPos=n.left,t=s.getSize().width;break;case"top":e.originalPos=n.top,t=-e.panelHeight;break;case"bottom":e.originalPos=n.top,t=s.getSize().height}return t},this.isPanelClosed=function(){return e.isClosed},this.setDisabledAtStart=function(t){if(t<=0)return!1;e.isDisabledAtStart=!0,e.disabledAtStartTimeout=t}}function UGPanelHandle(){var e,t,i,n=new UGFunctions,r={panel_handle_align:"top",panel_handle_offset:0,panel_handle_skin:0};function o(){i.removeClass("ug-button-hover")}function a(e){if(e.stopPropagation(),e.stopImmediatePropagation(),0==n.validateClickTouchstartEvent(e.type))return!0;t.isPanelClosed()?t.openPanel():t.closePanel()}this.init=function(i,n,o,a,s){switch(t=i,e=n,a){case"grid":r.panel_handle_align=o.gridpanel_handle_align,r.panel_handle_offset=o.gridpanel_handle_offset,r.panel_handle_skin=o.gridpanel_handle_skin;break;case"strip":r.panel_handle_align=o.strippanel_handle_align,r.panel_handle_offset=o.strippanel_handle_offset,r.panel_handle_skin=o.strippanel_handle_skin;break;default:throw new Error("Panel handle error: wrong panel type: "+a)}var l=s.getOptions().gallery_skin;""==r.panel_handle_skin&&(r.panel_handle_skin=l)},this.setHtml=function(){var n="ug-panel-handle-tip";switch(t.getOrientation()){case"right":n+=" ug-handle-tip-left";break;case"left":n+=" ug-handle-tip-right";break;case"bottom":n+=" ug-handle-tip-top";break;case"top":n+=" ug-handle-tip-bottom"}e.append("<div class='"+n+" ug-skin-"+r.panel_handle_skin+"'></div>"),i=e.children(".ug-panel-handle-tip")},this.initEvents=function(){n.addClassOnHover(i),i.bind("click touchstart",a),jQuery(t).on(t.events.OPEN_PANEL,function(){o(),i.removeClass("ug-button-closed")}),jQuery(t).on(t.events.CLOSE_PANEL,function(){o(),i.addClass("ug-button-closed")})},this.destroy=function(){n.destroyButton(i),jQuery(t).off(t.events.OPEN_PANEL),jQuery(t).off(t.events.CLOSE_PANEL)},this.placeHandle=function(){var e=n.getElementSize(i);!function(){switch(t.getOrientation()){case"right":case"left":"top"!=r.panel_handle_align&&"bottom"!=r.panel_handle_align&&(r.panel_handle_align="top");break;case"bottom":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="left");break;case"top":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="right")}}();var o=t.getOrientation();switch(o){case"left":n.placeElement(i,"right",r.panel_handle_align,-e.width);break;case"right":n.placeElement(i,-e.width,r.panel_handle_align,0,r.panel_handle_offset);break;case"top":n.placeElement(i,r.panel_handle_align,"bottom",r.panel_handle_offset,-e.height);break;case"bottom":n.placeElement(i,r.panel_handle_align,"top",r.panel_handle_offset,-e.height);break;default:throw new Error("Wrong panel orientation: "+o)}},this.hideHandle=function(){1==i.is(":visible")&&i.hide()},this.showHandle=function(){0==i.is(":visible")&&i.show()}}function UGStripPanel(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGThumbsStrip,d=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var _={strippanel_vertical_type:!1,strippanel_padding_top:8,strippanel_padding_bottom:8,strippanel_padding_left:0,strippanel_padding_right:0,strippanel_enable_buttons:!0,strippanel_buttons_skin:"",strippanel_padding_buttons:2,strippanel_buttons_role:"scroll_strip",strippanel_enable_handle:!0,strippanel_handle_align:"top",strippanel_handle_offset:0,strippanel_handle_skin:"",strippanel_background_color:""},g={strip_vertical_type:!0,strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:0,strippanel_padding_bottom:0},c={strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:8,strippanel_padding_bottom:8},h={panelType:"strip",panelWidth:0,panelHeight:0,isEventsInited:!1,isClosed:!1,orientation:null,originalPos:null,isFirstRun:!0};function p(){if(1==h.isFirstRun&&0==function(){if(0==_.strippanel_vertical_type){if(0==h.panelWidth)throw new Error("Strip panel error: The width not set, please set width")}else if(0==h.panelHeight)throw new Error("Strip panel error: The height not set, please set height");if(null==h.orientation)throw new Error("Wrong orientation, please set panel orientation before run");return!0}())return!1;u.run(),f(),b(),function(){if(1==h.isEventsInited)return!1;if(h.isEventsInited=!0,n)if(l.addClassOnHover(n,"ug-button-hover"),l.addClassOnHover(r,"ug-button-hover"),l.setButtonOnClick(r,y),l.setButtonOnClick(n,v),"advance_item"!=_.strippanel_buttons_role)jQuery(u).on(u.events.STRIP_MOVE,w),jQuery(u).on(u.events.INNER_SIZE_CHANGE,I),e.on(s.events.SIZE_CHANGE,I);else{var t=s.getOptions();0==t.gallery_carousel&&jQuery(s).on(s.events.ITEM_CHANGE,E)}d.initEvents()}(),h.isFirstRun=!1,I()}function m(e){if(!e)e=t;if(e.append("<div class='ug-strip-panel'></div>"),i=e.children(".ug-strip-panel"),1==_.strippanel_enable_buttons){var o="ug-strip-arrow-left",a="ug-strip-arrow-right";1==_.strippanel_vertical_type&&(o="ug-strip-arrow-up",a="ug-strip-arrow-down"),i.append("<div class='ug-strip-arrow "+o+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>"),i.append("<div class='ug-strip-arrow "+a+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>")}d.setHtml(i),u.setHtml(i),1==_.strippanel_enable_buttons&&(r=i.children("."+o),n=i.children("."+a)),""!=_.strippanel_background_color&&i.css("background-color",_.strippanel_background_color)}function f(){0==_.strippanel_vertical_type?function(){var e=u.getHeight(),t=h.panelWidth;if(n){r.height(e),n.height(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_top+_.strippanel_padding_bottom;i.width(t),i.height(s),h.panelHeight=s;var d=t-_.strippanel_padding_left-_.strippanel_padding_right;n&&(d=d-2*n.outerWidth()-2*_.strippanel_padding_buttons),u.resize(d)}():function(){var e=u.getWidth(),t=h.panelHeight;if(n){r.width(e),n.width(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_left+_.strippanel_padding_right;i.width(s),i.height(t),h.panelWidth=s;var d=t-_.strippanel_padding_top-_.strippanel_padding_bottom;n&&(d=d-2*n.outerHeight()-2*_.strippanel_padding_buttons),u.resize(d)}()}function b(){0==_.strippanel_vertical_type?function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"right","top",_.strippanel_padding_right,_.strippanel_padding_top));var e=_.strippanel_padding_left;n&&(e+=n.outerWidth()+_.strippanel_padding_buttons),u.setPosition(e,_.strippanel_padding_top)}():function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"left","bottom",_.strippanel_padding_left,_.strippanel_padding_bottom));var e=_.strippanel_padding_top;n&&(e+=n.outerHeight()+_.strippanel_padding_buttons),u.setPosition(_.strippanel_padding_left,e)}(),d.placeElements()}function v(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.nextItem():u.scrollForeward()}function y(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.prevItem():u.scrollBack()}function I(){if(!n)return!0;if(0==u.isMoveEnabled())return l.disableButton(r),l.disableButton(n),!0;var e=u.getInnerStripLimits(),t=u.getInnerStripPos();t>=e.maxPos?l.disableButton(r):l.enableButton(r),t<=e.minPos?l.disableButton(n):l.enableButton(n)}function w(){I()}function E(){s.isLastItem()?l.disableButton(n):l.enableButton(n),s.isFirstItem()?l.disableButton(r):l.enableButton(r)}this.destroy=function(){n&&(l.destroyButton(n),l.destroyButton(r),jQuery(u).off(u.events.STRIP_MOVE),jQuery(s).off(s.events.ITEM_CHANGE),jQuery(s).off(s.events.SIZE_CHANGE)),d.destroy(),u.destroy()},this.getOrientation=function(){return h.orientation},this.setOrientation=function(e){h.orientation=e},this.init=function(i,n){!function(i,n){s=i,e=jQuery(s);var r=!1;1==(_=jQuery.extend(_,n)).strippanel_vertical_type&&(_=jQuery.extend(_,g),r=!0),0==_.strippanel_enable_buttons&&(_=jQuery.extend(_,c),r=!0),1==r&&(_=jQuery.extend(_,n));var l=s.getOptions().gallery_skin;""==_.strippanel_buttons_skin&&(_.strippanel_buttons_skin=l),t=s.getElement(),d.init(s,h,o,_,a),(u=new UGThumbsStrip).init(s,_)}(i,n)},this.run=function(){p()},this.setHtml=function(e){m(e)},this.getElement=function(){return i},this.getSize=function(){return l.getElementSize(i)},this.setWidth=function(e){h.panelWidth=e},this.setHeight=function(e){h.panelHeight=e},this.resize=function(e){o.setWidth(e),f(),b()},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return d.isPanelClosed()},this.getClosedPanelDest=function(){return d.getClosedPanelDest()},this.openPanel=function(e){d.openPanel(e)},this.closePanel=function(e){d.closePanel(e)},this.setOpenedState=function(e){d.setOpenedState(e)},this.setClosedState=function(e){d.setClosedState(e)},this.setCustomThumbs=function(e){u.setCustomThumbs(e)},this.setDisabledAtStart=function(e){d.setDisabledAtStart(e)}}function UGGridPanel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGThumbsGrid,u=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var d={gridpanel_vertical_scroll:!0,gridpanel_grid_align:"middle",gridpanel_padding_border_top:10,gridpanel_padding_border_bottom:4,gridpanel_padding_border_left:10,gridpanel_padding_border_right:10,gridpanel_arrows_skin:"",gridpanel_arrows_align_vert:"middle",gridpanel_arrows_padding_vert:4,gridpanel_arrows_align_hor:"center",gridpanel_arrows_padding_hor:10,gridpanel_space_between_arrows:20,gridpanel_arrows_always_on:!1,gridpanel_enable_handle:!0,gridpanel_handle_align:"top",gridpanel_handle_offset:0,gridpanel_handle_skin:"",gridpanel_background_color:""},_={gridpanel_grid_align:"middle",gridpanel_padding_border_top:2,gridpanel_padding_border_bottom:2},g={gridpanel_grid_align:"center"},c={panelType:"grid",isHorType:!1,arrowsVisible:!1,panelHeight:0,panelWidth:0,originalPosX:null,isEventsInited:!1,isClosed:!1,orientation:null};function h(){if(null==c.orientation)throw new Error("Wrong orientation, please set panel orientation before run")}function p(){h(),"center"==d.gridpanel_grid_align&&(d.gridpanel_grid_align="middle"),l.run(),function(){var e=!1;if(1==d.gridpanel_arrows_always_on)e=!0;else{var t=l.getNumPanes();t>1&&(e=!0)}1==e?(i.show().fadeTo(0,1),n.show().fadeTo(0,1),c.arrowsVisible=!0):(i.hide(),n.hide(),c.arrowsVisible=!1)}(),function(){var e=l.getSize();1==c.isHorType?c.panelHeight=e.height+d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom:c.panelWidth=e.width+d.gridpanel_padding_border_left+d.gridpanel_padding_border_right;s.setElementSize(t,c.panelWidth,c.panelHeight)}(),function(){0==c.isHorType?1==d.gridpanel_vertical_scroll?1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"top":e=d.gridpanel_padding_border_top+a.height+d.gridpanel_arrows_padding_vert;break;case"middle":e="middle";break;case"bottom":e=c.panelHeight-u.height-a.height-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert}var _=f(),g=l.getElement();s.placeElement(g,_,e);var u=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":t=(u.top-a.height)/2,r=u.bottom+(c.panelHeight-u.bottom-a.height)/2,o=0;break;case"grid":t=u.top-a.height-d.gridpanel_arrows_padding_vert_vert,r=u.bottom+d.gridpanel_arrows_padding_vert,o=0;break;case"border":case"borders":t=d.gridpanel_padding_border_top,r="bottom",o=d.gridpanel_padding_border_bottom}s.placeElement(n,"center",t),s.placeElement(i,"center",r,0,o)}():b():1==c.arrowsVisible?function(){var e,t,r,o=s.getElementSize(n),a=l.getSize(),u=d.gridpanel_padding_border_top;switch(d.gridpanel_grid_align){case"middle":switch(d.gridpanel_arrows_align_vert){default:var _=a.height+d.gridpanel_arrows_padding_vert+o.height;u=(c.panelHeight-_)/2;break;case"border":case"borders":var g=c.panelHeight-o.height-d.gridpanel_padding_border_bottom;u=(g-a.height)/2}break;case"bottom":var _=a.height+o.height+d.gridpanel_arrows_padding_vert;u=c.panelHeight-_-d.gridpanel_padding_border_bottom}var h=l.getElement(),p=f();s.placeElement(h,p,u);var a=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":e=a.bottom+(c.panelHeight-a.bottom-o.height)/2,r=0;break;case"grid":e=a.bottom+d.gridpanel_arrows_padding_vert,r=0;break;case"border":case"borders":e="bottom",r=d.gridpanel_padding_border_bottom}t=-o.width/2-d.gridpanel_space_between_arrows/2,s.placeElement(n,"center",e,t,r);var m=Math.abs(t);s.placeElement(i,"center",e,m,r)}():b():1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left+d.gridpanel_arrows_padding_hor+a.width;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-u.width-a.width-d.gridpanel_padding_border_right-d.gridpanel_arrows_padding_hor}var _=l.getElement();switch(s.placeElement(_,e,d.gridpanel_padding_border_top),u=l.getSize(),d.gridpanel_arrows_align_vert){default:case"center":case"middle":o=(u.height-a.height)/2+u.top;break;case"top":o=d.gridpanel_padding_border_top+d.gridpanel_arrows_padding_vert;break;case"bottom":o=c.panelHeight-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert-a.height}switch(d.gridpanel_arrows_align_hor){default:case"borders":t=d.gridpanel_padding_border_left,r=c.panelWidth-d.gridpanel_padding_border_right-a.width;break;case"grid":t=u.left-d.gridpanel_arrows_padding_hor-a.width,r=u.right+d.gridpanel_arrows_padding_hor;break;case"center":t=(u.left-a.width)/2,r=u.right+(c.panelWidth-u.right-a.width)/2}s.placeElement(n,t,o),s.placeElement(i,r,o)}():function(){var e,t=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-t.width-d.gridpanel_padding_border_right}var i=l.getElement();s.placeElement(i,e,d.gridpanel_padding_border_top)}();u.placeElements()}(),function(){if(1==c.isEventsInited)return!1;c.isEventsInited=!0,n&&(s.addClassOnHover(n),l.attachPrevPaneButton(n));i&&(s.addClassOnHover(i),l.attachNextPaneButton(i));u.initEvents()}()}function m(){e.append("<div class='ug-grid-panel'></div>"),t=e.children(".ug-grid-panel"),c.isHorType?(t.append("<div class='grid-arrow grid-arrow-left-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left-hortype"),i=t.children(".grid-arrow-right-hortype")):0==d.gridpanel_vertical_scroll?(t.append("<div class='grid-arrow grid-arrow-left ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left"),i=t.children(".grid-arrow-right")):(t.append("<div class='grid-arrow grid-arrow-up ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-down ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-up"),i=t.children(".grid-arrow-down")),u.setHtml(t),n.fadeTo(0,0),i.fadeTo(0,0),l.setHtml(t),""!=d.gridpanel_background_color&&t.css("background-color",d.gridpanel_background_color)}function f(){return d.gridpanel_padding_border_left}function b(){var e=d.gridpanel_grid_align,t=0;switch(e){case"top":t=d.gridpanel_padding_border_top;break;case"bottom":t=d.gridpanel_padding_border_bottom}var i=f(),n=l.getElement();s.placeElement(n,i,e,0,t)}this.destroy=function(){n&&s.destroyButton(n),i&&s.destroyButton(i),u.destroy(),l.destroy()},this.getOrientation=function(){return c.orientation},this.setOrientation=function(e){switch(c.orientation=e,e){case"right":case"left":c.isHorType=!1;break;case"top":case"bottom":c.isHorType=!0;break;default:throw new Error("Wrong grid panel orientation: "+e)}},this.setHeight=function(e){if(1==c.isHorType)throw new Error("setHeight is not appliable to this orientatio ("+c.orientation+"). Please use setWidth");c.panelHeight=e;var t,n,r=(t=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByHeight(n)?n:(t=s.getElementSize(i).height+d.gridpanel_arrows_padding_vert,1==d.gridpanel_vertical_scroll&&(t*=2),t+=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t));l.setMaxHeight(r)},this.setWidth=function(e){if(0==c.isHorType)throw new Error("setWidth is not appliable to this orientatio ("+c.orientation+"). Please use setHeight");c.panelWidth=e;var t,n,r=(t=d.gridpanel_padding_border_left+d.gridpanel_padding_border_right,n=c.panelWidth-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByWidth(n)?n:(t+=2*(s.getElementSize(i).width+d.gridpanel_arrows_padding_hor),n=c.panelWidth-t));l.setMaxWidth(r)},this.init=function(t,i){!function(t,i){a=t,h(),i&&i.vertical_scroll&&(d.gridpanel_vertical_scroll=i.vertical_scroll),d=jQuery.extend(d,i),1==c.isHorType?(d=jQuery.extend(d,g),d=jQuery.extend(d,i)):1==d.gridpanel_vertical_scroll&&(d=jQuery.extend(d,_),(d=jQuery.extend(d,i)).grid_panes_direction="bottom");var n=a.getOptions().gallery_skin;""==d.gridpanel_arrows_skin&&(d.gridpanel_arrows_skin=n);var s=t.getObjects();e=s.g_objWrapper,u.init(a,c,r,d,o),(l=new UGThumbsGrid).init(a,d)}(t,i)},this.setHtml=function(){m()},this.run=function(){p()},this.getElement=function(){return t},this.getSize=function(){return s.getElementSize(t)},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return u.isPanelClosed()},this.getClosedPanelDest=function(){return u.getClosedPanelDest()},this.openPanel=function(e){u.openPanel(e)},this.closePanel=function(e){u.closePanel(e)},this.setOpenedState=function(e){u.setOpenedState(e)},this.setClosedState=function(e){u.setClosedState(e)},this.setDisabledAtStart=function(e){u.setDisabledAtStart(e)}}function UGThumbsGrid(){var e,t,n,r,o,a,s=this,l=jQuery(this),u=new UniteGalleryMain,d=new UGFunctions,_=new UGThumbsGeneral,g=new UGTileDesign,c={grid_panes_direction:"left",grid_num_cols:2,grid_min_cols:2,grid_num_rows:2,grid_space_between_cols:10,grid_space_between_rows:10,grid_space_between_mobile:10,grid_transition_duration:300,grid_transition_easing:"easeInOutQuad",grid_carousel:!1,grid_padding:0,grid_vertical_scroll_ondrag:!1};this.events={PANE_CHANGE:"pane_change"};var h={eventSizeChange:"thumb_size_change",isHorizontal:!1,isMaxHeight:!1,isMaxWidth:!1,gridHeight:0,gridWidth:0,innerWidth:0,innerHeight:0,numPanes:0,arrPanes:0,numThumbs:0,currentPane:0,numThumbsInPane:0,isNavigationVertical:!1,touchActive:!1,startScrollPos:0,isFirstTimeRun:!0,isTilesMode:!1,storedEventID:"thumbsgrid",tileMaxWidth:null,tileMaxHeight:null,spaceBetweenCols:null,spaceBetweenRows:null};function p(i,o,a){var l;if(t=i.getObjects(),(u=i).attachThumbsPanel("grid",s),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,!0===a&&(h.isTilesMode=!0),h.numThumbs=r.length,l=o,c=jQuery.extend(c,l),_.setOptions(l),h.isNavigationVertical="top"==c.grid_panes_direction||"bottom"==c.grid_panes_direction,h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows,1==h.isTilesMode){g.setFixedMode(),g.setApproveClickFunction(j),g.init(i,c);var d=g.getOptions();h.tileMaxHeight=d.tile_height,h.tileMaxWidth=d.tile_width,_=g.getObjThumbs()}else o.thumb_fixed_size=!0,_.init(i,o)}function m(){var t=u.getSelectedItem();(function(){if(0==h.isHorizontal){if(0==h.gridHeight)throw new Error("You must set height before run.")}else if(0==h.gridWidth)throw new Error("You must set width before run.")}(),1==h.isFirstTimeRun)?(!function(){if(0==h.isTilesMode){_.initEvents();var t=o.find(".ug-thumb-wrapper");t.on("click touchend",C),e.on(u.events.ITEM_CHANGE,z)}else g.initEvents();o.bind("mousedown touchstart",A),jQuery("body").bind("mousemove touchmove",M),jQuery(window).add("body").bind("mouseup touchend",O)}(),1==h.isTilesMode?(b(),v(),g.run()):(_.setHtmlProperties(),v(),_.loadThumbsImages())):1==h.isTilesMode&&1==b()&&(v(),g.run());if(0==h.isHorizontal?h.isNavigationVertical?function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(l);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t+=p+h.spaceBetweenCols;var f=n+m;f>r&&(r=f),++s>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=l,s=0),1==h.numPanes&&h.numThumbsInPane++,f=n+m;var b=u+h.gridHeight;f>b&&(1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(h.gridHeight),b=h.gridHeight),n=b+h.spaceBetweenRows,u=n,t=l=0,s=0,i<_-1&&(h.numPanes++,h.arrPanes.push(n)))}a.height(r),h.innerHeight=r,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(r))}():function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(s);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t>l&&(l=t);var f=n+m;f>u&&(u=f);var b=l+p;b>h.innerWidth&&(h.innerWidth=b),t+=p+h.spaceBetweenCols,++r>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=s,r=0),1==h.numPanes&&h.numThumbsInPane++,n+m>h.gridHeight&&(n=0,s=h.innerWidth+h.spaceBetweenCols,t=s,r=0,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(h.gridHeight)),i<_-1&&(h.numPanes++,h.arrPanes.push(s)))}a.width(h.innerWidth),1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(u))}():function(){var e=a.children(".ug-thumb-wrapper"),t=c.grid_padding,n=c.grid_padding,r=n,s=t,l=0,u=0,_=0,g=0,p=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(t-c.grid_padding);var m=e.length;for(i=0;i<m;i++){var f=jQuery(e[i]),b=f.outerWidth(),v=f.outerHeight();s-t+b>h.gridWidth&&(r=0,++p>=c.grid_num_rows?(p=0,t=s,r=n,_=0,1==h.numPanes&&(h.gridWidth=l+c.grid_padding,o.width(h.gridWidth),h.gridHeight=g+c.grid_padding,o.height(h.gridHeight)),h.numPanes++,h.arrPanes.push(t-c.grid_padding)):(s=t,r=_+h.spaceBetweenRows)),d.placeElement(f,s,r);var y=s+b;y>l&&(l=y);var I=r+v;I>_&&(_=I),I>g&&(g=I),I>u&&(u=I);var y=l+b;y>h.innerWidth&&(h.innerWidth=y),s+=b+h.spaceBetweenCols,1==h.numPanes&&h.numThumbsInPane++}h.innerWidth=l+c.grid_padding,h.innerHeight=g+c.grid_padding,a.width(h.innerWidth),a.height(h.innerHeight),1==h.numPanes&&(h.gridWidth=l+c.grid_padding,h.gridHeight=g+c.grid_padding,o.width(h.gridWidth),o.height(h.gridHeight))}(),1==h.isFirstTimeRun&&h.isTilesMode){var r=_.getThumbs();r.each(function(e,t){n.trigger(h.eventSizeChange,jQuery(t))}),r.fadeTo(0,1)}null!=t&&y(t.index),l.trigger(s.events.PANE_CHANGE,h.currentPane),h.isFirstTimeRun=!1}function f(){if(1==h.isTilesMode)var e=g.getGlobalTileSize();else e=_.getGlobalThumbSize();return e}function b(){if(0==h.isTilesMode)throw new Error("Dynamic size can be set only in tiles mode");var e=!1,t=u.isMobileMode(),i=h.spaceBetweenCols;1==t?(h.spaceBetweenCols=c.grid_space_between_mobile,h.spaceBetweenRows=c.grid_space_between_mobile):(h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows),h.spaceBetweenCols!=i&&(e=!0);var n=f().width,r=h.tileMaxWidth;return d.getNumItemsInSpace(h.gridWidth,h.tileMaxWidth,h.spaceBetweenCols)<c.grid_min_cols&&(r=d.getItemSizeInSpace(h.gridWidth,c.grid_min_cols,h.spaceBetweenCols)),g.setTileSizeOptions(r),r!=n&&(e=!0),e}function v(){var e,t,i;0==h.isHorizontal?(e=f().width,t=c.grid_num_cols*e+(c.grid_num_cols-1)*h.spaceBetweenCols+2*c.grid_padding,i=h.gridHeight,h.gridWidth=t,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i):function(){var e=f().height,t=h.gridWidth,i=c.grid_num_rows*e+(c.grid_num_rows-1)*h.spaceBetweenRows+2*c.grid_padding;h.gridHeight=i,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i}()}function y(e){var t=P(e);if(-1==t)return!1;s.gotoPane(t,"scroll")}function I(e){if(e>=h.numPanes||e<0)throw new Error("Pane "+index+" doesn't exists.");return!0}function w(e){var t=T(e);if(0==t)return!1;a.stop(!0).animate(t,{duration:c.grid_transition_duration,easing:c.grid_transition_easing,queue:!1})}function E(){w(-h.arrPanes[h.currentPane])}function T(e){var t={};return 1==h.isNavigationVertical?t.top=e+"px":t.left=e+"px",t}function S(){var e=d.getElementSize(a);return 1==h.isNavigationVertical?e.top:e.left}function P(e){return 0==function(e){if(e<0||e>=h.numThumbs)throw new Error("Thumb not exists: "+e);return!0}(e)?-1:Math.floor(e/h.numThumbsInPane)}function x(){var e=d.getStoredEventData(h.storedEventID),t=S();diffPos=Math.abs(e.startInnerPos-t);var i=1==h.isNavigationVertical?h.gridHeight:h.gridWidth,n=Math.round(3*i/8);return diffPos>=n||e.diffTime<300&&diffPos>25}function j(){return 1==h.numPanes||d.isApproveStoredEventClick(h.storedEventID,h.isNavigationVertical)}function C(e){if(1==function(){if(1==h.numPanes)return!1;var e=d.getStoredEventData(h.storedEventID),t=e.diffTime,i=S(),n=Math.abs(i-e.startInnerPos);return n>30||n>5&&t>300}())return!0;var t=jQuery(this),i=_.getItemByThumb(t);u.selectItem(i)}function A(e){if(1==h.numPanes)return!0;if(1==h.touchActive)return!0;0==h.isTilesMode&&e.preventDefault(),h.touchActive=!0;var t={startInnerPos:S()};d.storeEventData(e,h.storedEventID,t)}function M(e){if(0==h.touchActive)return!0;e.preventDefault(),d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(0!=c.grid_vertical_scroll_ondrag&&1!=h.isNavigationVertical&&"vert"===d.handleScrollTop(h.storedEventID))return!0;var i=t.diffMousePos,n=t.startInnerPos+i,r=i>0?"prev":"next",o=h.arrPanes[h.numPanes-1];0==c.grid_carousel&&n>0&&"prev"==r&&(n/=3),0==c.grid_carousel&&n<-o&&"next"==r&&(n=t.startInnerPos+i/3),function(e){var t=T(e);if(0==t)return!1;a.css(t)}(n)}function O(e){if(0==h.touchActive)return!0;d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(h.touchActive=!1,0==x())return E(),!0;"next"==(S()-t.startInnerPos>0?"prev":"next")?0==c.grid_carousel&&s.isLastPane()?E():s.nextPane():0==c.grid_carousel&&s.isFirstPane()?E():s.prevPane()}function z(){var e=u.getSelectedItem();_.setThumbSelected(e.objThumbWrapper),y(e.index)}this.destroy=function(){if(0==h.isTilesMode){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.on(u.events.ITEM_CHANGE),_.destroy()}else g.destroy();o.unbind("mousedown"),o.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("touchend"),jQuery(window).add("body").unbind("mouseup"),l.off(s.events.PANE_CHANGE)},this.__________EXTERNAL_GENERAL_________=function(){},this.setThumbUnselected=function(e){_.setThumbUnselected(e)},this.isItemThumbVisible=function(e){return P(e.index)==h.currentPane},this.__________EXTERNAL_API_________=function(){},this.getNumPanesEstimationByHeight=function(e){if(1==h.isTilesMode)var t=c.tile_height;else t=_.getOptions().thumb_height;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_cols),r=n*t+(n-1)*h.spaceBetweenRows;return Math.ceil(r/e)},this.getNumPanesEstimationByWidth=function(e){if(h.isTilesMode)var t=c.tile_width;else t=_.getOptions().thumb_width;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_rows),r=n*t+(n-1)*h.spaceBetweenCols;return Math.ceil(r/e)},this.getHeightEstimationByWidth=function(e){if(0==h.isTilesMode)throw new Error("This function works only with tiles mode");var t=_.getNumThumbs(),i=d.getNumItemsInSpace(e,c.tile_width,h.spaceBetweenCols),n=Math.ceil(t/i);n>c.grid_num_rows&&(n=c.grid_num_rows);var r=d.getSpaceByNumItems(n,c.tile_height,h.spaceBetweenRows);return r+=2*c.grid_padding},this.getElement=function(){return o},this.getSize=function(){return d.getElementSize(o)},this.getNumPanes=function(){return h.numPanes},this.isFirstPane=function(){return 0==h.currentPane},this.isLastPane=function(){return h.currentPane==h.numPanes-1},this.getPaneInfo=function(){return{pane:h.currentPane,total:h.numPanes}},this.getPane=function(){return h.currentPane},this.setWidth=function(e){h.gridWidth=e,h.isHorizontal=!0},this.setMaxWidth=function(e){h.gridWidth=e,h.isMaxWidth=!0,h.isHorizontal=!0},this.setHeight=function(e){h.gridHeight=e,h.isHorizontal=!1},this.setMaxHeight=function(e){h.gridHeight=e,h.isMaxHeight=!0,h.isHorizontal=!1},this.gotoPane=function(e,t){if(0==I(e))return!1;if(e==h.currentPane)return!1;var i=-h.arrPanes[e];h.currentPane=e,w(i),l.trigger(s.events.PANE_CHANGE,e)},this.nextPane=function(){var e=h.currentPane+1;if(e>=h.numPanes){if(0==c.grid_carousel)return!0;e=0}s.gotoPane(e,"next")},this.prevPane=function(){var e=h.currentPane-1;if(e<0&&(e=h.numPanes-1,0==c.grid_carousel))return!1;s.gotoPane(e,"prev")},this.attachNextPaneButton=function(e){if(d.setButtonOnClick(e,s.nextPane),1==c.grid_carousel)return!0;s.isLastPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isLastPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachPrevPaneButton=function(e){if(d.setButtonOnClick(e,s.prevPane),1==c.grid_carousel)return!0;s.isFirstPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isFirstPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachBullets=function(e){e.setActive(h.currentPane),jQuery(e).on(e.events.BULLET_CLICK,function(t,i){s.gotoPane(i,"theme"),e.setActive(i)}),jQuery(s).on(s.events.PANE_CHANGE,function(t,i){e.setActive(i)})},this.getObjTileDesign=function(){return g},this.init=function(e,t,i){p(e,t,i)},this.run=function(){m()},this.setHtml=function(e){!function(e){var t=n;e&&(t=e),t.append("<div class='ug-thumbs-grid'><div class='ug-thumbs-grid-inner'></div></div>"),o=t.children(".ug-thumbs-grid"),a=o.children(".ug-thumbs-grid-inner"),1==h.isTilesMode?g.setHtml(a):_.setHtmlThumbs(a)}(e)}}function UGTileDesign(){var e,t,i=this,n=jQuery(this),r=new UniteGalleryMain,o=new UGFunctions,a=new UGThumbsGeneral;this.resizemode={FULL:"full",WRAPPER_ONLY:"wrapper_only",VISIBLE_ELEMENTS:"visible_elements"},this.sizeby={GLOBAL_RATIO:"global_ratio",TILE_RATIO:"tile_ratio",IMAGE_RATIO:"image_ratio",CUSTOM:"custom"},this.events={TILE_CLICK:"tile_click"};var s={tile_width:250,tile_height:200,tile_size_by:i.sizeby.IMAGE_RATIO,tile_visible_before_image:!1,tile_enable_background:!0,tile_background_color:"#F0F0F0",tile_enable_border:!1,tile_border_width:3,tile_border_color:"#F0F0F0",tile_border_radius:0,tile_enable_outline:!1,tile_outline_color:"#8B8B8B",tile_enable_shadow:!1,tile_shadow_h:1,tile_shadow_v:1,tile_shadow_blur:3,tile_shadow_spread:2,tile_shadow_color:"#8B8B8B",tile_enable_action:!0,tile_as_link:!1,tile_link_newpage:!0,tile_enable_overlay:!0,tile_overlay_opacity:.4,tile_overlay_color:"#000000",tile_enable_icons:!0,tile_show_link_icon:!1,tile_videoplay_icon_always_on:"never",tile_space_between_icons:26,tile_enable_image_effect:!1,tile_image_effect_type:"bw",tile_image_effect_reverse:!1,tile_enable_textpanel:!1,tile_textpanel_source:"title",tile_textpanel_always_on:!1,tile_textpanel_appear_type:"slide",tile_textpanel_position:"inside_bottom",tile_textpanel_offset:0},l={thumb_color_overlay_effect:!0,thumb_overlay_reverse:!0,thumb_image_overlay_effect:!1,tile_textpanel_enable_description:!1,tile_textpanel_bg_opacity:.6,tile_textpanel_padding_top:8,tile_textpanel_padding_bottom:8},u={ratioByHeight:0,ratioByWidth:0,eventSizeChange:"thumb_size_change",funcCustomTileHtml:null,funcCustomPositionElements:null,funcParentApproveClick:null,isSaparateIcons:!1,tileInnerReduce:0,isTextpanelOutside:!1,hasImageContainer:!1,isVideoplayIconAlwaysOn:!1,isTextPanelHidden:!1};function d(e,n){r=e,jQuery(e);var d=r.getObjects();t=d.g_objWrapper,r.getArrItems(),s=jQuery.extend(s,l),s=jQuery.extend(s,n),function(){1==s.tile_enable_overlay?(s.thumb_overlay_opacity=s.tile_overlay_opacity,s.thumb_overlay_color=s.tile_overlay_color):0==s.tile_enable_icons?s.thumb_color_overlay_effect=!1:s.thumb_overlay_opacity=0;s.tile_as_link&&(s.thumb_wrapper_as_link=!0,s.thumb_link_newpage=s.tile_link_newpage);1==s.tile_enable_outline&&0==s.tile_enable_border&&(s.tile_enable_outline=!1);u.tileInnerReduce=0,s.tile_enable_border&&(u.tileInnerReduce=2*s.tile_border_width,a.setThumbInnerReduce(u.tileInnerReduce));if(u.isSaparateIcons=!o.isRgbaSupported(),1==s.tile_enable_textpanel){switch(s.tile_textpanel_position){case"top":s.tile_textpanel_align="top";case"bottom":u.isTextpanelOutside=!0,s.tile_textpanel_always_on=!0,s.tile_textpanel_offset=0;break;case"inside_top":s.tile_textpanel_align="top";break;case"middle":s.tile_textpanel_align="middle",s.tile_textpanel_appear_type="fade"}0==s.tile_textpanel_always_on&&(u.isSaparateIcons=!0)}0!=s.tile_textpanel_offset&&(s.tile_textpanel_appear_type="fade",s.tile_textpanel_margin=s.tile_textpanel_offset);"title_and_desc"==s.tile_textpanel_source&&(s.tile_textpanel_enable_description=!0,s.tile_textpanel_desc_style_as_title=!0)}(),a.init(e,s);var _=["overlay"];u.funcCustomTileHtml&&(_=[]),a.setCustomThumbs(g,_,{allow_onresize:!1});var c=a.getOptions();s=jQuery.extend(s,c),u.ratioByWidth=s.tile_width/s.tile_height,u.ratioByHeight=s.tile_height/s.tile_width,s.tile_size_by==i.sizeby.GLOBAL_RATIO&&u.isTextpanelOutside&&(u.hasImageContainer=!0)}function _(){var e=r.isMobileMode();switch(u.isTextPanelHidden=!1,1==e&&0==s.tile_textpanel_always_on&&(u.isTextPanelHidden=!0),u.isVideoplayIconAlwaysOn=s.tile_videoplay_icon_always_on,s.tile_videoplay_icon_always_on){case"always":u.isVideoplayIconAlwaysOn=!0;break;case"never":u.isVideoplayIconAlwaysOn=!1;break;case"mobile_only":u.isVideoplayIconAlwaysOn=1==e;break;case"desktop_only":u.isVideoplayIconAlwaysOn=0==e}}function g(e,t){if(e.addClass("ug-tile"),u.funcCustomTileHtml)return u.funcCustomTileHtml(e,t),!1;var n="";1==u.hasImageContainer&&(n+="<div class='ug-image-container ug-trans-enabled'>");var a="ug-thumb-image";0!=s.tile_enable_image_effect&&1!=s.tile_image_effect_reverse||(a+=" ug-trans-enabled");var l=o.stripTags(t.title);l=o.htmlentitles(l),n+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+l+"' class='"+a+"'>",1==u.hasImageContainer&&(n+="</div>"),e.append(n),s.tile_size_by==i.sizeby.GLOBAL_RATIO&&e.fadeTo(0,0);var d={};if(1==s.tile_enable_background&&(d["background-color"]=s.tile_background_color),1==s.tile_enable_border&&(d["border-width"]=s.tile_border_width+"px",d["border-style"]="solid",d["border-color"]=s.tile_border_color,s.tile_border_radius&&(d["border-radius"]=s.tile_border_radius+"px")),1==s.tile_enable_outline&&(d.outline="1px solid "+s.tile_outline_color),1==s.tile_enable_shadow){var _=s.tile_shadow_h+"px ";_+=s.tile_shadow_v+"px ",_+=s.tile_shadow_blur+"px ",_+=s.tile_shadow_spread+"px ",_+=s.tile_shadow_color,d["box-shadow"]=_}e.css(d);var g="";if(s.tile_enable_icons){if(0==s.tile_as_link&&1==s.tile_enable_action){var c="ug-button-play ug-icon-zoom";"image"!=t.type&&(c="ug-button-play ug-icon-play"),g+="<div class='ug-tile-icon "+c+"' style='display:none'></div>"}if(t.link&&1==s.tile_show_link_icon||1==s.tile_as_link)if(0==s.tile_as_link){var h="";1==s.tile_link_newpage&&(h=" target='_blank'"),g+="<a href='"+t.link+"'"+h+" class='ug-tile-icon ug-icon-link'></a>"}else g+="<div class='ug-tile-icon ug-icon-link' style='display:none'></div>";var m=u.isSaparateIcons;if(0==m&&"image"!=t.type&&1==u.isVideoplayIconAlwaysOn&&(m=!0),m)var f=e;else f=e.children(".ug-thumb-overlay");f.append(g);var b=f.children("."+c);0==b.length?b=null:b.hide();var v=f.children(".ug-icon-link");0==v.length?v=null:v.hide(),v||1!=s.tile_enable_action||e.addClass("ug-tile-clickable")}else 1==s.tile_enable_action&&e.addClass("ug-tile-clickable");if(1==s.tile_enable_image_effect){var y="";0==s.tile_image_effect_reverse&&(y=" ug-trans-enabled");var I="<div class='ug-tile-image-overlay"+y+"' >",w=" ug-"+s.tile_image_effect_type+"-effect";I+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+t.title+"' class='"+w+y+"'>",I+="</div>",e.append(I),1==s.tile_image_effect_reverse&&e.children(".ug-tile-image-overlay").fadeTo(0,0)}if(1==s.tile_enable_textpanel){var E=new UGTextPanel;E.init(r,s,"tile");var T="";1!=s.tile_textpanel_always_on&&1!=u.isTextpanelOutside||(T="ug-trans-enabled"),E.appendHTML(e,T);var S=t.title,P="";switch(s.tile_textpanel_source){case"desc":case"description":S=t.description;break;case"desc_title":""!=t.description&&(S=t.description);break;case"title_and_desc":S=t.title,P=t.description}if(E.setTextPlain(S,P),0==s.tile_textpanel_always_on&&E.getElement().fadeTo(0,0),e.data("objTextPanel",E),1==s.tile_textpanel_always_on)p(e).css("z-index",2);if(1==u.isTextpanelOutside){e.append("<div class='ug-tile-cloneswrapper'></div>");var x=e.children(".ug-tile-cloneswrapper"),j=new UGTextPanel;j.init(r,s,"tile"),j.appendHTML(x),j.setTextPlain(S,P),e.data("objTextPanelClone",j)}}null!==t.addHtml&&e.append(t.addHtml)}function c(e){return e.children(".ug-tile-image-overlay")}function h(e){return e.data("objTextPanel")}function p(e){return e.children(".ug-textpanel")}function m(e){if(1==u.isTextpanelOutside)var t=function(e){var t=e.find(".ug-tile-cloneswrapper .ug-textpanel");if(0==t.length)throw new Error("text panel cloned element not found");return t}(e);else t=p(e);return t?o.getElementSize(t).height:0}function f(e){var t=e.find(".ug-icon-link");return 0==t.length?null:t}function b(e){var t=e.find(".ug-button-play");return 0==t.length?null:t}function v(e){return!!e.hasClass("ug-thumb-over")}function y(e){return e.hasClass("ug-tile-clickable")}function I(e){return 1==s.tile_enable_icons&&1==u.isVideoplayIconAlwaysOn&&"image"!=e.type}function w(e,t,n,r){var a=c(e),l=i.getTileImage(e),d=function(e){return e.find(".ug-tile-image-overlay img")}(e);t-=u.tileInnerReduce,n-=u.tileInnerReduce;var _=null;if(1==u.isTextpanelOutside){var g=m(e);if(n-=g,"top"==s.tile_textpanel_position&&(_=g),1==u.hasImageContainer){var h=function(e){return 0==u.hasImageContainer?null:e.children(".ug-image-container")}(e);o.setElementSize(h,t,n),null!==_&&o.placeElement(h,0,_)}}if(0==s.tile_enable_image_effect)o.scaleImageCoverParent(l,t,n),0==u.hasImageContainer&&null!==_&&o.placeElement(l,0,_);else{var p="nothing";!0===r&&0==u.isTextpanelOutside&&(p=1==s.tile_image_effect_reverse?"effect":"image"),"effect"!=p&&(o.setElementSize(a,t,n),null!==_&&o.placeElement(a,0,_),o.scaleImageCoverParent(d,t,n)),"image"!=p&&(1==u.hasImageContainer?o.scaleImageCoverParent(l,t,n):"effect"==p?(o.scaleImageCoverParent(l,t,n),null!==_&&o.placeElement(l,0,_)):o.cloneElementSizeAndPos(d,l,!1,null,_))}}function E(e,t,n,r){var o=null;if(n&&(o=n-u.tileInnerReduce),r&&(r-=u.tileInnerReduce),"clone"==t)return function(e){return e.data("objTextPanelClone")}(e).refresh(!0,!0,o),i.getItemByTile(e).textPanelCloneSizeSet=!0,!1;var a=h(e);if(!a)return!1;var l=null;if(1==u.isTextpanelOutside&&(l=m(e)),a.refresh(!1,!0,o,l),1==s.tile_textpanel_always_on||"fade"==s.tile_textpanel_appear_type)if(1==u.isTextpanelOutside&&r&&"bottom"==s.tile_textpanel_position){var d=r-l;a.positionPanel(d)}else a.positionPanel()}function T(e){i.getItemByTile(e);var t=b(e),n=f(e),r=o.getElementSize(e);w(e,r.width,r.height),1==s.tile_enable_textpanel&&E(e,"regular",r.width,r.height);var a=r.width-u.tileInnerReduce,l=r.height-u.tileInnerReduce,d=0;if(1==u.isTextpanelOutside){var _=m(e);l-=_,"top"==s.tile_textpanel_position&&(d=_)}var g=function(e){return e.children(".ug-thumb-overlay")}(e);if(o.setElementSizeAndPosition(g,0,d,a,l),t||n){var c=0;if(1==s.tile_enable_textpanel&&0==u.isTextPanelHidden&&0==u.isTextpanelOutside){var h=p(e),v=o.getElementSize(h);v.height>0&&(c=Math.floor(v.height/2*-1))}}if(t&&n){var y=o.getElementSize(t),I=o.getElementSize(n),T=s.tile_space_between_icons,S=y.width+T+I.width,P=Math.floor((r.width-S)/2);P<T&&(T=Math.floor((r.width-y.width-I.width)/3),S=y.width+T+I.width,P=Math.floor((r.width-S)/2)),o.placeElement(t,P,"middle",0,c),o.placeElement(n,P+y.width+T,"middle",0,c)}else t&&o.placeElement(t,"center","middle",0,c),n&&o.placeElement(n,"center","middle",0,c);t&&t.show(),n&&n.show()}function S(e,t){i.getItemByTile(e);var n=c(e),r=s.thumb_transition_duration;if(0==s.tile_image_effect_reverse){var o=i.getTileImage(e);t?(o.fadeTo(0,1),n.stop(!0).fadeTo(r,0)):n.stop(!0).fadeTo(r,1)}else t?n.stop(!0).fadeTo(r,1):n.stop(!0).fadeTo(r,0)}function P(e,t){var i=s.thumb_transition_duration,n=p(e);if(!n)return!0;if("slide"==s.tile_textpanel_appear_type){var r=o.getElementSize(n);if(0==r.width)return!1;var a=-r.height,l={},u={},d="bottom";"inside_top"==s.tile_textpanel_position&&(d="top"),l[d]=a+"px",u[d]="0px",1==t?(n.fadeTo(0,1),0==n.is(":animated")&&n.css(l),u.opacity=1,n.stop(!0).animate(u,i)):n.stop(!0).animate(l,i)}else 1==t?n.stop(!0).fadeTo(i,1):n.stop(!0).fadeTo(i,0)}function x(e,t,i){var n=s.thumb_transition_duration;i&&!0===i&&(n=0);var r=b(e),o=f(e),a=t?1:0;r&&r.stop(!0).fadeTo(n,a),o&&o.stop(!0).fadeTo(n,a)}function j(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!0),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&0==u.isTextPanelHidden&&P(t,!0),u.isSaparateIcons&&1==s.tile_enable_icons){var n=1==s.thumb_overlay_reverse;0==I(i.getItemByTile(t))&&x(t,n,!1)}}function C(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!1),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&P(t,!1),1==u.isSaparateIcons&&1==s.tile_enable_icons){var n=1!=s.thumb_overlay_reverse;0==I(i.getItemByTile(t))?x(t,n,!1):x(t,!0,!0)}}function A(e,t,i){if(t=jQuery(t),1==s.tile_visible_before_image&&!0!==t.data("image_placed")&&!0!==i)return!0;T(t),a.setThumbNormalStyle(t)}function M(e,t,i){T(t),i.fadeTo(0,1),t.data("image_placed",!0)}function O(e){if(1==y(e))return n.trigger(i.events.TILE_CLICK,e),!0;var t;0==v(e)&&(t=e,a.getThumbs().not(t).each(function(e,t){a.setThumbNormalStyle(jQuery(t))}),a.setThumbOverStyle(e))}function z(e){var t=jQuery(this),r=t.prop("tagName").toLowerCase(),o=!0;if(u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(o=!1),"a"==r)0==o&&e.preventDefault();else if(0==v(t))1==o&&O(t);else{if(0==y(t))return!0;1==o&&n.trigger(i.events.TILE_CLICK,t)}}function L(e){e.stopPropagation();var t=jQuery(this).parents(".ug-tile"),r=!0;return u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(r=!1),0==v(t)?(O(t),!0):1==r?(n.trigger(i.events.TILE_CLICK,t),!1):void 0}function N(e){var t=jQuery(this).parents(".ug-tile");u.funcParentApproveClick&&0==u.funcParentApproveClick()&&e.preventDefault(),0==v(t)&&0==s.tile_as_link&&(e.preventDefault(),O(t))}this.loadTileImage=function(e){var t=i.getTileImage(e);o.checkImagesLoaded(t,null,function(t,i){M(null,e,jQuery(t))})},this.setHtml=function(t,i){e=t,!0!==i&&_(),a.setHtmlThumbs(t,i)},this.initEvents=function(){a.initEvents(),jQuery(a).on(a.events.SETOVERSTYLE,j),jQuery(a).on(a.events.SETNORMALSTYLE,C),jQuery(a).on(a.events.PLACEIMAGE,M),t.on(u.eventSizeChange,A),e.on("click",".ug-tile",z),e.on("click",".ug-tile .ug-button-play",L),e.on("click",".ug-tile .ug-icon-link",N)},this.destroy=function(){if(e.off("click",".ug-tile"),e.off("click",".ug-tile .ug-button-play"),e.off("click",".ug-tile .ug-icon-link"),jQuery(a).off(a.events.SETOVERSTYLE),jQuery(a).off(a.events.SETNORMALSTYLE),jQuery(a).off(a.events.PLACEIMAGE),t.off(u.eventSizeChange),1==s.tile_enable_textpanel){var i=a.getThumbs();jQuery.each(i,function(e,t){var i=h(jQuery(t));i&&i.destroy()})}a.destroy()},this.init=function(e,t,i){d(e,t)},this.setFixedMode=function(){s.tile_size_by=i.sizeby.GLOBAL_RATIO,s.tile_visible_before_image=!0},this.setApproveClickFunction=function(e){u.funcParentApproveClick=e},this.resizeTile=function(e,t,n,r){if(1==u.isTextpanelOutside&&E(e,"clone",t),t){if(!n)n=i.getTileHeightByWidth(t,e)}else{t=s.tile_width;var n=s.tile_height}switch(o.setElementSize(e,t,n),r){default:case i.resizemode.FULL:i.triggerSizeChangeEvent(e,!0);break;case i.resizemode.WRAPPER_ONLY:return!0;case i.resizemode.VISIBLE_ELEMENTS:if(u.funcCustomTileHtml)return i.triggerSizeChangeEvent(e,!0),!0;w(e,t,n,!0),1==s.tile_enable_textpanel&&1==s.tile_textpanel_always_on&&t&&E(e,"regular",t,n)}},this.resizeAllTiles=function(e,t,n){_();var r=null;if(s.tile_size_by==i.sizeby.GLOBAL_RATIO&&(r=i.getTileHeightByWidth(e)),!n)n=a.getThumbs();n.each(function(n,o){i.resizeTile(jQuery(o),e,r,t)})},this.triggerSizeChangeEvent=function(e,i){if(!e)return!1;if(!i)i=!1;t.trigger(u.eventSizeChange,[e,i])},this.triggerSizeChangeEventAllTiles=function(e){a.getThumbs().each(function(){var t=jQuery(this);i.triggerSizeChangeEvent(t,e)})},this.disableEvents=function(){a.getThumbs().css("pointer-events","none")},this.enableEvents=function(){a.getThumbs().css("pointer-events","auto")},this.setOptions=function(e){s=jQuery.extend(s,e),a.setOptions(e)},this.setTileSizeOptions=function(e){if(s.tile_size_by!==i.sizeby.GLOBAL_RATIO)throw new Error("setNewTileOptions works with global ration only");s.tile_width=e,s.tile_height=Math.floor(e*u.ratioByHeight)},this.setCustomFunctions=function(e,t){u.funcCustomTileHtml=e,u.funcCustomPositionElements=t},this.run=function(e){var t=a.type.GET_THUMBS_ALL;!0===e&&(t=a.type.GET_THUMBS_NEW);var n=a.getThumbs(t);s.tile_size_by==i.sizeby.GLOBAL_RATIO&&i.resizeAllTiles(s.tile_width,i.resizemode.WRAPPER_ONLY,n),1==s.tile_enable_image_effect&&0==s.tile_image_effect_reverse&&n.children(".ug-thumb-image").fadeTo(0,0),a.setHtmlProperties(n),1==s.tile_visible_before_image&&(n.children(".ug-thumb-image").fadeTo(0,0),a.loadThumbsImages())},this._____________EXTERNAL_GETTERS____________=function(){},this.getObjThumbs=function(){return a},this.getOptions=function(){return s},this.getTileImage=function(e){return e.find("img.ug-thumb-image")},this.getItemByTile=function(e){return a.getItemByThumb(e)},this.getTileHeightByWidth=function(e,t){var n=function(e){var t=u.ratioByHeight;switch(s.tile_size_by){default:t=u.ratioByHeight;break;case i.sizeby.IMAGE_RATIO:if(!e)throw new Error("tile should be given for tile ratio");var n=i.getItemByTile(e);if(void 0!==n.thumbRatioByHeight){if(0==n.thumbRatioByHeight)throw trace(n),new Error("the item ratio not inited yet");t=n.thumbRatioByHeight}break;case i.sizeby.CUSTOM:return null}return t}(t);if(null===n)return null;var r=Math.floor((e-u.tileInnerReduce)*n)+u.tileInnerReduce;return t&&1==u.isTextpanelOutside&&s.tile_size_by==i.sizeby.IMAGE_RATIO&&(r+=m(t)),r},this.getTileImageSize=function(e){var t=i.getItemByTile(e);if(!t.thumbWidth||!t.thumbHeight)throw new Error("Can't get image size - image not inited.");return{width:t.thumbWidth,height:t.thumbHeight}},this.getGlobalTileSize=function(){if(s.tile_size_by!=i.sizeby.GLOBAL_RATIO)throw new Error("The size has to be global ratio");return{width:s.tile_width,height:s.tile_height}}}function UGTiles(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGTileDesign,d=new UGThumbsGeneral,_={},g={tiles_type:"columns",tiles_col_width:250,tiles_align:"center",tiles_exact_width:!1,tiles_space_between_cols:3,tiles_space_between_cols_mobile:3,tiles_include_padding:!0,tiles_min_columns:2,tiles_max_columns:0,tiles_keep_order:!1,tiles_set_initial_height:!0,tiles_justified_row_height:150,tiles_justified_space_between:3,tiles_nested_optimal_tile_width:250,tiles_nested_col_width:null,tiles_nested_debug:!1,tiles_enable_transition:!0};this.events={THUMB_SIZE_CHANGE:"thumb_size_change",TILES_FIRST_PLACED:"tiles_first_placed",ALL_TILES_LOADED:"all_tiles_loaded"};var c={isFirstTimeRun:!0,handle:null,isTransActive:!1,isTransInited:!1,isFirstPlaced:!0,isAllLoaded:!1},h={colWidth:null,nestedOptimalCols:5,gridY:0,maxColumns:0,columnsValueToEnableHeightResize:3,resizeLeftRightToColumn:!0,currentItem:0,currentGap:null,optimalTileWidth:null,maxGridY:0};function p(i,n){g_objects=i.getObjects(),s=i,e=jQuery(i),t=g_objects.g_objWrapper,g_objects.g_arrItems,g=jQuery.extend(g,n),function(){g.tiles_min_columns<1&&(g.tiles_min_columns=1);0!=g.tiles_max_columns&&g.tiles_max_columns<g.tiles_min_columns&&(g.tiles_max_columns=g.tiles_min_columns)}(),u.init(i,g),d=u.getObjThumbs()}function m(){if(i.addClass("ug-tiles-rest-mode"),c.isTransInited=!0,1==g.tiles_enable_transition){i.addClass("ug-tiles-transit");var e=u.getOptions();1==e.tile_enable_image_effect&&0==e.tile_image_effect_reverse&&i.addClass("ug-tiles-transit-overlays"),c.isTransActive=!0}}function f(){return l.getElementSize(i).width}function b(){return 0!=c.isTransInited&&(i.addClass("ug-tiles-transition-active"),i.removeClass("ug-tiles-rest-mode"),0!=c.isTransActive&&void u.disableEvents())}function v(){if(0==c.isTransInited)return!1;i.removeClass("ug-tiles-transition-active"),i.addClass("ug-tiles-rest-mode")}function y(){1==c.isTransActive?(setTimeout(function(){u.enableEvents(),u.triggerSizeChangeEventAllTiles(),v()},800),c.handle&&clearTimeout(c.handle),c.handle=setTimeout(function(){v(),u.triggerSizeChangeEventAllTiles(),c.handle=null},2e3)):(u.triggerSizeChangeEventAllTiles(),v())}function I(){_.colWidth=(_.availWidth-_.colGap*(_.numCols-1))/_.numCols,_.colWidth=Math.floor(_.colWidth),_.totalWidth=l.getSpaceByNumItems(_.numCols,_.colWidth,_.colGap)}function w(){if(_.colWidth=g.tiles_col_width,_.minCols=g.tiles_min_columns,_.maxCols=g.tiles_max_columns,0==s.isMobileMode()?_.colGap=g.tiles_space_between_cols:_.colGap=g.tiles_space_between_cols_mobile,_.galleryWidth=f(),_.availWidth=_.galleryWidth,1==g.tiles_include_padding&&(_.availWidth=_.galleryWidth-2*_.colGap),1==g.tiles_exact_width)_.numCols=l.getNumItemsInSpace(_.availWidth,_.colWidth,_.colGap),_.maxCols>0&&_.numCols>_.maxCols&&(_.numCols=_.maxCols),_.numCols<_.minCols?(_.numCols=_.minCols,I()):_.totalWidth=_.numCols*(_.colWidth+_.colGap)-_.colGap;else{var e=l.getNumItemsInSpaceRound(_.availWidth,_.colWidth,_.colGap);e<_.minCols?e=_.minCols:0!=_.maxCols&&e>_.maxCols&&(e=_.maxCols),_.numCols=e,I()}switch(g.tiles_align){case"center":default:_.addX=Math.round((_.galleryWidth-_.totalWidth)/2);break;case"left":_.addX=0;break;case"right":_.addX=_.galleryWidth-_.totalWidth}for(_.arrPosx=[],col=0;col<_.numCols;col++){var t=l.getColX(col,_.colWidth,_.colGap);_.arrPosx[col]=t+_.addX}}function E(){_.maxColHeight=0,_.colHeights=[0]}function T(e,t,n,r){if(null==r)r=function(){var e=0,t=999999999;for(col=0;col<_.numCols;col++){if(null==_.colHeights[col]||0==_.colHeights[col])return col;_.colHeights[col]<t&&(e=col,t=_.colHeights[col])}return e}();var o=0;void 0!==_.colHeights[r]&&(o=_.colHeights[r]);var a=u.getTileHeightByWidth(_.colWidth,e);if(null===a){if(1==g.tiles_enable_transition)throw new Error("Can't know tile height, please turn off transition");a=l.getElementSize(e).height}var s=_.arrPosx[r];l.placeElement(e,s,o);var d=o+a;_.colHeights[r]=d+_.colGap,_.maxColHeight<d&&(_.maxColHeight=d),1==t&&e.show().fadeTo(0,1),1==n&&i.height(_.maxColHeight)}function S(e){e||(e=!1),w(),E();var t=d.getThumbs(d.type.GET_THUMBS_RATIO);b(),u.resizeAllTiles(_.colWidth,u.resizemode.VISIBLE_ELEMENTS,t);for(var n=0;n<t.length;n++){var r=jQuery(t[n]),o=void 0;1==g.tiles_keep_order&&(o=l.getColByIndex(_.numCols,n)),T(r,e,!1,o)}y();var a=i.height();1==c.isTransActive&&a>_.maxColHeight?setTimeout(function(){i.height(_.maxColHeight)},700):i.height(_.maxColHeight)}function P(e,t){if(!0!==t&&0==function(e){var t=e.index();if(!0===s.getItem(t).ordered_placed)return!1;var i=l.getPrevRowSameColIndex(t,_.numCols);return i<0||!0===s.getItem(i).ordered_placed}(e))return!1;var i=e.index(),n=l.getColByIndex(_.numCols,i),r=s.getItem(i);u.resizeTile(e,_.colWidth),T(e,!0,!0,n),r.ordered_placed=!0;var o=s.getNumItems(),a=l.getNextRowSameColIndex(i,_.numCols);if(a>=o)return!1;var g=d.getThumbByIndex(a),c=s.getItem(a);d.isThumbLoaded(g);d.isThumbLoaded(g)&&!c.ordered_placed&&P(g,!0)}function x(){var e=d.getThumbs(d.type.GET_THUMBS_NO_RATIO);if(!e||0==e.length)return!1;if(c.isAllLoaded=!1,1==c.isFirstPlaced){w(),E();var t=Math.abs(_.galleryWidth-_.totalWidth);if(1==g.tiles_set_initial_height&&0==l.isScrollbarExists()&&t<25){e.length;var n=Math.ceil(e.length/_.numCols)*g.tiles_col_width*.75;i.height(n),w()}}e.fadeTo(0,0);var r=e.find("img.ug-thumb-image"),h=_.numCols,p=_.galleryWidth;l.checkImagesLoaded(r,function(){w(),h==_.numCols&&p==_.galleryWidth||S(!1),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){1==c.isFirstPlaced&&s.triggerEvent(o.events.TILES_FIRST_PLACED),function(e,t){if(1==t)return!1;e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e),1==g.tiles_keep_order?P(i):(u.resizeTile(i,_.colWidth),T(i,!0,!0))}(e,t)})}function j(){var e=f(),t=d.getThumbs(!0),i=g.tiles_justified_row_height,n=[],r=0,o=g.tiles_justified_space_between,a=t.length;jQuery.each(t,function(e,t){t=jQuery(t);var o=d.getItemByThumb(t),a=o.thumbWidth;o.thumbHeight!==i&&(a=Math.floor(o.thumbRatioByWidth*i)),n[e]=a,r+=a});var s=Math.ceil(r/e);s>a&&(s=a);var l=r/s,u=[],_=0,c=[],h=[],p=0,m=0;jQuery.each(t,function(e,t){var i=n[e];p+i/2>(m+1)*l&&(c[u.length]=_,u.push(h),h=[],_=0,m++),p+=i,_+=i,h.push(t)}),c[u.length]=_,u.push(h);var b=[],v=[],y=0;return jQuery.each(u,function(t,r){r.length;var a=c[t],s=(r.length-1)*o,l=(e-s)/a,u=Math.round(i*l);y+=u,t>0&&(y+=o),v.push(u);var d=u/i,_=[],g=s;jQuery.each(r,function(e,t){var i=jQuery(t).index(),r=n[i],o=Math.round(r*d);_[e]=o,g+=o});var h=g-e;jQuery.each(_,function(e,t){if(0==h)return!1;h<0?(_[e]=t+1,h++):(_[e]=t-1,h--),e==_.length-1&&0!=h&&(_[e]-=h)}),b[t]=_}),{arrRows:u,arrRowWidths:b,arrRowHeights:v,gap:o,totalHeight:y}}function C(e){if(!e)e=!1;var t=f(),n=j();i.height(n.totalHeight),f()!=t&&(n=j()),b();var r=0,o=0;jQuery.each(n.arrRows,function(t,i){var a=n.arrRowWidths[t],s=n.arrRowHeights[t],d=0;jQuery.each(i,function(t,i){var _=jQuery(i),g=s,c=a[t];u.resizeTile(_,c,g,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(_,d,r),(d+=c)>o&&(o=d),d+=n.gap,1==e&&jQuery(i).show()}),r+=s+n.gap}),y()}function A(){var e=f();switch(h.galleryWidth=e,n={},h.colWidth=g.tiles_nested_col_width,h.optimalTileWidth=g.tiles_nested_optimal_tile_width,h.currentGap=g.tiles_space_between_cols,1==s.isMobileMode()&&(h.currentGap=g.tiles_space_between_cols_mobile),null==h.colWidth?h.colWidth=Math.floor(h.optimalTileWidth/h.nestedOptimalCols):h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.maxColumns=l.getNumItemsInSpace(e,h.colWidth,h.currentGap),h.colWidth=l.getItemSizeInSpace(e,h.maxColumns,h.currentGap),h.gridY=0,r=[],d.getThumbs(!0).each(function(){var e=function(e){var t,i,n={},r=h.colWidth,o=h.currentGap,a=u.getTileImageSize(e),s=e.index(),l=Math.ceil(function(e){return Math.abs(Math.sin(Math.abs(1e3*Math.sin(e))))}(s)*(1*h.nestedOptimalCols/3)+2*h.nestedOptimalCols/3),d=a.width,_=a.height,g=d/_;d>_?(t=l,0==(i=Math.round(t/g))&&(i=1)):(i=l,0==(t=Math.round(i*g))&&(t=1));return n.dimWidth=t,n.dimHeight=i,n.width=t*r+o*(t-1),n.height=i*r+o*(i-1),n.imgWidth=d,n.imgHeight=_,n.left=0,n.top=0,n}(jQuery(this));r.push(e)}),h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.totalWidth=h.maxColumns*(h.colWidth+h.currentGap)-h.currentGap,g.tiles_align){case"center":default:h.addX=Math.round((h.galleryWidth-h.totalWidth)/2);break;case"left":h.addX=0;break;case"right":h.addX=h.galleryWidth-h.totalWidth}h.maxGridY=0}function M(e){var t=f();A(),O();var n=h.maxGridY*(h.colWidth+h.currentGap)-h.currentGap;i.height(n),f()!=t&&(A(),O()),0==g.tiles_nested_debug&&function(e){if(!e)var e=!1;b();for(var t=0;t<r.length;t++)U(t,e);i.height(h.maxColHeight),y()}(e)}function O(e){if(1==g.tiles_nested_debug)return void 0===e&&(e=!0),function(e,t){if(0==t){for(var i=h.currentItem;i<r.length;i++)z(i,!0);h.currentItem=r.length-1}else z(h.currentItem,!0);for(i=0;i<=h.currentItem;i++)U(i,!0);h.currentItem++}(0,e),!1;for(var t=0;t<r.length;t++)z(t,!0)}function z(e,t){if(!t)t=!1;h.maxColHeight=0;for(var i=l.getObjectLength(n),r=h.gridY;r<=i+1;r++){for(var o=0;o<h.maxColumns;o++){if(0==Q(h.gridY)||0==B(h.gridY,o))return void L(e,D(o),o)}h.gridY++}}function L(e,t,i){var o=jQuery.extend(!0,{},r[e]),a=o.dimWidth,s=t-o.dimWidth,l=h.nestedOptimalCols;if(t<=o.dimWidth||s<=.33*l||t<=l)H(e,t);else if(s<=l)l>=4?1==G(Math.floor(t/2),i)?H(e,Math.floor(t/2)+1):H(e,Math.floor(t/2)):H(objImage,t);else if(1==G(a,i))switch(a>=l){case!0:H(e,a-1);break;case!1:H(e,a+1)}var u,d,_,g,c,p,m,f,b,v=function(e,t,i){var r=h.gridY-1,o=0,a=0,s=1,l=[],u=[];if(l.push(e),r>=0){for(a=0;r>=0;){if(o=n[r][i],void 0!==n[r][i-1]&&n[r][i-1]==n[r][i]||void 0!==n[r][i+t]&&n[r][i+t-1]==n[r][i+t]||n[r][i]!=n[r][i+t-1])return u.push(s),u.push(l),u;a!=o&&(s++,l.push(o)),r--,a=o}return u.push(s),u.push(l),u}return[0,[]]}(e,(o=jQuery.extend(!0,{},r[e])).dimWidth,i);if(h.columnsValueToEnableHeightResize<=v[0]&&h.maxColumns>=2*h.nestedOptimalCols){var y=function(e,t){var i=0,r=0,o=t.dimWidth,a=t.dimHeight,s=0,l=0,u=jQuery.map(n,function(e,t){return[e]});if(void 0===u[h.gridY]||void 0===u[h.gridY][e-1])r=0;else for(var d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e-1];)s=n[h.gridY+d][e-2],d++,r++;if(void 0===u[h.gridY]||void 0===u[h.gridY][e+o])i=0;else for(d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e+o];)l=n[h.gridY+d][e+o+1],d++,i++;var _=0,g=0;Math.abs(a-r)<Math.abs(a-i)&&0!=r?(_=r,g=s):0!=i?(_=i,g=l):_=a;return{newHeight:_,idToResize:g}}(i,o),I=k(e,y.newHeight,!0);r[e].dimHeight=I.dimHeight;var w=function(e,t){for(var i=0,n=0,o=[],a=0,s=0,l=0;l<e[1].length;l++){var u=e[1][l],d=r[e[1][l]];if(n+=d.dimHeight,0!=l)i+=d.dimHeight,o.push([u,d.dimHeight]);else{var _=H(u,t,!0);i+=_.dimHeight,o.push([e[1][l],_.dimHeight])}}a=d.left,s=d.top;for(var g=n,c=[],l=o.length-1;l>=0;l--){var h,u=o[l][0];0!=l?(h=Math.max(Math.round(1*n/3),Math.floor(o[l][1]*(n/i))),g-=h,(_=k(u,h,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}),s+=_.dimHeight):((_=k(u,h=g,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}))}return c}(v,I.dimWidth),E=!1;(function(e){for(var t=0,i=0,r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&h.maxColumns>o.left+o.dimWidth&&(a=n[o.top+o.dimHeight-1][o.left+o.dimWidth],s=n[o.top+o.dimHeight][o.left+o.dimWidth]),a!=s&&t++}for(var r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&o.left-1>=0&&(a=n[o.top+o.dimHeight-1][o.left-1],s=n[o.top+o.dimHeight][o.left-1]),a!=s&&i++}return Math.max(i,t)})(w)>=2&&(E=!0),y.newHeight>=o.dimHeight&&(o=k(e,y.newHeight,!0));var T=(u=y.idToResize,d=y.newHeight,_=o.dimHeight,g=r[u],c=g.dimHeight,g.dimWidth,p=g.left,m=g.top,parseInt(m/(h.colWidth+h.currentGap)),parseInt(p/(h.colWidth+h.currentGap)),f=k(u,c-d+_,!0),(b=[]).push({tileID:u,sizes:f}),b);return o.top=h.gridY,o.left=i,T.push({tileID:e,sizes:o}),R(T)<R(w)||1==E?void N(T):void N(w)}o.left=i,o.top=h.gridY,r[e]=o,W(e,o,i,h.gridY),h.maxGridY=o.top+o.dimHeight}function N(e){for(var t=0;t<e.length;t++){var i=e[t].sizes,n=e[t].tileID;r[n]=jQuery.extend(!0,{},i),W(n,i,i.left,i.top)}}function H(e,t,i){i||(i=!1);var n=h.colWidth,o=h.currentGap,a=r[e],s=a.imgWidth/a.imgHeight;if(dimWidth=t,dimHeight=Math.round(dimWidth/s),1==i){var l=jQuery.extend(!0,{},a);return l.dimWidth=dimWidth,l.dimHeight=dimHeight,l.width=dimWidth*n+o*(dimWidth-1),l.height=dimHeight*n+o*(dimHeight-1),l}a.dimWidth=dimWidth,a.dimHeight=dimHeight,a.width=dimWidth*n+o*(dimWidth-1),a.height=dimHeight*n+o*(dimHeight-1)}function k(e,t,i){i||(i=!1);var n=r[e],o=n.dimWidth,a=h.colWidth,s=h.currentGap;if(1==i){var l=jQuery.extend(!0,{},n);return l.dimHeight=t,l.width=o*a+s*(o-1),l.height=t*a+s*(t-1),l}n.dimHeight=t,n.width=o*a+s*(o-1),n.height=t*a+s*(t-1)}function R(e){for(var t=0,i=0,n=0;n<e.length;n++){var o=r[e[n].tileID];if(0==o.dimHeight||0==o.height)return;resizeVal=o.dimWidth/o.dimHeight/(o.imgWidth/o.imgHeight),resizeVal<1&&(resizeVal=1/resizeVal),t+=resizeVal,i++}return t/i}function G(e,t){var i=h.gridY-1;return!(i<=0||0==Q(i))&&n[i][t+e-1]!=n[i][t+e]}function D(e){var t=e,i=0;if(1==Q(h.gridY))for(;0==B(h.gridY,t);)i++,t++;else i=h.maxColumns;return i}function Q(e){return void 0!==n[e]}function W(e,t,i,n){for(var r=0;r<t.dimHeight;r++)for(var o=0;o<t.dimWidth;o++)0==Q(n+r)&&F(n+r),Y(n+r,i+o,e)}function F(e){n[e]=new Object;for(var t=0;t<h.maxColumns;t++)n[e][t]=-1}function B(e,t){return-1!=n[e][t]}function Y(e,t,i){n[e][t]=i}function U(e,t){var i=d.getThumbByIndex(e),n=r[e],o=n.top*(h.colWidth+h.currentGap),a=h.addX+n.left*(h.colWidth+h.currentGap);u.resizeTile(i,n.width,n.height,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(i,a,o),o+n.height>h.maxColHeight&&(h.maxColHeight=o+n.height),1==t&&i.fadeTo(0,1)}function V(){if(1==c.isFirstTimeRun)return!0;if(0==c.isAllLoaded)return!1;switch(g.tiles_type){case"columns":S(!1);break;case"justified":C(!1);break;case"nested":1==s.isMobileMode()?S(!1):M(!1)}}function X(){switch(t.children(".ug-tile").show(),1==c.isFirstTimeRun&&(a.on(o.events.ALL_TILES_LOADED,function(){c.isAllLoaded=!0}),e.on(s.events.SIZE_CHANGE,V),e.on(o.events.TILES_FIRST_PLACED,function(){c.isFirstPlaced=!1}),u.initEvents()),u.run(),g.tiles_type){default:case"columns":x();break;case"justified":i=jQuery(t).find("img.ug-thumb-image"),n=d.getThumbs(),c.isAllLoaded=!1,n.fadeTo(0,0),l.checkImagesLoaded(i,function(){setTimeout(function(){C(!0),n.fadeTo(0,1),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)})},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)});break;case"nested":!function(){var e=jQuery(t).find("img.ug-thumb-image"),i=d.getThumbs();c.isAllLoaded=!1,i.fadeTo(0,0),l.checkImagesLoaded(e,function(){1==s.isMobileMode()?S(!0):M(!0),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)})}()}var i,n;c.isFirstTimeRun=!1}this.destroy=function(){e.off(s.events.SIZE_CHANGE),u.destroy(),e.off(o.events.TILES_FIRST_PLACED)},this.init=function(e,t){p(e,t)},this.setHtml=function(e){!function(e){e||(e=i||t);i=e;var n=g.tiles_type;e.addClass("ug-tiletype-"+n),u.setHtml(e),e.children(".ug-thumb-wrapper").hide()}(e)},this.getObjTileDesign=function(){return u},this.run=function(){X()},this.runNewItems=function(){if(!i)throw new Error("Can't run new items - parent not set");switch(u.setHtml(i,!0),u.run(!0),g.tiles_type){case"columns":x();break;default:case"justified":case"nested":throw new Error("Tiles type: "+g.tiles_type+" not support load more yet")}}}function UGAviaControl(){var e,t,i,n,r,o,a={touchEnabled:!1,isMouseInsideStrip:!1,strip_finalPos:0,handle_timeout:"",isStripMoving:!1,isControlEnabled:!0,maxDpos:1e3};function s(t){if(0==a.isControlEnabled)return!0;if(1==a.touchEnabled)return jQuery("body").off("mousemove"),!0;a.isMouseInsideStrip=i.ismouseover();var s=e.isTouchMotionActive();1==a.isMouseInsideStrip&&0==s?function(e){var t=function(e){return 0==o?function(e){var t=r.strip_padding_left,o=r.strip_padding_right,a=i.width()-t-o,s=n.width();if(a>s)return null;var l=i.offset().left,u=e-l-t,d=r.thumb_width,_=a-r.thumb_width;u<d&&(u=d);u>_&&(u=_);var g=(u-d)/(_-d)*(s-a);return g=-1*Math.round(g)+t}(e):function(e){var t=r.strip_padding_top,o=(r.strip_padding_bottom,i.height()),a=n.height();if(o>a)return null;var s=i.offset().top,l=e-s-t;if(l<0)return null;var u=r.thumb_height,d=o-r.thumb_height;l<u&&(l=u);l>d&&(l=d);var _=(l-u)/(d-u)*(a-o);return _=-1*Math.round(_)+t}(e)}(e);if(null===t)return!1;a.is_strip_moving=!0,a.strip_finalPos=t,function(){if(1==a.isStripMoving)return!1;a.isStripMoving=!0,a.handle_timeout=setInterval(l,10)}()}(function(e){return 0==o?e.pageX:e.pageY}(t)):u()}function l(){if(0==a.is_strip_moving)return!1;var t=a.maxDpos,i=e.getInnerStripPos();Math.floor(i)==Math.floor(a.strip_finalPos)&&u();var n,r=Math.abs(a.strip_finalPos-i);r<1?n=r:(n=r/4)>0&&n<1&&(n=1),a.strip_finalPos<i&&(n*=-1),n>t&&(n=t),n<-t&&(n=-t);var o=i+n;e.positionInnerStrip(o)}function u(){if(0==a.isStripMoving)return!1;a.isStripMoving=!1,a.handle_timeout=clearInterval(a.handle_timeout)}this.enable=function(){a.isControlEnabled=!0},this.disable=function(){a.isControlEnabled=!1},this.onResize=function(){},this.init=function(l){e=l,t=l.getObjects(),t.g_gallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,jQuery("body").on("touchstart",function(e){if(0==a.isControlEnabled)return!0;a.touchEnabled=!0}),jQuery("body").mousemove(s)},this.destroy=function(){jQuery("body").off("touchstart"),jQuery("body").off("mousemove")}}function UGSlider(){var e,t,i,n,r,o,a,s,l,u,d,_,g,c=this,h=jQuery(c),p=new UniteGalleryMain,m=null,f=null,b=null,v=new UGVideoPlayer,y=new UGFunctions,I=null,w=null;this.events={ITEM_CHANGED:"item_changed",BEFORE_SWITCH_SLIDES:"before_switch",BEFORE_RETURN:"before_return",AFTER_RETURN:"after_return",ZOOM_START:"slider_zoom_start",ZOOM_END:"slider_zoom_end",ZOOMING:"slider_zooming",ZOOM_CHANGE:"slider_zoom_change",START_DRAG:"start_drag",AFTER_DRAG_CHANGE:"after_drag_change",ACTION_START:"action_start",ACTION_END:"action_end",CLICK:"slider_click",TRANSITION_START:"slider_transition_start",TRANSITION_END:"slider_transition_end",AFTER_PUT_IMAGE:"after_put_image",IMAGE_MOUSEENTER:"slider_image_mouseenter",IMAGE_MOUSELEAVE:"slider_image_mouseleave",CURRENTSLIDE_LOAD_START:"slider_current_loadstart",CURRENTSLIDE_LOAD_END:"slider_current_loadend"};var E={slider_scale_mode:"fill",slider_scale_mode_media:"fill",slider_scale_mode_fullscreen:"down",slider_item_padding_top:0,slider_item_padding_bottom:0,slider_item_padding_left:0,slider_item_padding_right:0,slider_background_color:"",slider_background_opacity:1,slider_image_padding_top:0,slider_image_padding_bottom:0,slider_image_padding_left:0,slider_image_padding_right:0,slider_image_border:!1,slider_image_border_width:10,slider_image_border_color:"#ffffff",slider_image_border_radius:0,slider_image_border_maxratio:.35,slider_image_shadow:!1,slider_video_constantsize:!1,slider_video_constantsize_scalemode:"fit",slider_video_constantsize_width:854,slider_video_constantsize_height:480,slider_video_padding_top:0,slider_video_padding_bottom:0,slider_video_padding_left:0,slider_video_padding_right:0,slider_video_enable_closebutton:!0,slider_transition:"slide",slider_transition_speed:300,slider_transition_easing:"easeInOutQuad",slider_control_swipe:!0,slider_control_zoom:!0,slider_zoom_mousewheel:!0,slider_vertical_scroll_ondrag:!1,slider_loader_type:1,slider_loader_color:"white",slider_enable_links:!0,slider_links_newpage:!1,slider_enable_bullets:!1,slider_bullets_skin:"",slider_bullets_space_between:-1,slider_bullets_align_hor:"center",slider_bullets_align_vert:"bottom",slider_bullets_offset_hor:0,slider_bullets_offset_vert:10,slider_enable_arrows:!0,slider_arrows_skin:"",slider_arrow_left_align_hor:"left",slider_arrow_left_align_vert:"middle",slider_arrow_left_offset_hor:20,slider_arrow_left_offset_vert:0,slider_arrow_right_align_hor:"right",slider_arrow_right_align_vert:"middle",slider_arrow_right_offset_hor:20,slider_arrow_right_offset_vert:0,slider_enable_progress_indicator:!0,slider_progress_indicator_type:"pie",slider_progress_indicator_align_hor:"right",slider_progress_indicator_align_vert:"top",slider_progress_indicator_offset_hor:10,slider_progress_indicator_offset_vert:10,slider_enable_play_button:!0,slider_play_button_skin:"",slider_play_button_align_hor:"left",slider_play_button_align_vert:"top",slider_play_button_offset_hor:40,slider_play_button_offset_vert:8,slider_play_button_mobilehide:!1,slider_enable_fullscreen_button:!0,slider_fullscreen_button_skin:"",slider_fullscreen_button_align_hor:"left",slider_fullscreen_button_align_vert:"top",slider_fullscreen_button_offset_hor:11,slider_fullscreen_button_offset_vert:9,slider_fullscreen_button_mobilehide:!1,slider_enable_zoom_panel:!0,slider_zoompanel_skin:"",slider_zoompanel_align_hor:"left",slider_zoompanel_align_vert:"top",slider_zoompanel_offset_hor:12,slider_zoompanel_offset_vert:92,slider_zoompanel_mobilehide:!1,slider_controls_always_on:!1,slider_controls_appear_ontap:!0,slider_controls_appear_duration:300,slider_enable_text_panel:!0,slider_textpanel_always_on:!0,slider_videoplay_button_type:"square"},T={slider_progress_indicator_align_hor:"left",slider_progress_indicator_align_vert:"bottom",slider_progress_indicator_offset_hor:0,slider_progress_indicator_offset_vert:0},S={isRunOnce:!1,isTextPanelSaparateHover:!1,numPrev:1,numCurrent:2,numNext:3,isControlsVisible:!0,currentControlsMode:"image"};function P(i,n,r){p=i,r&&(g=r,n=y.convertCustomPrefixOptions(n,g,"slider")),e=jQuery(i);var o=p.getObjects();if(t=o.g_objWrapper,o.g_objThumbs,n.hasOwnProperty("slider_progress_indicator_type")&&(E.slider_progress_indicator_type=n.slider_progress_indicator_type),"bar"==E.slider_progress_indicator_type&&(E=jQuery.extend(E,T)),n&&c.setOptions(n),function(){var e=p.getOptions(),t=e.gallery_skin;""==E.slider_bullets_skin&&(E.slider_bullets_skin=t);""==E.slider_arrows_skin&&(E.slider_arrows_skin=t);""==E.slider_zoompanel_skin&&(E.slider_zoompanel_skin=t);""==E.slider_play_button_skin&&(E.slider_play_button_skin=t);""==E.slider_fullscreen_button_skin&&(E.slider_fullscreen_button_skin=t);E.video_enable_closebutton=E.slider_video_enable_closebutton,"zoom"!=e.gallery_mousewheel_role&&(E.slider_zoom_mousewheel=!1)}(),1==E.slider_enable_bullets){b=new UGBullets;var a={bullets_skin:E.slider_bullets_skin,bullets_space_between:E.slider_bullets_space_between};b.init(p,a)}E.slider_enable_text_panel&&(w=new UGTextPanel).init(p,E,"slider"),E.slider_enable_zoom_panel&&(_=new UGZoomButtonsPanel).init(c,E);var s=p.getGalleryID();v.init(E,!1,s)}function x(){if(1==S.isRunOnce)return!1;if(S.isRunOnce=!0,E.slider_background_color){var t=E.slider_background_color;1!=E.slider_background_opacity&&(t=y.convertHexToRGB(t,E.slider_background_opacity)),i.css("background-color",t)}else 1!=E.slider_background_opacity&&(t=y.convertHexToRGB("#000000",E.slider_background_opacity),i.css("background-color",t));1==E.slider_control_swipe&&(u=new UGTouchSliderControl).init(c,E),1==E.slider_control_zoom&&(d=new UGZoomSliderControl).init(c,E),w&&w.run(),function(){e.on(p.events.ITEM_IMAGE_UPDATED,se),e.on(p.events.ITEM_CHANGE,K),b&&jQuery(b).on(b.events.BULLET_CLICK,J);1==E.slider_enable_arrows&&(y.addClassOnHover(l,"ug-arrow-hover"),y.addClassOnHover(s,"ug-arrow-hover"),p.setNextButton(l),p.setPrevButton(s));0==E.slider_controls_always_on&&i.hover(ie,ne);i.on("touchend click",$),h.on(c.events.CLICK,ee),w&&1==S.isTextPanelSaparateHover&&i.hover(D,G);m&&(y.addClassOnHover(m,"ug-button-hover"),p.setPlayButton(m));f&&(y.addClassOnHover(f,"ug-button-hover"),p.setFullScreenToggleButton(f));d&&h.on(c.events.ZOOM_CHANGE,te);_&&_.initEvents();v.initEvents(),jQuery(v).on(v.events.SHOW,oe),jQuery(v).on(v.events.HIDE,ae),ue(r),ue(o),ue(a),h.on(c.events.AFTER_PUT_IMAGE,le),i.on("mouseenter",".ug-item-wrapper img",function(e){h.trigger(c.events.IMAGE_MOUSEENTER)}),i.on("mouseleave",".ug-item-wrapper img",function(e){var t=c.isMouseInsideSlideImage(e);0==t&&h.trigger(c.events.IMAGE_MOUSELEAVE)})}()}function j(e,t){var i="ug-type-square";"round"==E.slider_videoplay_button_type&&(i="ug-type-round");var n="";return n+="<div class='ug-slide-wrapper ug-slide"+t+"'>",n+="<div class='ug-item-wrapper'></div>",n+="<div class='ug-slider-preloader "+e+"'></div>",n+="<div class='ug-button-videoplay "+i+"' style='display:none'></div>",n+="</div>"}function C(e){e&&(t=e);var u=function(){var e;switch(E.slider_loader_type){default:case 1:e="ug-loader1";break;case 2:e="ug-loader2";break;case 3:e="ug-loader3";break;case 4:e="ug-loader4";break;case 5:e="ug-loader5";break;case 6:e="ug-loader6";break;case 7:e="ug-loader7";break;case 8:e="ug-loader8";break;case 9:e="ug-loader9"}"black"==E.slider_loader_color&&(e+=" ug-loader-black");return e}(),d=(p.getOptions(),"<div class='ug-slider-wrapper'>");(d+="<div class='ug-slider-inner'>",d+=j(u,1),d+=j(u,2),d+=j(u,3),d+="</div>",1==E.slider_enable_arrows&&(d+="<div class='ug-slider-control ug-arrow-left ug-skin-"+E.slider_arrows_skin+"'></div>",d+="<div class='ug-slider-control ug-arrow-right ug-skin-"+E.slider_arrows_skin+"'></div>"),1==E.slider_enable_play_button&&(d+="<div class='ug-slider-control ug-button-play ug-skin-"+E.slider_play_button_skin+"'></div>"),1==E.slider_enable_fullscreen_button&&(d+="<div class='ug-slider-control ug-button-fullscreen ug-skin-"+E.slider_fullscreen_button_skin+"'></div>"),d+="</div>",t.append(d),i=t.children(".ug-slider-wrapper"),n=i.children(".ug-slider-inner"),r=n.children(".ug-slide1"),o=n.children(".ug-slide2"),a=n.children(".ug-slide3"),r.data("slidenum",1),o.data("slidenum",2),a.data("slidenum",3),b&&b.appendHTML(i),1==E.slider_enable_arrows&&(s=i.children(".ug-arrow-left"),l=i.children(".ug-arrow-right")),1==E.slider_enable_play_button&&(m=i.children(".ug-button-play")),1==E.slider_enable_fullscreen_button&&(f=i.children(".ug-button-fullscreen")),1==E.slider_enable_progress_indicator)&&("bar"==(I=y.initProgressIndicator(E.slider_progress_indicator_type,E,i)).getType()&&"pie"==E.slider_progress_indicator_type&&(E.slider_progress_indicator_type="bar",E=jQuery.extend(E,T)),p.setProgressIndicator(I));1==E.slider_enable_text_panel&&(w.appendHTML(i),0==E.slider_textpanel_always_on&&(w.getElement().hide().data("isHidden",!0),S.isTextPanelSaparateHover=!0));1==E.slider_enable_zoom_panel&&_.appendHTML(i),v.setHtml(n)}function A(e){var t=_e(e);y.placeElementInParentCenter(t);var i=ge(e);y.placeElementInParentCenter(i)}function M(){if(b&&(objBullets=b.getElement(),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert)),1==E.slider_enable_arrows&&(y.placeElement(s,E.slider_arrow_left_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_left_offset_hor,E.slider_arrow_left_offset_vert),y.placeElement(l,E.slider_arrow_right_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_right_offset_hor,E.slider_arrow_right_offset_vert)),0==E.slider_controls_always_on&&X(!0),I){var e=I.getElement();if("bar"==E.slider_progress_indicator_type){var t=i.width();I.setSize(t),y.placeElement(e,"left",E.slider_progress_indicator_align_vert,0,E.slider_progress_indicator_offset_vert)}else y.placeElement(e,E.slider_progress_indicator_align_hor,E.slider_progress_indicator_align_vert,E.slider_progress_indicator_offset_hor,E.slider_progress_indicator_offset_vert)}w&&w.positionPanel(),function(){m&&y.placeElement(m,E.slider_play_button_align_hor,E.slider_play_button_align_vert,E.slider_play_button_offset_hor,E.slider_play_button_offset_vert);f&&y.placeElement(f,E.slider_fullscreen_button_align_hor,E.slider_fullscreen_button_align_vert,E.slider_fullscreen_button_offset_hor,E.slider_fullscreen_button_offset_vert);if(_){var e=_.getElement();y.placeElement(e,E.slider_zoompanel_align_hor,E.slider_zoompanel_align_vert,E.slider_zoompanel_offset_hor,E.slider_zoompanel_offset_vert)}}(),A(r),A(o),A(a),p.isMobileMode()?(1==E.slider_fullscreen_button_mobilehide&&f&&f.hide(),1==E.slider_play_button_mobilehide&&m&&m.hide(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().hide()):(1==E.slider_fullscreen_button_mobilehide&&f&&f.show(),1==E.slider_play_button_mobilehide&&m&&m.show(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().show())}function O(){var e,t,i,r,o=c.getSlidesReference(),a=0;i=c.isSlideHasItem(o.objNextSlide),(r=c.isSlideHasItem(o.objPrevSlide))?(a=o.objPrevSlide.outerWidth(),o.objPrevSlide.css("z-index",1)):o.objPrevSlide.hide(),e=t=a+o.objCurrentSlide.outerWidth(),i?(e=t+o.objNextSlide.outerWidth(),o.objPrevSlide.css("z-index",2)):o.objNextSlide.hide(),o.objCurrentSlide.css("z-index",3),y.placeElement(o.objCurrentSlide,a,0),n.css({left:-a+"px",width:e+"px"}),r&&(y.placeElement(o.objPrevSlide,0,0),y.showElement(o.objPrevSlide)),i&&(y.showElement(o.objNextSlide),y.placeElement(o.objNextSlide,t,0))}function z(e){var t=e.data("index");if(void 0===t||null==t)return!1;var i=p.getItem(t);if(!i)return!1;R(e,i)}function L(e){e.stop(!0).hide(100)}function N(e,t,i){var n={};if(1==E.slider_image_border){n["border-style"]="solid";var r=function(e,t){if((a=E.slider_image_border_width)<=10)return a;var i=y.getElementSize(e),n=i.width,r=i.height;if(t&&(t.hasOwnProperty("imageWidth")&&(n=t.imageWidth),t.hasOwnProperty("imageHeight")&&(r=t.imageHeight)),n<=0)return a;var o=n<r?n:r;if(2*a/o<E.slider_image_border_maxratio)return a;var a=o*E.slider_image_border_maxratio/2;return a=Math.round(a)}(e,i);n["border-width"]=r+"px",n["border-color"]=E.slider_image_border_color,n["border-radius"]=E.slider_image_border_radius}"image"!=t&&1==E.slider_video_constantsize&&(n["background-color"]="#000000"),1==E.slider_image_shadow&&(n["box-shadow"]="3px 3px 10px 0px #353535"),e.css(n)}function H(e,t){var i=E.slider_video_constantsize_width,n=E.slider_video_constantsize_height,r=E.slider_video_constantsize_scalemode;return y.scaleImageExactSizeInParent(e,t.imageWidth,t.imageHeight,i,n,r)}function k(e,t,i){var n=e.children(".ug-item-wrapper"),r=_e(e);if(void 0===t.urlImage||""==t.urlImage)throw new Error("The slide don't have big image defined ( data-image='imageurl' ). Please check gallery items.","showbig");var o=t.urlImage,a=e.data("urlImage");e.data("urlImage",o);var s=c.getScaleMode(e),l=c.getSlideType(e);objPadding=c.getObjImagePadding();var u="";if("string"==typeof t.description&&(u=t.description),a==o&&!0!==i){(_=n.children("img")).attr("alt",u),0!=t.imageWidth&&0!=t.imageHeight||p.checkFillImageSize(_,t);var d={};N(_,l,d="image"!=l&&1==E.slider_video_constantsize?H(_,t):y.scaleImageFitParent(_,t.imageWidth,t.imageHeight,s,objPadding)),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else{var _;if((_=y.placeImageInsideParent(o,n,t.imageWidth,t.imageHeight,s,objPadding)).attr("alt",u),1==t.isBigImageLoaded){if(_.fadeTo(0,1),L(r),"image"!=l&&1==E.slider_video_constantsize)d=H(_,t);else d=y.getImageInsideParentData(n,t.imageWidth,t.imageHeight,s,objPadding);_.css("width",d.imageWidth+"px"),N(_,l,d),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else _.fadeTo(0,0),function(e){e.stop(!0).show(100)}(r),e.data("isLoading",!0),c.isSlideCurrent(e)&&h.trigger(c.events.CURRENTSLIDE_LOAD_START),_.data("itemIndex",t.index),_.on("load",function(){var e=jQuery(this),t=e.data("itemIndex");e.fadeTo(0,1);var i=e.parent().parent(),n=c.getSlideType(i),r=_e(i),o=c.getObjImagePadding(),a=c.getScaleMode(i);L(r),i.data("isLoading",!1),c.isSlideCurrent(i)&&h.trigger(c.events.CURRENTSLIDE_LOAD_END),p.onItemBigImageLoaded(null,e);var s=p.getItem(t),l={};"image"!=n&&1==E.slider_video_constantsize?H(e,s):l=y.scaleImageFitParent(e,s.imageWidth,s.imageHeight,a,o),e.fadeTo(0,1),N(e,n,l),h.trigger(c.events.AFTER_PUT_IMAGE,i)})}}function R(e,t){try{var i=e.children(".ug-item-wrapper");if(null==t)return i.html(""),e.removeData("index"),e.removeData("type"),e.removeData("urlImage"),!1;e.data("index");e.data("index",t.index),e.data("type",t.type),1==E.slider_enable_links&&"image"==t.type&&(t.link?e.addClass("ug-slide-clickable"):e.removeClass("ug-slide-clickable")),k(e,t);var n=ge(e);switch(t.type){case"image":n.hide();break;default:n.show()}}catch(e){throw void 0!==e.fileName&&"showbig"==e.fileName&&p.showErrorMessageReplaceGallery(e.message),i.html(""),new Error(e)}}function G(){if(!w)return!1;if(1==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(t=E.slider_controls_appear_duration),e.stop().fadeTo(t,0),e.data("isHidden",!0)}function D(){if(!w)return!1;if(0==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(e.show(),w.positionElements(),t=E.slider_controls_appear_duration),e.stop().show().fadeTo(t,1),e.data("isHidden",!1)}function Q(){return!1!==w.getElement().data("isHidden")}function W(){var e=c.getCurrentSlide(),t=c.getSlideImage(e),i=y.getElementSize(e),n=i.left,r=i.top;if(1==E.slider_video_constantsize){var o=y.getElementSize(t);n+=o.left,r+=o.top}else n+=E.slider_video_padding_left,r+=E.slider_video_padding_top;v.setPosition(n,r)}function F(){var e=E.slider_video_constantsize_width,t=E.slider_video_constantsize_height;v.setSize(e,t),N(v.getObject(),"video")}function B(e,t,i){h.trigger(c.events.TRANSITION_START);var r=E.slider_transition;switch(i&&(r=i),c.stopSlideAction(null,!0),r){default:case"fade":U(t);break;case"slide":!function e(t,i){var r=c.isAnimating();if(1==r)return S.itemWaiting=i,!0;null!=S.itemWaiting&&(S.itemWaiting=null);var o=c.getSlidesReference();switch(t){case"right":R(o.objPrevSlide,i),O();var a=y.getElementSize(o.objPrevSlide),s=-a.left;c.switchSlideNums("right");break;case"left":R(o.objNextSlide,i),O();var l=y.getElementSize(o.objNextSlide),s=-l.left;c.switchSlideNums("left");break;default:throw new Error("wrong direction: "+t)}var u=E.slider_transition_speed;var d=E.slider_transition_easing;var _={duration:u,easing:d,queue:!1,always:function(){if(c.stopSlideAction(),v.hide(),null!=S.itemWaiting){var t=function(e){var t=c.getSlidesReference().objCurrentSlide.data("index"),i=e.index,n="left";t>i&&(n="right");return n}(S.itemWaiting);e(t,S.itemWaiting)}else c.placeNabourItems(),h.trigger(c.events.TRANSITION_END)}};n.animate({left:s+"px"},_)}(e,t);break;case"lightbox_open":U(t,!1,!0)}}function Y(e,t,i){i?e.fadeTo(E.slider_transition_speed,t,i):e.fadeTo(E.slider_transition_speed,t)}function U(e,t,i){if(!t)t=!1;var n=c.getSlidesReference();R(n.objNextSlide,e);var r=y.getElementSize(n.objCurrentSlide);y.placeElement(n.objNextSlide,r.left,r.top);var o=S.numCurrent;if(S.numCurrent=S.numNext,S.numNext=o,h.trigger(c.events.ITEM_CHANGED),n.objNextSlide.stop(!0),n.objCurrentSlide.stop(!0),1==t)n.objCurrentSlide.fadeTo(0,0),n.objNextSlide.fadeTo(0,1),c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide();else{if(n.objNextSlide.fadeTo(0,0),Y(n.objCurrentSlide,0,function(){c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide()}),1==v.isVisible())Y(v.getObject(),0);Y(n.objNextSlide,1)}}function V(){return i.children(".ug-slider-control")}function X(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(0==S.isControlsVisible)return!1;if(!e)e=!1;var t=V();!0===e?t.stop().fadeTo(0,0).hide():t.stop().fadeTo(E.slider_controls_appear_duration,0,function(){t.hide()}),S.isControlsVisible=!1}function Z(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(1==S.isControlsVisible)return!0;if(!e)e=!1;var t=V();!0===e?t.stop().show():(t.stop().show().fadeTo(0,0),t.fadeTo(E.slider_controls_appear_duration,1)),S.isControlsVisible=!0}function q(e){if(e==S.currentControlsMode)return!1;switch(e){case"image":_&&_.getElement().show();break;case"video":_&&_.getElement().hide();break;default:throw new Error("wrong controld mode: "+e)}S.currentControlsMode=e}function K(e,t,i){var n=p.getSelectedItem();c.setItem(n,!1,i);var r=n.index;b&&b.setActive(r),w&&0==S.isTextPanelSaparateHover&&D(),"image"==n.type?q("image"):q("video")}function J(e,t){p.selectItem(t)}function $(e){if(u&&0==u.isTapEventOccured(e))return!0;h.trigger(c.events.CLICK,e)}function ee(){var e=c.getCurrentSlide().hasClass("ug-slide-clickable"),t=c.getCurrentItem();if(e)return 0==E.slider_links_newpage?location.href=t.link:window.open(t.link,"_blank"),!0;0==E.slider_controls_always_on&&1==E.slider_controls_appear_ontap&&1==c.isCurrentSlideType("image")&&(0==S.isControlsVisible?Z():X(),w&&1==E.slider_textpanel_always_on&&c.isCurrentSlideType("image")&&c.isCurrentSlideImageFit()&&D())}function te(e){w&&c.isCurrentSlideType("image")&&0==c.isCurrentSlideImageFit()&&G()}function ie(){Z()}function ne(){X()}function re(e){var t=e.parent();c.startSlideAction(t)}function oe(){p.isPlayMode()&&p.pausePlaying(),h.trigger(c.events.ACTION_START)}function ae(){p.isPlayMode()&&p.continuePlaying(),h.trigger(c.events.ACTION_END)}function se(e,t,i){r.data("index")==t&&(objItem=p.getItem(t),k(r,objItem,!0)),o.data("index")==t&&(objItem=p.getItem(t),k(o,objItem,!0)),a.data("index")==t&&(objItem=p.getItem(t),k(a,objItem,!0))}function le(e,t){t=jQuery(t);var i=c.getSlideImage(t),n=ge(t),r=y.getElementSize(i);y.placeElement(n,"center","middle",r.left,r.top,i)}function ue(e){var t=ge(e);y.addClassOnHover(t),y.setButtonOnClick(t,re)}function de(e){switch(e){case 1:return r;case 2:return o;case 3:return a;default:throw new Error("wrong num: "+e)}}function _e(e){if(!e)e=c.getCurrentSlide();return e.children(".ug-slider-preloader")}function ge(e){return e.children(".ug-button-videoplay")}function ce(e){if(!e)e=c.getCurrentSlide();var t=e.data("index");return null==t?null:p.getItem(t)}this.switchSlideNums=function(e){switch(h.trigger(c.events.BEFORE_SWITCH_SLIDES),e){case"left":var t=S.numCurrent;S.numCurrent=S.numNext,S.numNext=S.numPrev,S.numPrev=t;break;case"right":t=S.numCurrent;S.numCurrent=S.numPrev,S.numPrev=S.numNext,S.numNext=t;break;default:throw new Error("wrong direction: "+e)}h.trigger(c.events.ITEM_CHANGED)},this.destroy=function(){h.off(c.events.AFTER_PUT_IMAGE),e.off(p.events.ITEM_IMAGE_UPDATED),e.off(p.events.ITEM_CHANGE),b&&jQuery(b).on(b.events.BULLET_CLICK),i.off("mouseenter"),i.off("mouseleave"),i.off("touchend"),i.off("click"),h.off(c.events.CLICK),d&&h.off(c.events.ZOOM_CHANGE),h.off(c.events.BEFORE_SWITCH_SLIDES),jQuery(v).off(v.events.SHOW),jQuery(v).off(v.events.HIDE),v.destroy(),i.off("mouseenter",".ug-item-wrapper img"),i.off("mouseleave",".ug-item-wrapper img")},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(e,t,i){P(e,t,i)},this.getSlideImage=function(e){if(!e)e=c.getCurrentSlide();return e.find(".ug-item-wrapper img")},this.setHtml=function(e){C(e)},this.run=function(){x()},this.isInnerInPlace=function(){var e=c.getSlidesReference();return-y.getElementSize(e.objCurrentSlide).left==y.getElementSize(n).left},this.isAnimating=function(){return n.is(":animated")},this.isSlideCurrent=function(e){var t=e.data("slidenum");return S.numCurrent==t},this.isSlideHasItem=function(e){var t=e.data("index");return null!=t},this.getObjImagePadding=function(){return{padding_top:E.slider_image_padding_top,padding_bottom:E.slider_image_padding_bottom,padding_left:E.slider_image_padding_left,padding_right:E.slider_image_padding_right}},this.getSlidesReference=function(){return{objPrevSlide:de(S.numPrev),objNextSlide:de(S.numNext),objCurrentSlide:de(S.numCurrent)}},this.getCurrentSlide=function(){return c.getSlidesReference().objCurrentSlide},this.getCurrentItemIndex=function(){var e=c.getSlidesReference().objCurrentSlide.data("index");return null==e&&(e=-1),e},this.getCurrentItem=function(){var e=c.getCurrentItemIndex();return-1==e?null:p.getItem(e)},this.getSlideType=function(e){return null==e&&(e=c.getCurrentSlide()),e.data("type")},this.isMouseInsideSlideImage=function(e){var t=c.getSlideImage(),i=y.getMousePosition(e);void 0===i.pageX&&(i=u.getLastMousePos());var n=y.getMouseElementPoint(i,t),r=y.getElementSize(t);return isMouseInside=y.isPointInsideElement(n,r),isMouseInside},this.isCurrentSlideType=function(e){return c.getSlideType()==e},this.isCurrentSlideLoadingImage=function(){return!0===c.getCurrentSlide().data("isLoading")},this.setItem=function(e,t,i){var n=c.getSlidesReference(),r=n.objCurrentSlide.data("index"),o=e.index;if(o==r)return!0;if(null==r)R(n.objCurrentSlide,e),c.placeNabourItems();else{var a="left";p.getNumItems();"next"==i?a="left":"prev"==i||r>o?a="right":r>o&&(a="right"),B(a,e,t)}},this.placeNabourItems=function(){var e=c.getSlidesReference(),t=e.objCurrentSlide.data("index"),i=p.getPrevItem(t),n=p.getNextItem(t);R(e.objNextSlide,n),R(e.objPrevSlide,i),O()},this.________EXTERNAL_API___________=function(){},this.stopSlideAction=function(e,t){e||(e=c.getCurrentSlide()),!0===t?v.pause():v.hide()},this.startSlideAction=function(e){e||(e=c.getCurrentSlide());var t=ce(e);if("image"==t.type)return!0;switch(1==E.slider_video_constantsize&&F(),W(),v.show(),t.type){case"youtube":v.playYoutube(t.videoid,!0,t.video_start);break;case"vimeo":v.playVimeo(t.videoid);break;case"html5video":v.playHtml5Video(t.videoogv,t.videowebm,t.videomp4,t.urlImage);break;case"soundcloud":v.playSoundCloud(t.trackid);break;case"wistia":v.playWistia(t.videoid)}},this.getScaleMode=function(e){if(!e)e=c.getCurrentSlide();return"image"!=c.getSlideType(e)?E.slider_scale_mode_media:E.slider_scale_mode==E.slider_scale_mode_fullscreen?E.slider_scale_mode:1==p.isFullScreen()?E.slider_scale_mode_fullscreen:E.slider_scale_mode},this.getObjects=function(){return{g_objSlider:i,g_objInner:n,g_options:E,g_objZoomSlider:d}},this.getObjZoom=function(){return d},this.getOptions=function(){return E},this.getElement=function(){return i},this.getVideoObject=function(){return v},this.isCurrentSlideImageFit=function(){var e=c.getCurrentSlide();c.getSlideType(e);!function(e,t){null==t&&(t=c.getCurrentSlide());var i=c.getSlideType(t);if(i!=e)throw new Error("Wrong slide type: "+i+", should be: "+e)}("image",e);var t=c.getSlideImage(e);return 0!=t.length&&y.isImageFitParent(t)},this.isCurrentImageInPlace=function(){var e=c.getSlideImage();if(0==e.length)return!1;var t=c.getScaleMode(),i=c.getObjImagePadding(),n=ce(),r=e.parent(),o=y.getImageInsideParentData(r,n.imageWidth,n.imageHeight,t,i),a=y.getElementSize(e),s=!1;return o.imageWidth==a.width&&(s=!0),s},this.isSlideActionActive=function(){return v.isVisible()},this.isSwiping=function(){return!!u&&u.isTouchActive()},this.isPreloading=function(){return!!_e().is(":visible")},this.setOptions=function(e){g&&(e=y.convertCustomPrefixOptions(e,g,"slider")),E=jQuery.extend(E,e)},this.setSize=function(e,t){if(e<0||t<0)return!0;var s={};s.width=e+"px",s.height=t+"px",i.css(s);var l={};l.height=t+"px",l.top="0px",l.left="0px",n.css(l);var u={};u.height=t+"px",u.width=e+"px",r.css(u),o.css(u),a.css(u);var d=e-E.slider_item_padding_left-E.slider_item_padding_right,_=t-E.slider_item_padding_top-E.slider_item_padding_bottom,g={};if(g.width=d+"px",g.height=_+"px",g.top=E.slider_item_padding_top+"px",g.left=E.slider_item_padding_left+"px",i.find(".ug-item-wrapper").css(g),w&&w.setSizeByParent(),M(),z(r),z(o),z(a),O(),"image"!=c.getSlideType()&&1==E.slider_video_constantsize)F();else{var h=e-E.slider_video_padding_left-E.slider_video_padding_right,p=t-E.slider_video_padding_top-E.slider_video_padding_bottom;v.setSize(h,p)}W()},this.refreshSlideItems=function(){if(1==c.isAnimating())return!0;z(r),z(o),z(a),O()},this.isMouseOver=function(){return i.ismouseover()},this.setPosition=function(e,t){y.placeElement(i,e,t)},this.zoomIn=function(){if(!d)return!0;d.zoomIn()},this.zoomOut=function(){if(!d)return!0;d.zoomOut()},this.zoomBack=function(){if(!d)return!0;d.zoomBack()}}function UGTextPanel(){var e,t,i,n,r,o,a,s=this,l=new UGFunctions,u="",d={textpanel_align:"bottom",textpanel_margin:0,textpanel_text_valign:"middle",textpanel_padding_top:10,textpanel_padding_bottom:10,textpanel_height:null,textpanel_padding_title_description:5,textpanel_padding_right:11,textpanel_padding_left:11,textpanel_fade_duration:200,textpanel_enable_title:!0,textpanel_enable_description:!0,textpanel_title_as_link:!1,textpanel_title_link_newtab:!0,textpanel_enable_bg:!0,textpanel_bg_color:"#000000",textpanel_bg_opacity:.4,textpanel_title_color:null,textpanel_title_font_family:null,textpanel_title_text_align:null,textpanel_title_font_size:null,textpanel_title_bold:null,textpanel_css_title:{},textpanel_desc_color:null,textpanel_desc_font_family:null,textpanel_desc_text_align:null,textpanel_desc_font_size:null,textpanel_desc_bold:null,textpanel_css_description:{},textpanel_desc_style_as_title:!1,textpanel_bg_css:{}},_={isFirstTime:!0,setInternalHeight:!0,lastTitleBottom:0,lastDescHeight:0};function g(t,a){if(!a)a=d.textpanel_padding_top;var s=a;if(i){var u=s;if(l.placeElement(i,0,u),1==i.is(":visible")){(s=l.getElementSize(i).bottom)>0&&(_.lastTitleBottom=s)}else{s=20;_.lastTitleBottom>0&&(s=_.lastTitleBottom)}}var g="";if(n&&(g=jQuery.trim(n.text())),""!=g){var c=s;if(i&&(c+=d.textpanel_padding_title_description),l.placeElement(n,0,c),1==jQuery(n).is(":visible")){var h=l.getElementSize(n);s=h.bottom,h.height>0&&(_.lastDescHeight=h.height)}else{var p=16;_.lastDescHeight>0&&(p=_.lastDescHeight),s=c+p}}d.textpanel_height||1!=_.setInternalHeight||function(t,i){if(!i)var i=!1;if(1==i){if(r){var n=r.height();t>n&&r.height(t)}var a={height:t+"px"};e.add(o).animate(a,d.textpanel_fade_duration)}else r&&r.height(t),e.add(o).height(t)}(s+d.textpanel_padding_bottom,t)}function c(){var e=0;if(i&&(e+=i.outerHeight()),n){var t="";n&&(t=jQuery.trim(n.text())),""!=t&&(i&&(e+=d.textpanel_padding_title_description),e+=n.outerHeight())}return e}function h(){if(1==d.textpanel_enable_bg){(r=e.children(".ug-textpanel-bg")).fadeTo(0,d.textpanel_bg_opacity);var t={"background-color":d.textpanel_bg_color};t=jQuery.extend(t,d.textpanel_bg_css),r.css(t)}if(1==d.textpanel_enable_title){i=o.children(".ug-textpanel-title");var a={};null!==d.textpanel_title_color&&(a.color=d.textpanel_title_color),null!==d.textpanel_title_font_family&&(a["font-family"]=d.textpanel_title_font_family),null!==d.textpanel_title_text_align&&(a["text-align"]=d.textpanel_title_text_align),null!==d.textpanel_title_font_size&&(a["font-size"]=d.textpanel_title_font_size+"px"),null!==d.textpanel_title_bold&&(!0===d.textpanel_title_bold?a["font-weight"]="bold":a["font-weight"]="normal"),d.textpanel_css_title&&(a=jQuery.extend(a,d.textpanel_css_title)),i.css(a)}if(1==d.textpanel_enable_description){n=o.children(".ug-textpanel-description");var s={};null!==d.textpanel_desc_color&&(s.color=d.textpanel_desc_color),null!==d.textpanel_desc_font_family&&(s["font-family"]=d.textpanel_desc_font_family),null!==d.textpanel_desc_text_align&&(s["text-align"]=d.textpanel_desc_text_align),null!==d.textpanel_desc_font_size&&(s["font-size"]=d.textpanel_desc_font_size+"px"),null!==d.textpanel_desc_bold&&(!0===d.textpanel_desc_bold?s["font-weight"]="bold":s["font-weight"]="normal"),d.textpanel_css_title&&(s=jQuery.extend(s,d.textpanel_css_description)),n.css(s)}}function p(){var e=a.getSelectedItem();s.setText(e.title,e.description,e.link)}this.positionElements=function(e){if(!d.textpanel_height||"top"==d.textpanel_text_valign)return g(e),!1;switch(d.textpanel_text_valign){default:case"top":g(!1);break;case"bottom":t=c(),g(!1,o.height()-t-d.textpanel_padding_bottom);break;case"center":case"middle":!function(){var e=c();g(!1,(o.height()-e)/2)}()}var t},this.init=function(e,t,i){if(a=e,i&&(u=i,t=l.convertCustomPrefixOptions(t,u,"textpanel")),t&&(d=jQuery.extend(d,t)),0==d.textpanel_enable_title&&0==d.textpanel_enable_description)throw new Error("Textpanel Error: The title or description must be enabled");d.textpanel_height&&d.textpanel_height<0&&(d.textpanel_height=null),1==d.textpanel_desc_style_as_title&&(d.textpanel_desc_color||(d.textpanel_desc_color=d.textpanel_title_color),d.textpanel_desc_bold||(d.textpanel_desc_bold=d.textpanel_title_bold),d.textpanel_desc_font_family||(d.textpanel_desc_font_family=d.textpanel_title_font_family),d.textpanel_desc_font_size||(d.textpanel_desc_font_size=d.textpanel_title_font_size),d.textpanel_desc_text_align||(d.textpanel_desc_text_align=d.textpanel_title_text_align))},this.appendHTML=function(i,n){t=i;var r="<div class='ug-textpanel"+(n=n?" "+n:"")+"'>";1==d.textpanel_enable_bg&&(r+="<div class='ug-textpanel-bg"+n+"'></div>"),r+="<div class='ug-textpanel-textwrapper"+n+"'>",1==d.textpanel_enable_title&&(r+="<div class='ug-textpanel-title"+n+"'></div>"),1==d.textpanel_enable_description&&(r+="<div class='ug-textpanel-description"+n+"'></div>"),r+="</div></div>",i.append(r),e=i.children(".ug-textpanel"),o=e.children(".ug-textpanel-textwrapper"),h()},this.destroy=function(){jQuery(a).off(a.events.ITEM_CHANGE)},this.run=function(){s.setSizeByParent(),jQuery(a).on(a.events.ITEM_CHANGE,p)},this.setPanelSize=function(t,a){if(_.setInternalHeight=!0,a)_.setInternalHeight=!1;else a=80;d.textpanel_height&&(a=d.textpanel_height),e.width(t),e.height(a),r&&(r.width(t),r.height(a));var u=t-d.textpanel_padding_left-d.textpanel_padding_right,g=d.textpanel_padding_left;l.setElementSizeAndPosition(o,g,0,u,a),i&&i.width(u),n&&n.width(u),0==_.isFirstTime&&s.positionElements(!1)},this.setSizeByParent=function(){var e=l.getElementSize(t);s.setPanelSize(e.width)},this.setTextPlain=function(e,t,r){if(1==d.textpanel_title_as_link&&e&&r){var o="";1==d.textpanel_title_link_newtab&&(o+=' target="blank"'),e='<a class="ug-textpanel-link" href="'+r+'" '+o+">"+e+"</a>"}i&&i.html(e),n&&n.html(t)},this.setText=function(e,t,i){1==_.isFirstTime?(s.setTextPlain(e,t,i),_.isFirstTime=!1,s.positionElements(!1)):o.stop().fadeTo(d.textpanel_fade_duration,0,function(){s.setTextPlain(e,t,i),s.positionElements(!0),jQuery(this).fadeTo(d.textpanel_fade_duration,1)})},this.positionPanel=function(t,i){var n={};if(null!=t)n.top=t,n.bottom="auto";else switch(d.textpanel_align){case"top":n.top=d.textpanel_margin+"px";break;case"bottom":n.top="auto",n.bottom=d.textpanel_margin+"px";break;case"middle":n.top=l.getElementRelativePos(e,"middle",d.textpanel_margin)}null!=i&&(n.left=i),e.css(n)},this.setOptions=function(e){u&&(e=l.convertCustomPrefixOptions(e,u,"textpanel")),d=jQuery.extend(d,e)},this.getElement=function(){return e},this.getSize=function(){return l.getElementSize(e)},this.refresh=function(e,t,i,n){h(),i?s.setPanelSize(i,n):s.setSizeByParent(),s.positionElements(!1),!0!==t&&s.positionPanel(),!0===e&&s.show()},this.hide=function(){e.hide()},this.show=function(){e.show()},this.getOptions=function(){return d},this.getOption=function(e){return 0==d.hasOwnProperty(e)?null:d[e]}}function UGZoomButtonsPanel(){var e,t,i,n,r=new UGSlider,o=new UGFunctions,a={slider_zoompanel_skin:""};function s(e){return!e||!!e.hasClass("ug-zoompanel-button-disabled")}function l(e){e&&e.addClass("ug-zoompanel-button-disabled")}function u(e){e&&e.removeClass("ug-zoompanel-button-disabled")}function d(){if(0==r.isCurrentSlideType("image"))return!0;1==r.isCurrentSlideImageFit()?0==s(i)&&(l(i),l(n)):1==s(i)&&(u(i),u(n))}this.init=function(e,t){r=e,t&&(a=jQuery.extend(a,t))},this.appendHTML=function(r){r;var o="<div class='ug-slider-control ug-zoompanel ug-skin-"+a.slider_zoompanel_skin+"'>";o+="<div class='ug-zoompanel-button ug-zoompanel-plus'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-minus ug-zoompanel-button-disabled'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-return ug-zoompanel-button-disabled'></div>",o+="</div>",r.append(o),e=r.children(".ug-zoompanel"),t=e.children(".ug-zoompanel-plus"),i=e.children(".ug-zoompanel-minus"),n=e.children(".ug-zoompanel-return")},this.setObjects=function(e,r,o){t=e,n=o,(i=r)&&i.addClass("ug-zoompanel-button-disabled"),n&&n.addClass("ug-zoompanel-button-disabled")},this.getElement=function(){return e},this.initEvents=function(){o.addClassOnHover(t,"ug-button-hover"),o.addClassOnHover(i,"ug-button-hover"),o.addClassOnHover(n,"ug-button-hover"),o.setButtonOnClick(t,function(){if(1==s(t))return!0;r.zoomIn()}),o.setButtonOnClick(i,function(){if(1==s(i))return!0;r.zoomOut()}),o.setButtonOnClick(n,function(){if(1==s(n))return!0;r.zoomBack()}),jQuery(r).on(r.events.ZOOM_CHANGE,d),jQuery(r).on(r.events.ITEM_CHANGED,d)}}function UGBullets(){var e,t,i=this,n=0,r=new UniteGalleryMain,o=new UGFunctions,a={isInited:!1},s={bullets_skin:"",bullets_addclass:"",bullets_space_between:-1};function l(){var i="",r="";-1!=s.bullets_space_between&&(r=" style='margin-left:"+s.bullets_space_between+"px'");for(var o=0;o<n;o++)i+=0==o?"<div class='ug-bullet'></div>":"<div class='ug-bullet'"+r+"></div>";if(e.html(i),!t){var a=e.find(".ug-bullet:first-child");a.length&&(t=a.width())}}function u(e){if(1==i.isActive(e))return!0;var t=e.index();jQuery(i).trigger(i.events.BULLET_CLICK,t)}function d(){var t=e.children(".ug-bullet");o.setButtonOnClick(t,u),t.on("mousedown mouseup",function(e){return!1})}function _(e){if(e<0||e>=n)throw new Error("wrong bullet index: "+e)}function g(){if(1==a.isInited)return!0;throw new Error("The bullets are not inited!")}this.events={BULLET_CLICK:"bullet_click"},this.init=function(e,t,i){r=e,n=i||r.getNumItems(),a.isInited=!0,""==(s=jQuery.extend(s,t)).bullets_skin&&(s.bullets_skin=s.gallery_skin)},this.getBulletsWidth=function(){return 0==n?0:t?n*t+(n-1)*s.bullets_space_between:0},this.appendHTML=function(t){t,g();var i="";""!=s.bullets_addclass&&(i=" "+s.bullets_addclass);var n="<div class='ug-slider-control ug-bullets ug-skin-"+s.bullets_skin+i+"'>";e=jQuery(n+="</div>"),t.append(e),l(),d()},this.updateNumBullets=function(e){n=e,l(),d()},this.getElement=function(){return e},this.setActive=function(t){g(),_(t);var i=e.children(".ug-bullet");i.removeClass("ug-bullet-active"),jQuery(i[t]).addClass("ug-bullet-active"),t},this.isActive=function(t){if(_(t),"number"!=typeof t)var i=t;else i=e.children(".ug-bullet")[t];return!!i.hasClass("ug-bullet-active")},this.getNumBullets=function(){return n}}function UGProgressBar(){var e,t,i=this,n=0,r=new UGFunctions,o={slider_progressbar_color:"#ffffff",slider_progressbar_opacity:.6,slider_progressbar_line_width:5};this.put=function(i,n){n&&(o=jQuery.extend(o,n)),i.append("<div class='ug-progress-bar'><div class='ug-progress-bar-inner'></div></div>"),e=i.children(".ug-progress-bar"),(t=e.children(".ug-progress-bar-inner")).css("background-color",o.slider_progressbar_color),e.height(o.slider_progressbar_line_width),t.height(o.slider_progressbar_line_width),t.width("0%");var r=o.slider_progressbar_opacity,a=t[0];a.style.opacity=r,a.style.filter="alpha(opacity="+100*r+")"},this.putHidden=function(t,n){i.put(t,n),e.hide()},this.getElement=function(){return e},this.setSize=function(n){e.width(n),t.width(n),i.draw()},this.setPosition=function(t,i,n,o){r.placeElement(e,t,i,n,o)},this.draw=function(){var e=100*n;t.width(e+"%")},this.setProgress=function(e){n=r.normalizePercent(e),i.draw()},this.getType=function(){return"bar"}}function UGProgressPie(){var e,t=this,i=!1,n=new UGFunctions,r={slider_progresspie_type_fill:!1,slider_progresspie_color1:"#B5B5B5",slider_progresspie_color2:"#E5E5E5",slider_progresspie_stroke_width:6,slider_progresspie_width:30,slider_progresspie_height:30};function o(t){if(!t)t=0;var n=Math.min(r.slider_progresspie_width,r.slider_progresspie_height)/2,o=e[0].getContext("2d");0==i&&(i=!0,o.rotate(1.5*Math.PI),o.translate(-2*n,0)),o.clearRect(0,0,r.slider_progresspie_width,r.slider_progresspie_height);var a=r.slider_progresspie_width/2,s=r.slider_progresspie_height/2,l=0,u=t*Math.PI*2;if(1==r.slider_progresspie_type_fill)o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath();else{o.globalCompositeOperation="source-over",o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath(),o.globalCompositeOperation="destination-out";var d=n-r.slider_progresspie_stroke_width;o.beginPath(),o.moveTo(a,s),o.arc(a,s,d,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath()}1==r.slider_progresspie_type_fill&&(l=u,u=2*Math.PI,o.beginPath(),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color2,o.fill(),o.closePath())}this.put=function(t,i){i&&(r=jQuery.extend(r,i)),t.append("<canvas class='ug-canvas-pie' width='"+r.slider_progresspie_width+"' height='"+r.slider_progresspie_height+"'></canvas>"),e=t.children(".ug-canvas-pie")},this.putHidden=function(i,n){t.put(i,n),o(.1),e.hide()},this.getElement=function(){return e},this.setPosition=function(t,i){n.placeElement(e,t,i)},this.getSize=function(){return{width:r.slider_progresspie_width,height:r.slider_progresspie_height}},this.setProgress=function(e){e=n.normalizePercent(e),e,o(e)},this.getType=function(){return"pie"}}function UGTouchSliderControl(){var e,t,i,n=new UGSlider,r=new UGFunctions,o={slider_transition_continuedrag_speed:250,slider_transition_continuedrag_easing:"linear",slider_transition_return_speed:300,slider_transition_return_easing:"easeInOutQuad"},a={touch_active:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startPosx:0,startTime:0,isInitDataValid:!1,slides:null,lastNumTouches:0,isDragging:!1,storedEventID:"touchSlider",videoStartX:0,isDragVideo:!1,videoObject:null};function s(e){if(!e)e=n.getSlidesReference();return-r.getElementSize(e.objCurrentSlide).left-r.getElementSize(t).left}function l(e){if(1==n.isInnerInPlace())return!1;if(i.trigger(n.events.BEFORE_RETURN),!e)e=n.getSlidesReference();var s=-r.getElementSize(e.objCurrentSlide).left;t.animate({left:s+"px"},{duration:o.slider_transition_return_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(e,i,n){if(1==a.isDragVideo){var o=r.getElementSize(t).left-s,l=a.videoStartX+o;a.videoObject.css("left",l)}},complete:function(){i.trigger(n.events.AFTER_RETURN)}})}function u(){var e=n.getSlidesReference(),u=s(e);if(0==u)return!1;var d=u>0?"left":"right",_=!1;switch(d){case"right":if(n.isSlideHasItem(e.objPrevSlide))var g=-r.getElementSize(e.objPrevSlide).left;else _=!0;break;case"left":if(n.isSlideHasItem(e.objNextSlide))g=-r.getElementSize(e.objNextSlide).left;else _=!0}1==_?l(e):t.stop().animate({left:g+"px"},{duration:o.slider_transition_continuedrag_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(){if(1==a.isDragVideo){var e=r.getElementSize(t).left-a.startPosx,i=a.videoStartX+e;a.videoObject.css("left",i)}},always:function(){!function(e){n.getVideoObject().hide(),n.switchSlideNums(e),n.placeNabourItems()}(d),i.trigger(n.events.AFTER_DRAG_CHANGE)}})}function d(e){var i=r.getMousePosition(e);a.startMouseX=i.pageX,a.startMouseY=i.pageY,a.lastMouseX=a.startMouseX,a.lastMouseY=a.startMouseY,a.startTime=jQuery.now();var n=r.getArrTouches(e);a.startArrTouches=r.getArrTouchPositions(n);var o=r.getElementSize(t);a.startPosx=o.left,a.isInitDataValid=!0,a.isDragVideo=!1,r.storeEventData(e,a.storedEventID)}function _(e){a.touch_active=!1}function g(e,t){a.touch_active=!0,d(t)}function c(e){return e.preventDefault(),a.isDragging=!1,1==n.isAnimating()&&t.stop(!0,!0),r.getArrTouches(e).length>1?(1==a.touch_active&&_(),!0):1==a.touch_active||void g(0,e)}function h(s){if(0==a.touch_active)return!0;if(0==s.buttons)return _(),u(),!0;r.updateStoredEventData(s,a.storedEventID),s.preventDefault();var l=r.getMousePosition(s);a.lastMouseX=l.pageX,a.lastMouseY=l.pageY;var g=null;1==o.slider_vertical_scroll_ondrag&&(g=r.handleScrollTop(a.storedEventID)),"vert"!==g&&function(r){var o=a.lastMouseX-a.startMouseX;if(0==o)return!0;var s=o<0?"left":"right",l=n.getObjZoom();if(l){if(1==l.isPanEnabled(r,s))return a.isInitDataValid=!1,!0;if(0==a.isInitDataValid)return d(r),!0}var u=a.startPosx+o;o>0&&u>0?u/=3:o<0&&u+t.width()<e.width()&&(u=a.startPosx+o/3);if(0==a.isDragging&&(a.isDragging=!0,i.trigger(n.events.START_DRAG)),t.css("left",u+"px"),1==a.isDragVideo){var _=u-a.startPosx,g=a.videoStartX+_;a.videoObject.css("left",g)}}(s)}function p(e){var t=r.getArrTouches(e).length;if(1==n.isInnerInPlace()&&0==a.touch_active&&0==t)return!0;if(0==t&&1==a.touch_active){_();var i=!1;0==r.wasVerticalScroll(a.storedEventID)&&(i=function(){var e=n.getSlidesReference(),t=s(e),i=Math.round(3*e.objCurrentSlide.width()/8);if(Math.abs(t)>=i)return!0;var r=Math.abs(a.lastMouseX-a.startMouseX);return Math.abs(a.lastMouseY-a.startMouseY),!(r<20)&&jQuery.now()-a.startTime<500}()),1==i?u():l()}else 1==t&&0==a.touch_active&&g(0,e)}this.isTapEventOccured=function(e){var t=r.getArrTouches(e).length;if(0!=t||0!=a.lastNumTouches)return a.lastNumTouches=t,!1;a.lastNumTouches=t;s(n.getSlidesReference());var i=Math.abs(a.lastMouseX-a.startMouseX),o=Math.abs(a.lastMouseY-a.startMouseY),l=jQuery.now()-a.startTime;return i<20&&o<50&&l<500},this.init=function(r,a){n=r,i=jQuery(n),g_objects=r.getObjects(),e=g_objects.g_objSlider,t=g_objects.g_objInner,o=jQuery.extend(o,a),e.bind("mousedown touchstart",c),jQuery("body").bind("mousemove touchmove",h),jQuery(window).add("body").bind("mouseup touchend",p)},this.getLastMousePos=function(){return{pageX:a.lastMouseX,pageY:a.lastMouseY}},this.isTouchActive=function(){return a.touch_active}}function UGZoomSliderControl(){var e,t,i=new UGSlider,n=new UGFunctions,r={slider_zoom_step:1.2,slider_zoom_max_ratio:6,slider_zoom_return_pan_duration:400,slider_zoom_return_pan_easing:"easeOutCubic"},o={isPanActive:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startImageX:0,startImageY:0,panXActive:!1,panYActive:!1,objImage:null,objImageSize:null,objParent:null,objParentSize:null,objSlide:null,storeImageLastTime:0,isZoomActive:!1,startDistance:0,startMiddlePoint:null,imageOrientPoint:null,objFitImageSize:null,isZoomedOnce:!1};function a(n,a){i=n,t=jQuery(i),g_objects=n.getObjects(),e=g_objects.g_objSlider,g_objects.g_objInner,r=jQuery.extend(r,a),e.on("mousewheel",b),e.bind("mousedown touchstart",p),jQuery("body").bind("mousemove touchmove",f),jQuery(window).add("body").bind("mouseup touchend",m),t.bind(i.events.BEFORE_RETURN,function(){h()}),t.bind(i.events.ITEM_CHANGED,function(){o.isZoomedOnce=!1}),t.bind(i.events.ZOOM_CHANGE,function(){o.isZoomedOnce=!0})}function s(){var e=i.getScaleMode();return"down"!=e&&(e="fit"),e}function l(){if((r=jQuery.now())-o.storeImageLastTime<20)return!1;var e=i.getSlidesReference();if(o.objSlide=e.objCurrentSlide,o.objImage=e.objCurrentSlide.find("img"),0==o.objImage.length)return!1;o.objImageSize=n.getElementSize(o.objImage),o.objParent=o.objImage.parent(),o.objParentSize=n.getElementSize(o.objParent);var t=s();objPadding=i.getObjImagePadding(),o.objFitImageSize=n.getImageInsideParentDataByImage(o.objImage,t,objPadding);var r=jQuery.now();return o.storeImageLastTime=r,!0}function u(e,o){var a=i.getSlidesReference().objCurrentSlide.find("img"),l=s();t.trigger(i.events.ZOOM_START);var u=!0,d=i.getObjImagePadding();if("back"==e){var _=n.getImageOriginalSize(a);n.scaleImageFitParent(a,_.width,_.height,l,d)}else{var g="in"==e;u=n.zoomImageInsideParent(a,g,r.slider_zoom_step,o,l,r.slider_zoom_max_ratio,d)}1==u&&(t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE),t.trigger(i.events.ZOOM_END))}function d(e,t,i){var r=n.getArrTouches(t);if(!0===i){if(1!=r.length)return!1}else if(r.length>1)return!1;return!!n.isElementBiggerThenParent(e)}function _(e){o.isPanActive=!0,function(e){var t=n.getMousePosition(e);o.startMouseX=t.pageX,o.startMouseY=t.pageY,o.lastMouseX=o.startMouseX,o.lastMouseY=o.startMouseY,o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height}(e)}function g(e){if(0==o.isZoomActive)return!1;2!=n.getArrTouches(e).length&&(o.isZoomActive=!1,t.trigger(i.events.ZOOM_END))}function c(e){if(1==o.isZoomActive)return!0;var r=n.getArrTouches(e);if(2!=r.length)return!0;!function(e){o.isZoomActive=!0,o.startDistance=n.getDistance(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),0==o.startDistance&&(o.startDistance=1),o.startMiddlePoint=n.getMiddlePoint(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),o.objImageSize=n.getElementSize(o.objImage),o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.imageOrientPoint=n.getElementLocalPoint(o.startMiddlePoint,o.objImage),0==n.isPointInsideElement(o.imageOrientPoint,o.objImageSize)&&(o.imageOrientPoint=n.getElementCenterPoint(o.objImage)),t.trigger(i.events.ZOOM_START)}(r)}function h(){if(null==o.objImage||0==o.objImage.length)return!0;if(n.getElementSize(o.objImage).width<o.objFitImageSize.imageWidth){o.objImage.css({position:"absolute",margin:"none"});var e={top:o.objFitImageSize.imageTop+"px",left:o.objFitImageSize.imageLeft+"px",width:o.objFitImageSize.imageWidth+"px",height:o.objFitImageSize.imageHeight+"px"};o.objImage.animate(e,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}else!function(){var e=!1,t=!1,a=0,s=0,l=n.getElementSize(o.objImage),u=i.getObjImagePadding(),d=n.getElementCenterPosition(o.objImage,u);o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height,1==o.panYActive?l.top>0?(s=0,t=!0):l.bottom<o.objParentSize.height&&(s=o.objParentSize.height-l.height,t=!0):l.top!=d.top&&(t=!0,s=d.top),1==o.panXActive?l.left>0?(a=0,e=!0):l.right<o.objParentSize.width&&(a=o.objParentSize.width-l.width,e=!0):l.left!=d.left&&(e=!0,a=d.left);var _={};1==t&&(_.top=s+"px"),1==e&&(_.left=a+"px"),1!=t&&1!=e||o.objImage.animate(_,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}()}function p(e){if(0==i.isCurrentSlideType("image"))return!0;l();if(null==o.objImage||0==o.objImage.length)return!0;e.preventDefault(),1==!(!o.objImage||!o.objImage.is(":animated"))&&o.objImage.stop(!0),1==o.isZoomActive?g(e):c(e),1==o.isZoomActive?o.isPanActive=!1:1==d(o.objImage,e)&&1==o.isZoomedOnce&&_(e)}function m(e){if(0==i.isCurrentSlideType("image"))return!0;if(1==jQuery(e.target).data("ug-button"))return!1;l();if(null==o.objImage||0==o.objImage.length)return!0;var t=o.isPanActive,n=o.isZoomActive;if(0==i.isInnerInPlace())return o.isZoomActive=!1,o.isPanActive=!1,!0;if(1==o.isZoomActive?g(e):c(e),1==o.isZoomActive)o.isPanActive=!1;else{var r=d(o.objImage,e,!0);1==o.isPanActive?o.isPanActive=!1:1==r&&_(e)}(t||n)&&0==o.isZoomActive&&0==o.isPanActive&&h()}function f(e){if(0==i.isCurrentSlideType("image"))return!0;1==o.isZoomActive?function(e){var a=n.getArrTouches(e),s=n.getDistance(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY)/o.startDistance,l=n.getMiddlePoint(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY),u=o.objImageSize.width*s,d=o.objImageSize.height*s,_=n.getImageOriginalSize(o.objImage),g=1;if(_.width>0&&(g=u/_.width),g>r.slider_zoom_max_ratio)return!0;panX=-(o.imageOrientPoint.x*s-o.imageOrientPoint.x),panY=-(o.imageOrientPoint.y*s-o.imageOrientPoint.y);var c=l.x-o.startMiddlePoint.x,h=l.y-o.startMiddlePoint.y,p=o.startImageX+panX+c,m=o.startImageY+panY+h;n.setElementSizeAndPosition(o.objImage,p,m,u,d),t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE)}(e):1==o.isPanActive&&function(e){if(null==o.objImage||0==o.objImage.length)return!0;var t=n.getMousePosition(e),r=(t.pageX,o.startMouseX,t.pageY,o.startMouseY,t.pageX-o.lastMouseX),a=t.pageY-o.lastMouseY,s=r<0?"left":"right",l=a<0?"up":"down";o.lastMouseX=t.pageX,o.lastMouseY=t.pageY;var u=n.getElementSize(o.objImage);0==o.panYActive?a=0:"down"==l&&u.top>0?a/=3:"up"==l&&u.bottom<o.objParentSize.height&&(a/=3),0==o.panXActive||0==i.isInnerInPlace()?r=0:"right"==s&&u.left>0?r/=3:"left"==s&&u.right<o.objParentSize.width&&(r/=3);var d=u.left+r,_=u.top+a;n.placeElement(o.objImage,d,_)}(e)}function b(e,t,o,a){return 0==r.slider_zoom_mousewheel||(0==i.isCurrentSlideType("image")||(e.preventDefault(),void u(1==t>0?"in":"out",n.getMousePosition(e))))}this.________EXTERNAL_____________=function(){},this.isPanEnabled=function(e,t){if(l(),null==o.objImage||0==o.objImage.length)return!1;if(0==o.isZoomedOnce)return!1;if(0==d(o.objImage,e))return!1;if(0==i.isInnerInPlace())return!1;if("left"==t){if(o.objImageSize.right<=o.objParentSize.width)return!1}else if(o.objImageSize.left>=0)return!1;return!0},this.init=function(e,t){a(e,t)},this.zoomIn=function(){u("in")},this.zoomOut=function(){u("out")},this.zoomBack=function(){u("back")}}function UGWistiaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=!1;function o(){return"undefined"!=typeof Wistia}function a(e,o,a,s,l){t=null,r=!1;var u=e+"_video",d="<div id='"+u+"' class='wistia_embed' style='width:"+a+";height:"+s+";' data-video-width='"+a+"' data-video-height='"+s+"'> </div>";jQuery("#"+e).html(d),t=Wistia.embed(o,{version:"v1",videoWidth:a,videoHeight:s,container:u,autoPlay:l}),r=!0,t.bind("play",function(){n.trigger(i.events.START_PLAYING)}),t.bind("pause",function(){n.trigger(i.events.STOP_PLAYING)}),t.bind("end",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugWistiaAPI.isAPILoaded||(o()?(g_ugWistiaAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("fast.wistia.com/assets/external/E-v1.js",!0),void(g_ugWistiaAPI.isAPILoaded=!0)))},this.doCommand=function(e){if(null==t)return!1;if(0==r)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.putVideo=function(t,i,n,r,s,l){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!r||!t)}}function UGSoundCloudAPI(){this.isAPILoaded=!1;var e,t,i,n=this,r=jQuery(this);function o(){return"undefined"!=typeof SC}function a(e,o,a,s,l){t=null,g_isPlayerReady=!1;var u=e+"_iframe",d=location.protocol+"//w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/"+o;d+="&buying=false&liking=false&download=false&sharing=false&show_artwork=true&show_comments=false&show_playcount=true&show_user=false&hide_related=true&visual=true&start_track=0&callback=true";var _="<iframe id='"+u+"' src="+(d+=!0===l?"&auto_play=true":"&auto_play=false")+" width='"+a+"' height='"+s+"' frameborder='0' scrolling='no' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(_),(t=SC.Widget(u)).bind(SC.Widget.Events.READY,function(){t&&(g_isPlayerReady=!0,t.bind(SC.Widget.Events.PLAY,function(){r.trigger(n.events.START_PLAYING)}),t.bind(SC.Widget.Events.PAUSE,function(){r.trigger(n.events.STOP_PLAYING)}),t.bind(SC.Widget.Events.FINISH,function(){r.trigger(n.events.STOP_PLAYING),r.trigger(n.events.VIDEO_ENDED)}))}),i=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugSoundCloudAPI.isAPILoaded||(o()?(g_ugSoundCloudAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("w.soundcloud.com/player/api.js",!0),void(g_ugSoundCloudAPI.isAPILoaded=!0)))},this.putSound=function(t,i,n,r,s){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){n.doCommand("pause")},this.play=function(){n.doCommand("play")},this.destroy=function(){g_isPlayerReady=!1,t=null,i&&(jQuery("#"+i).html(""),i=null)}}function UGHtml5MediaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this);function r(){return"undefined"!=typeof mejs}function o(e,r,o,a,s){t=null,g_isPlayerReady=!1;var l=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/flashmediaelement-cdn.swf",u=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/silverlightmediaelement.xap",d=e+"_video",_="";s&&!0===s&&(_="autoplay='autoplay'");var g="";r.posterImage&&(g="poster='"+r.posterImage+"'");var c="<video id='"+d+"' width='"+o+"' height='"+a+"' controls='controls' preload='none' "+_+" "+g+">";""!=r.mp4&&(c+="<source type='video/mp4' src='"+r.mp4+"' />"),""!=r.webm&&(c+="<source type='video/webm' src='"+r.webm+"' />"),""!=r.ogv&&(c+="<source type='video/ogg' src='"+r.ogv+"' />"),c+="<object width='"+o+"' height='"+a+"' type='application/x-shockwave-flash' data='"+l+"'>",c+="<param name='movie' value='"+l+"' />",c+="<param name='flashvars' value='controls=true&file="+r.mp4+"' />",c+="</object>",c+="</video>",jQuery("#"+e).html(c),new MediaElement(d,{enablePluginDebug:!1,flashName:l,silverlightName:u,success:function(e,r){g_isPlayerReady=!0,t=e,0==s&&t.pause(),g_ugFunctions.addEvent(t,"play",function(){n.trigger(i.events.START_PLAYING)}),g_ugFunctions.addEvent(t,"pause",function(){n.trigger(i.events.STOP_PLAYING)}),g_ugFunctions.addEvent(t,"ended",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})},error:function(e){trace(e)}})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugHtml5MediaAPI.isAPILoaded||(r()?(g_ugHtml5MediaAPI.isAPILoaded=!0,!0):(!0!==e&&(g_ugFunctions.loadJs("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelement.min.js",!0),g_ugFunctions.loadCss("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelementplayer.min.css",!0)),void(g_ugHtml5MediaAPI.isAPILoaded=!0)))},this.putVideo=function(t,i,n,a,s){if(r())return o(t,i,n,a,s),!0;this.loadAPI(),e=setInterval(function(){r()&&(o(t,i,n,a,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")}}function UGVimeoAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=null,o=!1,a=!1;function s(){return"undefined"!=typeof Froogaloop}function l(e,s,l,u,d){r=null,o=!1;var _=location.protocol+"//player.vimeo.com/video/"+s+"?api=1";!0===d&&(_+="&byline=0&autoplay=1&title=0&portrait=0");var g="<iframe src="+_+" width='"+l+"' height='"+u+"' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(g);var c=jQuery("#"+e+" iframe")[0];(r=Froogaloop(c)).addEvent("ready",function(){r&&(o=!0,function(){if(!r)return!1;r.addEvent("cuechange",function(){1==a&&i.play()}),r.addEvent("play",function(){n.trigger(i.events.START_PLAYING)}),r.addEvent("pause",function(){n.trigger(i.events.STOP_PLAYING)}),r.addEvent("finish",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}())}),t=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugVimeoAPI.isAPILoaded||(s()?(g_ugVimeoAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("f.vimeocdn.com/js/froogaloop2.min.js",!0),void(g_ugVimeoAPI.isAPILoaded=!0)))},this.doCommand=function(e){return null!=r&&(0!=o&&void r.api(e))},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.destroy=function(){r&&(r.api("unload"),r=null,o=!1),t&&jQuery("#"+t).html("")},this.putVideo=function(t,i,n,r,o){if(s())return l(t,i,n,r,o),!0;this.loadAPI(),e=setInterval(function(){s()&&(l(t,i,n,r,o),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!o||!r)},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;a=t,r.api("loadVideo",e)},this.getVideoImages=function(e,t,i){var n=location.protocol+"//vimeo.com/api/v2/video/"+e+".json";jQuery.get(n,{},function(e){var n={};n.preview=e[0].thumbnail_large,n.thumb=e[0].thumbnail_medium,i(t,n)})}}function UGYoutubeAPI(){this.isAPILoaded=!1;var e,t,i=this,n=null,r=!1,o=jQuery(this),a=-1,s=new UGFunctions,l={video_youtube_showinfo:!0};function u(e,i,o,a,u,d){n&&r&&n.destroy();var c={controls:1,showinfo:l.video_youtube_showinfo,start:0,rel:0};!0===u&&(c.autoplay=1);var h=s.getVal(d,"start");h&&jQuery.isNumeric(h)&&(c.start=h),r=!1,n=new YT.Player(e,{height:a,width:o,videoId:i,playerVars:c,events:{onReady:_,onStateChange:g}}),t=e}function d(){return"undefined"!=typeof YT&&void 0!==YT.Player}function _(){r=!0}function g(){if("function"!=typeof n.getPlayerState)return trace("Youtube API error: can't get player state"),!1;var e=n.getPlayerState();switch(e){case YT.PlayerState.PLAYING:o.trigger(i.events.START_PLAYING);break;case YT.PlayerState.ENDED:o.trigger(i.events.STOP_PLAYING),o.trigger(i.events.VIDEO_ENDED);break;default:a==YT.PlayerState.PLAYING&&o.trigger(i.events.STOP_PLAYING)}a=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.setOptions=function(e){l=jQuery.extend(l,e)},this.putVideo=function(t,i,n,r,o,a){if(d())return u(t,i,n,r,o,a),!0;this.loadAPI(),e=setInterval(function(){d()&&(u(t,i,n,r,o,a),clearInterval(e))},500)},this.loadAPI=function(e){return 1==g_ugYoutubeAPI.isAPILoaded||("undefined"!=typeof YT?(g_ugYoutubeAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("https://www.youtube.com/player_api",!1),void(g_ugYoutubeAPI.isAPILoaded=!0)))},this.doCommand=function(e,t){if(!n)return!0;if(0==r)return!1;switch(e){case"play":if("function"!=typeof n.playVideo)return!1;n.playVideo();break;case"pause":if("function"!=typeof n.pauseVideo)return!1;n.pauseVideo();break;case"seek":if("function"!=typeof n.seekTo)return!1;n.seekTo(t);break;case"stopToBeginning":var i=n.getPlayerState();switch(n.pauseVideo(),i){case YT.PlayerState.PLAYING:case YT.PlayerState.ENDED:case YT.PlayerState.PAUSED:n.seekTo(0)}}},this.play=function(){i.doCommand("play")},this.pause=function(){i.doCommand("pause")},this.destroy=function(){try{n&&(r=!1,n.clearVideo(),n.destroy())}catch(e){jQuery("#"+t).html("")}},this.stopToBeginning=function(){i.doCommand("stopToBeginning")},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;t&&1==t?n.loadVideoById(e,0,"large"):n.cueVideoById(e,0,"large")},this.isPlayerReady=function(){return!(!r||!n)},this.getVideoImages=function(e){var t={};return t.preview="https://i.ytimg.com/vi/"+e+"/sddefault.jpg",t.thumb="https://i.ytimg.com/vi/"+e+"/default.jpg",t}}function UGVideoPlayer(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UGFunctions,_=new UGYoutubeAPI,g=new UGVimeoAPI,c=new UGHtml5MediaAPI,h=new UGSoundCloudAPI,p=new UGWistiaAPI,m=null,f={video_enable_closebutton:!0};this.events={SHOW:"video_show",HIDE:"video_hide",PLAY_START:"video_play_start",PLAY_STOP:"video_play_stop",VIDEO_ENDED:"video_ended"};var b={standAloneMode:!1,youtubeInnerID:"",vimeoPlayerID:"",html5PlayerID:"",wistiaPlayerID:"",soundCloudPlayerID:""};function v(){l.hide()}function y(){u.trigger(l.events.PLAY_START),o&&o.hide()}function I(){u.trigger(l.events.PLAY_STOP),o&&o.show()}function w(){u.trigger(l.events.VIDEO_ENDED)}function E(e){var t=["youtube","vimeo","html5","soundcloud","wistia"];for(var o in t){var l=t[o];if(l!=e)switch(l){case"youtube":_.pause(),_.destroy(),i.hide();break;case"vimeo":g.pause(),g.destroy(),n.hide();break;case"html5":c.pause(),r.hide();break;case"soundcloud":h.pause(),h.destroy(),a.hide();break;case"wistia":p.pause(),s.hide()}}}this.init=function(t,i,n){if(!(e=n))throw new Error("missing gallery ID for video player, it's a must!");f=jQuery.extend(f,t),_.setOptions(f),i&&1==i&&(b.standAloneMode=!0)},this.setHtml=function(l){b.youtubeInnerID=e+"_youtube_inner",b.vimeoPlayerID=e+"_videoplayer_vimeo",b.html5PlayerID=e+"_videoplayer_html5",b.wistiaPlayerID=e+"_videoplayer_wistia",b.soundCloudPlayerID=e+"_videoplayer_soundcloud";var u="<div class='ug-videoplayer' style='display:none'>";u+="<div class='ug-videoplayer-wrapper ug-videoplayer-youtube' style='display:none'><div id='"+b.youtubeInnerID+"'></div></div>",u+="<div id='"+b.vimeoPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-vimeo' style='display:none'></div>",u+="<div id='"+b.html5PlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-html5'></div>",u+="<div id='"+b.soundCloudPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-soundcloud'></div>",u+="<div id='"+b.wistiaPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-wistia'></div>",0==b.standAloneMode&&1==f.video_enable_closebutton&&(u+="<div class='ug-videoplayer-button-close'></div>"),u+="</div>",l.append(u),t=l.children(".ug-videoplayer"),i=t.children(".ug-videoplayer-youtube"),n=t.children(".ug-videoplayer-vimeo"),r=t.children(".ug-videoplayer-html5"),a=t.children(".ug-videoplayer-soundcloud"),s=t.children(".ug-videoplayer-wistia"),0==b.standAloneMode&&1==f.video_enable_closebutton&&(o=t.children(".ug-videoplayer-button-close"))},this.destroy=function(){o&&(o.off("click"),o.off("touchend")),jQuery(_).off(_.events.START_PLAYING),jQuery(_).off(_.events.STOP_PLAYING),jQuery(g).off(g.events.START_PLAYING),jQuery(g).off(g.events.STOP_PLAYING),jQuery(c).off(c.events.START_PLAYING),jQuery(c).off(c.events.STOP_PLAYING),jQuery(h).off(h.events.START_PLAYING,y),jQuery(h).off(h.events.STOP_PLAYING,I),jQuery(p).off(p.events.START_PLAYING,y),jQuery(p).off(p.events.STOP_PLAYING,I),m=null},this.initEvents=function(){o&&(d.setButtonMobileReady(o),d.setButtonOnClick(o,v)),jQuery(_).on(_.events.START_PLAYING,y),jQuery(_).on(_.events.STOP_PLAYING,I),jQuery(_).on(_.events.VIDEO_ENDED,w),jQuery(g).on(g.events.START_PLAYING,y),jQuery(g).on(g.events.STOP_PLAYING,I),jQuery(g).on(g.events.VIDEO_ENDED,w),jQuery(c).on(c.events.START_PLAYING,y),jQuery(c).on(c.events.STOP_PLAYING,I),jQuery(c).on(c.events.VIDEO_ENDED,w),jQuery(h).on(h.events.START_PLAYING,y),jQuery(h).on(h.events.STOP_PLAYING,I),jQuery(h).on(h.events.VIDEO_ENDED,w),jQuery(p).on(p.events.START_PLAYING,y),jQuery(p).on(p.events.STOP_PLAYING,I),jQuery(p).on(p.events.VIDEO_ENDED,w)},this.setSize=function(e,i){d.setElementSize(t,e,i),o&&d.placeElement(o,"right","top")},this.setPosition=function(e,i){d.placeElement(t,e,i)},this.getObject=function(){return t},this.show=function(){if(1==l.isVisible())return!0;t.show(),t.fadeTo(0,1),o&&o.show(),u.trigger(l.events.SHOW)},this.hide=function(){if(0==l.isVisible())return!0;E(),m=null,t.hide(),u.trigger(l.events.HIDE)},this.getActiveAPI=function(){switch(m){case"youtube":return _;case"vimeo":return g;case"wistia":return p;case"soundcloud":return h;case"html5":return c;default:return null}},this.pause=function(){var e=l.getActiveAPI();if(null==e)return!1;"function"==typeof e.pause&&e.pause()},this.isVisible=function(){return t.is(":visible")},this.playYoutube=function(e,t,n){if(void 0===t)t=!0;if(!n)n=null;E("youtube"),i.show(),0==i.children("#"+b.youtubeInnerID).length&&i.append("<div id='"+b.youtubeInnerID+"'></div>");var r={};n&&(r.start=n),1==_.isPlayerReady()&&1==b.standAloneMode?_.changeVideo(e,t):_.putVideo(b.youtubeInnerID,e,"100%","100%",t,r),m="youtube"},this.playVimeo=function(e,t){if(void 0===t)t=!0;E("vimeo"),n.show(),g.putVideo(b.vimeoPlayerID,e,"100%","100%",t),m="vimeo"},this.playHtml5Video=function(e,t,i,n,o){if(void 0===o)o=!0;E("html5"),r.show();var a={ogv:e,webm:t,mp4:i,posterImage:n};c.putVideo(b.html5PlayerID,a,"100%","100%",o),m="html5"},this.playSoundCloud=function(e,t){if(void 0===t)t=!0;E("soundcloud"),a.show(),h.putSound(b.soundCloudPlayerID,e,"100%","100%",t),m="soundcloud"},this.playWistia=function(e,t){if(void 0===t)t=!0;E("wistia"),s.show(),p.putVideo(b.wistiaPlayerID,e,"100%","100%",t),m="wistia"}}var g_ugYoutubeAPI=new UGYoutubeAPI,g_ugVimeoAPI=new UGVimeoAPI,g_ugHtml5MediaAPI=new UGHtml5MediaAPI,g_ugSoundCloudAPI=new UGSoundCloudAPI,g_ugWistiaAPI=new UGWistiaAPI;function ugCheckForMinJQueryVersion(){if(0==g_ugFunctions.checkMinJqueryVersion("1.8.0"))throw new Error("The gallery can run from jquery 1.8 You have jQuery "+jQuery.fn.jquery+" Please update your jQuery library.")}function ugCheckForErrors(e,t){try{"jquery"==t?(!function(){if("undefined"==typeof jQuery)throw new Error("jQuery library not included")}(),ugCheckForMinJQueryVersion()):(ugCheckForMinJQueryVersion(),function(){if("function"==typeof jQuery.fn.unitegallery)return!0;var e="You have some jquery.js library include that comes after the gallery files js include.";throw e+="<br> This include eliminates the gallery libraries, and make it not work.","cms"==t?(e+="<br><br> To fix it you can:<br> 1. In the Gallery Settings -> Troubleshooting set option: <strong><b>Put JS Includes To Body</b></strong> option to true.",e+="<br> 2. Find the double jquery.js include and remove it."):e+="<br><br> Please find and remove this jquery.js include and the gallery will work. <br> * There should be only one jquery.js include before all other js includes in the page.",new Error(e)}())}catch(r){var i=r.message;if(i="<div style='font-size:16px;color:#BC0C06;max-width:900px;border:1px solid red;padding:10px;'>"+(i="Unite Gallery Error: "+i)+"</div>","jquery"==t){var n=document.getElementById(e);n.innerHTML=i,n.style.display="block"}else jQuery(e).show().html(i);return!1}return!0}function UniteGalleryMain(){var t=this,g_galleryID,g_objGallery=jQuery(t),g_objWrapper,g_objParent,g_objThumbs,g_objSlider,g_objLightbox,g_functions=new UGFunctions,g_objTabs,g_objLoadMore,g_arrItems=[],g_numItems,g_selectedItem=null,g_selectedItemIndex=-1,g_objTheme,g_objCache={};this.events={ITEM_CHANGE:"item_change",SIZE_CHANGE:"size_change",ENTER_FULLSCREEN:"enter_fullscreen",EXIT_FULLSCREEN:"exit_fullscreen",START_PLAY:"start_play",STOP_PLAY:"stop_play",PAUSE_PLAYING:"pause_playing",CONTINUE_PLAYING:"continue_playing",SLIDER_ACTION_START:"slider_action_start",SLIDER_ACTION_END:"slider_action_end",ITEM_IMAGE_UPDATED:"item_image_updated",GALLERY_KEYPRESS:"gallery_keypress",GALLERY_BEFORE_REQUEST_ITEMS:"gallery_before_request_items",OPEN_LIGHTBOX:"open_lightbox",CLOSE_LIGHTBOX:"close_lightbox"};var g_options={gallery_width:900,gallery_height:500,gallery_min_width:150,gallery_min_height:100,gallery_theme:"default",gallery_skin:"default",gallery_images_preload_type:"minimal",gallery_autoplay:!1,gallery_play_interval:3e3,gallery_pause_on_mouseover:!0,gallery_mousewheel_role:"zoom",gallery_control_keyboard:!0,gallery_carousel:!0,gallery_preserve_ratio:!0,gallery_background_color:"",gallery_debug_errors:!1,gallery_shuffle:!1,gallery_urlajax:null,gallery_enable_tabs:!1,gallery_enable_loadmore:!1,gallery_enable_cache:!0,gallery_initial_catid:"",load_api_externally:!1},g_temp={objCustomOptions:{},isAllItemsPreloaded:!1,isFreestyleMode:!1,lastWidth:0,lastHeigh:0,handleResize:null,isInited:!1,isPlayMode:!1,isPlayModePaused:!1,playTimePassed:0,playTimeLastStep:0,playHandle:"",playStepInterval:33,objProgress:null,isFakeFullscreen:!1,thumbsType:null,isYoutubePresent:!1,isVimeoPresent:!1,isHtml5VideoPresent:!1,isSoundCloudPresent:!1,isWistiaPresent:!1,resizeDelay:100,isRunFirstTime:!0,originalOptions:{},funcCustomHeight:null};function __________INIT_GALLERY_______(){}function getThemeFunction(e){var t=e;return-1==t.indexOf("UGTheme_")&&(t="UGTheme_"+t),t}function initTheme(objCustomOptions){if(objCustomOptions.hasOwnProperty("gallery_theme"))g_options.gallery_theme=objCustomOptions.gallery_theme;else{var defaultTheme=g_options.gallery_theme;0==g_ugFunctions.isThemeRegistered(defaultTheme)&&(g_options.gallery_theme=g_ugFunctions.getFirstRegisteredTheme())}var themeFunction=getThemeFunction(g_options.gallery_theme);try{g_options.gallery_theme=eval(themeFunction)}catch(e){}g_options.gallery_theme=eval(themeFunction),g_objTheme=new g_options.gallery_theme,g_objTheme.init(t,objCustomOptions)}function resetOptions(){g_options=jQuery.extend({},g_temp.originalOptions),g_selectedItemIndex=-1,g_selectedItem=null,g_objSlider=void 0,g_objThumbs=void 0,g_objLightbox=void 0}function checkForStartupErrors(){try{ugCheckForMinJQueryVersion()}catch(e){throwErrorShowMessage(e.message)}"object"==typeof g_objWrapper.outerWidth()&&throwErrorShowMessage("You have some buggy script. most chances jquery-ui.js that destroy jquery outerWidth, outerHeight functions. The gallery can't run. Please update jquery-ui.js to latest version."),setTimeout(function(){ugCheckForErrors(g_galleryID,"cms")},5e3)}function runGallery(e,i,n,r){var o="object"==typeof i;if(o&&(g_temp.objCustomOptions=i),1==g_temp.isRunFirstTime){if(g_galleryID=e,0==(g_objWrapper=jQuery(g_galleryID)).length)return trace("div with id: "+g_galleryID+" not found"),!1;g_objParent=g_objWrapper.parent(),checkForStartupErrors(),g_temp.originalOptions=jQuery.extend({},g_options),o&&(g_options=jQuery.extend(g_options,i)),1==g_options.gallery_enable_cache&&g_options.gallery_initial_catid&&cacheItems(g_options.gallery_initial_catid),t.setSizeClass(),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.find("img").fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}else if(t.destroy(),resetOptions(),g_options=jQuery.extend(g_options,g_temp.objCustomOptions),n){if(r&&1==g_options.gallery_enable_cache&&cacheItems(r,n),"noitems"==n)return showErrorMessage("No items in this category",""),!1;g_objWrapper.html(n),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.children().fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_tabs&&(g_objTabs=new UGTabs).init(t,g_options),1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_loadmore&&(g_objLoadMore=new UGLoadMore).init(t,g_options),o&&modifyInitParams(g_temp.objCustomOptions),validateParams(),1==g_options.gallery_shuffle&&t.shuffleItems(),initTheme(g_temp.objCustomOptions),setGalleryHtml(),setHtmlObjectsProperties(),0==g_objWrapper.width()?g_functions.waitForWidth(g_objWrapper,runGalleryActually):runGalleryActually()}function runGalleryActually(){t.setSizeClass(),0==g_temp.isFreestyleMode&&1==g_options.gallery_preserve_ratio&&setHeightByOriginalRatio(),g_objTheme.run(),g_objTabs&&g_temp.isRunFirstTime&&g_objTabs.run(),preloadBigImages(),initEvents(),g_numItems>0&&t.selectItem(0),1==g_options.gallery_autoplay&&t.startPlayMode(),g_temp.isRunFirstTime=!1}function showErrorMessage(e,t){if(void 0===t)t="<b>Unite Gallery Error: </b>";else t="<b>"+t+": </b>";var i="<div class='ug-error-message-wrapper'><div class='ug-error-message'>"+(e=t+e)+"</div></div>";g_objWrapper.children().remove(),g_objWrapper.html(i),g_objWrapper.show()}function throwErrorShowMessage(e){throw showErrorMessage(e),new Error(e)}function modifyInitParams(){g_options.gallery_images_preload_type||(g_options.gallery_images_preload_type="minimal"),(null==g_options.gallery_min_height||g_options.gallery_height<g_options.gallery_min_height)&&(g_options.gallery_min_height=0),(null==g_options.gallery_min_width||g_options.gallery_width<g_options.gallery_min_width)&&(g_options.gallery_min_width=0)}function validateParams(){if(!g_options.gallery_theme)throw new Error("The gallery can't run without theme");if(jQuery.isNumeric(g_options.gallery_height)&&g_options.gallery_height<g_options.gallery_min_height)throw new Error("The <b>gallery_height</b> option must be bigger then <b>gallery_min_height option</b>");if(g_options.gallery_width<g_options.gallery_min_width)throw new Error("The <b>gallery_width</b> option must be bigger then <b>gallery_min_width option</b>")}function setGalleryHtml(){g_objWrapper.addClass("ug-gallery-wrapper"),g_objWrapper.append("<div class='ug-overlay-disabled' style='display:none'></div>"),t.setSizeClass()}function clearInitData(){g_objWrapper.children().remove()}function storeLastSize(){var e=t.getSize();g_temp.lastWidth=e.width,g_temp.lastHeight=e.height}function setHeightByOriginalRatio(){var e=t.getSize();if(e.width/e.height!=e.orig_ratio){var i=e.width/e.orig_ratio;(i=Math.round(i))<g_options.gallery_min_height&&(i=g_options.gallery_min_height),g_objWrapper.height(i)}}function setHtmlObjectsProperties(){var e={"max-width":g_functions.getCssSizeParam(g_options.gallery_width),"min-width":g_functions.getCssSizeParam(g_options.gallery_min_width)};if(0==g_temp.isFreestyleMode){var t=g_functions.getCssSizeParam(g_options.gallery_height);e.height=t}else e.overflow="visible";g_options.gallery_background_color&&(e["background-color"]=g_options.gallery_background_color),g_objWrapper.css(e)}function fillItemByChild(e){var i=t.isMobileMode();if("noscript"==(a=e.prop("tagName").toLowerCase()))return null;if("picture"==a){var n=e.find("img");if(0==n.length)return null;e=n,a="img"}var r=e.data("lazy-src");r&&e.attr("src",r);var o="";if("a"==a){o=e.attr("href");var a=(e=e.children("img:first-child")).prop("tagName").toLowerCase()}var s=e.data("type");null==s&&(s="image");var l={};if(l.type=s,"img"==a){if(!(u=e.data("lazyload-src")))var u=e.data("lazy-src");u&&""!=u&&(e.attr("src",u),jQuery.removeData(e,"lazyload-src"));var d=e.data("image"),_=e.data("thumb"),g=e.data("title");void 0===d&&(d=null),void 0===_&&(_=null);var c=e.attr("src");d||(d=c),_||(_=c),_||(_=d),d||(d=_),l.urlThumb=_,l.urlImage=d,l.title=e.attr("alt"),g&&(l.title=g),l.objThumbImage=e,l.objThumbImage.attr("src",l.urlThumb)}else{if("image"==s)throw trace("Problematic gallery item found:"),trace(e),trace("Please look for some third party js script that could add this item to the gallery"),new Error("The item should not be image type");l.urlThumb=e.data("thumb"),l.title=e.data("title"),l.objThumbImage=null,l.urlImage=e.data("image")}if(1==i){var h=e.data("thumb-mobile");void 0!==h&&""!=h&&(l.urlThumb=h,"img"==a&&e.attr("src",l.urlThumb));var p=e.data("image-mobile");void 0!==p&&""!=p&&(l.urlImage=p)}l.link=o,l.description=e.attr("title"),l.description||(l.description=e.data("description")),l.description||(l.description=""),l.isNewAdded=!1,l.isLoaded=!1,l.isThumbImageLoaded=!1,l.objPreloadImage=null,l.isBigImageLoadStarted=!1,l.isBigImageLoaded=!1,l.isBigImageLoadError=!1,l.imageWidth=0,l.imageHeight=0,l.thumbWidth=0,l.thumbHeight=0,l.thumbRatioByWidth=0,l.thumbRatioByHeight=0;var m=e.data("width"),f=e.data("height");m&&"number"==typeof m&&f&&"number"==typeof f&&(l.thumbWidth=m,l.thumbHeight=f,l.thumbRatioByWidth=m/f,l.thumbRatioByHeight=f/m),l.addHtml=null;var b=null==l.urlImage||""==l.urlImage,v=null==l.urlThumb||""==l.urlThumb;switch(l.type){case"youtube":if(l.videoid=e.data("videoid"),l.video_start=e.data("start"),b||v){var y=g_ugYoutubeAPI.getVideoImages(l.videoid);b&&(l.urlImage=y.preview),v&&(l.urlThumb=y.thumb,"img"==a&&e.attr("src",l.urlThumb))}g_temp.isYoutubePresent=!0;break;case"vimeo":l.videoid=e.data("videoid"),g_temp.isVimeoPresent=!0;break;case"html5video":l.videoogv=e.data("videoogv"),l.videowebm=e.data("videowebm"),l.videomp4=e.data("videomp4"),g_temp.isHtml5VideoPresent=!0;break;case"soundcloud":l.trackid=e.data("trackid"),g_temp.isSoundCloudPresent=!0;break;case"wistia":l.videoid=e.data("videoid"),g_temp.isWistiaPresent=!0;break;case"custom":var I=e.children("img");I.length&&(I=jQuery(I[0]),l.urlThumb=I.attr("src"),l.title=I.attr("alt"),l.objThumbImage=I);var w=e.children().not("img:first-child");w.length&&(l.addHtml=w.clone())}return l.objThumbImage&&(l.objThumbImage.removeAttr("data-description",""),l.objThumbImage.removeAttr("data-image",""),l.objThumbImage.removeAttr("data-thumb",""),l.objThumbImage.removeAttr("title","")),l}function fillItemsArray(e,t){if(!0!==t)g_arrItems=[];else for(var i=0;i<g_numItems;i++)g_arrItems[i].isNewAdded=!1;for(i=0;i<e.length;i++){var n=jQuery(e[i]),r=fillItemByChild(n);null!==r?(numIndex=g_arrItems.length,r.index=numIndex,!0===t&&(r.isNewAdded=!0),g_arrItems.push(r)):n.remove()}g_numItems=g_arrItems.length}function loadAPIs(){var e=g_options.load_api_externally;g_temp.isYoutubePresent&&g_ugYoutubeAPI.loadAPI(e),g_temp.isVimeoPresent&&g_ugVimeoAPI.loadAPI(e),g_temp.isHtml5VideoPresent&&g_ugHtml5MediaAPI.loadAPI(e),g_temp.isSoundCloudPresent&&g_ugSoundCloudAPI.loadAPI(e),g_temp.isWistiaPresent&&g_ugWistiaAPI.loadAPI(e)}function preloadBigImages(){if("visible"!=g_options.gallery_images_preload_type||g_objThumbs||(g_options.gallery_images_preload_type="minimal"),1==g_temp.isAllItemsPreloaded)return!0;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":jQuery(g_arrItems).each(function(){preloadItemImage(this)});break;case"visible":jQuery(g_arrItems).each(function(){1==g_objThumbs.isItemThumbVisible(this)&&preloadItemImage(this)})}}function checkPreloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!1;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":preloadItemImage(e);break;case"visible":1==g_objThumbs.isItemThumbVisible(e)&&preloadItemImage(e)}}function preloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!0;var i=e.urlImage;if(""==i||null==i)return e.isBigImageLoadError=!0,!1;e.isBigImageLoadStarted=!0,e.objPreloadImage=jQuery("<img/>").attr("src",i),e.objPreloadImage.data("itemIndex",e.index),e.objPreloadImage.on("load",t.onItemBigImageLoaded),e.objPreloadImage.on("error",function(){var e=jQuery(this).data("itemIndex"),i=g_arrItems[e];i.isBigImageLoadError=!0,i.isBigImageLoaded=!1;var n=jQuery(this).attr("src");console.log("Can't load image: "+n),g_objGallery.trigger(t.events.ITEM_IMAGE_UPDATED,[e,i.urlImage]),i.objThumbImage.attr("src",i.urlThumb)}),checkAllItemsStartedPreloading()}function preloadNearBigImages(e){if(1==g_temp.isAllItemsPreloaded)return!1;if(!e)e=g_selectedItem;if(!e)return!0;var t=e.index,i=t-1,n=t+1;i>0&&preloadItemImage(g_arrItems[i]),n<g_numItems&&preloadItemImage(g_arrItems[n])}function checkAllItemsStartedPreloading(){if(1==g_temp.isAllItemsPreloaded)return!1;for(var e in g_arrItems)if(0==g_arrItems[e].isBigImageLoadStarted)return!1;g_temp.isAllItemsPreloaded=!0}function __________END_INIT_GALLERY_______(){}function __________EVENTS_____________(){}function onSliderMouseEnter(e){1==g_options.gallery_pause_on_mouseover&&0==t.isFullScreen()&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&t.pausePlaying()}function onSliderMouseLeave(e){1==g_options.gallery_pause_on_mouseover&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&(0==g_objSlider.isCurrentSlideLoadingImage()&&t.continuePlaying())}function isThisGalleryForKeyAction(){if(!window.ugArrGalleriesObjects)return!0;window.ugArrGalleriesObjects.length;if(1==window.ugArrGalleriesObjects.length)return!0;var e,i=0,n=t.getGalleryID();return jQuery.each(window.ugArrGalleriesObjects,function(t,r){var o=r.getGalleryID(),a=r.getKeyPressScore();a>i&&(i=a),o==n&&(e=a)}),e==i}function onKeyPress(e){var i=jQuery(e.target);if(i.is("textarea")||i.is("select")||i.is("input"))return!0;var n=e.charCode?e.charCode:e.keyCode?e.keyCode:e.which?e.which:0,r=!1;switch(n){case 39:1==isThisGalleryForKeyAction()&&(t.nextItem(),r=!0);break;case 37:1==isThisGalleryForKeyAction()&&(t.prevItem(),r=!0);break;default:r=!1}1==r&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()),g_objGallery.trigger(t.events.GALLERY_KEYPRESS,[n,e])}function onGalleryResized(){var e;if(0==(e=t.getSize()).width)return!0;if(t.setSizeClass(),(e=t.getSize()).width!=g_temp.lastWidth||0==g_temp.isFreestyleMode&&e.height!=g_temp.lastHeight){var i=!1;if(g_temp.funcCustomHeight){var n=g_temp.funcCustomHeight(e);n&&(g_objWrapper.height(n),i=!0)}0==i&&1==g_options.gallery_preserve_ratio&&0==g_temp.isFreestyleMode&&setHeightByOriginalRatio(),storeLastSize(),g_objGallery.trigger(t.events.SIZE_CHANGE)}}function onThumbsChange(e){"visible"==g_options.gallery_images_preload_type&&0==g_temp.isAllItemsPreloaded&&preloadBigImages()}function onFullScreenChange(){var e=g_functions.isFullScreen(),i=e?t.events.ENTER_FULLSCREEN:t.events.EXIT_FULLSCREEN,n=g_functions.getGlobalData("fullscreenID");if(g_galleryID!==n)return!0;e?g_objWrapper.addClass("ug-fullscreen"):g_objWrapper.removeClass("ug-fullscreen"),g_objGallery.trigger(i),onGalleryResized()}function onItemImageUpdated(e,i){checkPreloadItemImage(t.getItem(i))}function onCurrentSlideImageLoadEnd(){1==t.isPlayMode()&&t.continuePlaying()}function initEvents(){if(g_objWrapper.on("dragstart",function(e){e.preventDefault()}),g_objGallery.on(t.events.ITEM_IMAGE_UPDATED,onItemImageUpdated),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).on(g_objThumbs.events.STRIP_MOVE,onThumbsChange);break;case"grid":jQuery(g_objThumbs).on(g_objThumbs.events.PANE_CHANGE,onThumbsChange)}if("advance"==g_options.gallery_mousewheel_role&&0==g_temp.isFreestyleMode&&g_objWrapper.on("mousewheel",t.onGalleryMouseWheel),storeLastSize(),jQuery(window).resize(function(){g_objWrapper.css("width","auto"),g_functions.whenContiniousEventOver("gallery_resize",onGalleryResized,g_temp.resizeDelay)}),setTimeout(function(){setInterval(onGalleryResized,2e3)},1e4),g_functions.addFullScreenChangeEvent(onFullScreenChange),g_objSlider){if(jQuery(g_objSlider).on(g_objSlider.events.ITEM_CHANGED,function(){var e=g_objSlider.getCurrentItemIndex();-1!=e&&t.selectItem(e)}),1==g_options.gallery_pause_on_mouseover)g_objSlider.getElement().hover(onSliderMouseEnter,onSliderMouseLeave),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){onSliderMouseLeave()});retriggerEvent(g_objSlider,g_objSlider.events.ACTION_START,t.events.SLIDER_ACTION_START),retriggerEvent(g_objSlider,g_objSlider.events.ACTION_END,t.events.SLIDER_ACTION_END),jQuery(g_objSlider).on(g_objSlider.events.CURRENTSLIDE_LOAD_END,onCurrentSlideImageLoadEnd)}1==g_options.gallery_control_keyboard&&jQuery(document).keydown(onKeyPress)}function __________GENERAL_______(){}function cacheItems(e,t){if(t)"noitems"!=(i=t)&&(i=jQuery(t).clone());else var i=g_objWrapper.children().clone();g_objCache[e]=i}function removeAllSizeClasses(e){e||(e=g_objWrapper),e.removeClass("ug-under-480"),e.removeClass("ug-under-780"),e.removeClass("ug-under-960")}function retriggerEvent(e,t,i){jQuery(e).on(t,function(e){g_objGallery.trigger(i,[this])})}function advanceNextStep(){var e=jQuery.now(),i=e-g_temp.playTimeLastStep;if(g_temp.playTimeLastStep=e,0==t.isGalleryVisible())return!1;if(g_temp.playTimePassed+=i,g_temp.objProgress){var n=g_temp.playTimePassed/g_options.gallery_play_interval;g_temp.objProgress.setProgress(n)}g_temp.playTimePassed>=g_options.gallery_play_interval&&(t.nextItem(),g_temp.playTimePassed=0)}function unselectSeletedItem(){if(null==g_selectedItem)return!0;g_objThumbs&&g_objThumbs.setThumbUnselected(g_selectedItem.objThumbWrapper),g_selectedItem=null,g_selectedItemIndex=-1}function toFakeFullScreen(){jQuery("body").addClass("ug-body-fullscreen"),g_objWrapper.addClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!0,g_objGallery.trigger(t.events.ENTER_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}function exitFakeFullscreen(){jQuery("body").removeClass("ug-body-fullscreen"),g_objWrapper.removeClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!1,g_objGallery.trigger(t.events.EXIT_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}this.onItemBigImageLoaded=function(e,t){if(!t)t=jQuery(this);var i=t.data("itemIndex"),n=g_arrItems[i];n.isBigImageLoaded=!0;var r=g_functions.getImageOriginalSize(t);n.imageWidth=r.width,n.imageHeight=r.height},this.checkFillImageSize=function(e,t){if(!t){var i=e.data("itemIndex");if(void 0===i)throw new Error("Wrong image given to gallery.checkFillImageSize");t=g_arrItems[i]}var n=g_functions.getImageOriginalSize(e);t.imageWidth=n.width,t.imageHeight=n.height},this.setFreestyleMode=function(){g_temp.isFreestyleMode=!0},this.attachThumbsPanel=function(e,t){g_temp.thumbsType=e,g_objThumbs=t},this.initSlider=function(e,i){if(!e)e={};e=jQuery.extend(g_temp.objCustomOptions,e),(g_objSlider=new UGSlider).init(t,e,i)},this.onGalleryMouseWheel=function(e,i,n,r){e.preventDefault(),i>0?t.prevItem():t.nextItem()},this.getKeyPressScore=function(){if(t.isGalleryInsideScreen())return 1;if(g_objLightbox&&1==g_objLightbox.isOpened())return 2;return 0},this.getGalleryID=function(){return g_galleryID},this.destroy=function(){if(g_objWrapper.off("dragstart"),g_objGallery.off(t.events.ITEM_IMAGE_UPDATED),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).off(g_objThumbs.events.STRIP_MOVE);break;case"grid":jQuery(g_objThumbs).off(g_objThumbs.events.PANE_CHANGE)}if(g_objWrapper.off("mousewheel"),jQuery(window).off("resize"),g_functions.destroyFullScreenChangeEvent(),g_objSlider){jQuery(g_objSlider).off(g_objSlider.events.ITEM_CHANGED);var e=g_objSlider.getElement();e.off("mouseenter"),e.off("mouseleave"),g_objGallery.off(t.events.ENTER_FULLSCREEN),jQuery(g_objSlider).off(g_objSlider.events.ACTION_START),jQuery(g_objSlider).off(g_objSlider.events.ACTION_END),jQuery(g_objSlider).off(g_objSlider.events.CURRENTSLIDE_LOAD_END)}1==g_options.gallery_control_keyboard&&jQuery(document).off("keydown"),g_objTheme&&"function"==typeof g_objTheme.destroy&&g_objTheme.destroy(),g_objWrapper.html("")},this.getArrItems=function(){return g_arrItems},this.getObjects=function(){return{g_galleryID:g_galleryID,g_objWrapper:g_objWrapper,g_objThumbs:g_objThumbs,g_objSlider:g_objSlider,g_options:g_options,g_arrItems:g_arrItems,g_numItems:g_numItems}},this.getObjSlider=function(){return g_objSlider},this.getItem=function(e){if(e<0)throw new Error("item with index: "+e+" not found");if(e>=g_numItems)throw new Error("item with index: "+e+" not found");return g_arrItems[e]},this.getWidth=function(){return t.getSize().width},this.getHeight=function(){return t.getSize().height},this.getSize=function(){var e=g_functions.getElementSize(g_objWrapper);return e.orig_width=g_options.gallery_width,e.orig_height=g_options.gallery_height,e.orig_ratio=e.orig_width/e.orig_height,e},this.getGalleryID=function(){return g_galleryID.replace("#","")},this.getNextItem=function(e,t){"object"==typeof e&&(e=e.index);var i=e+1;if(!0!==t&&1==g_numItems)return null;if(i>=g_numItems){if(1!=g_options.gallery_carousel&&!0!==t)return null;i=0}return g_arrItems[i]},this.getPrevItem=function(e){"object"==typeof e&&(e=e.index);var t=e-1;if(t<0){if(1!=g_options.gallery_carousel&&!0!==forceCarousel)return null;t=g_numItems-1}return g_arrItems[t]},this.getSelectedItem=function(){return g_selectedItem},this.getSelectedItemIndex=function(){return g_selectedItemIndex},this.getNumItems=function(){return g_numItems},this.isLastItem=function(){return g_selectedItemIndex==g_numItems-1},this.isFirstItem=function(){return 0==g_selectedItemIndex},this.getOptions=function(){return g_options},this.getElement=function(){return g_objWrapper},this.___________SET_CONTROLS___________=function(){},this.setNextButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.nextItem)},this.setPrevButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.prevItem)},this.setFullScreenToggleButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnTap(e,t.toggleFullscreen),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){e.addClass("ug-fullscreenmode")}),g_objGallery.on(t.events.EXIT_FULLSCREEN,function(){e.removeClass("ug-fullscreenmode")})},this.destroyFullscreenButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.ENTER_FULLSCREEN),g_objGallery.off(t.events.EXIT_FULLSCREEN)},this.setPlayButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.togglePlayMode),g_objGallery.on(t.events.START_PLAY,function(){e.addClass("ug-stop-mode")}),g_objGallery.on(t.events.STOP_PLAY,function(){e.removeClass("ug-stop-mode")})},this.destroyPlayButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.START_PLAY),g_objGallery.off(t.events.STOP_PLAY)},this.setProgressIndicator=function(e){g_temp.objProgress=e},this.setTextContainers=function(e,i){g_objGallery.on(t.events.ITEM_CHANGE,function(){var n=t.getSelectedItem();e.html(n.title),i.html(n.description)})},this.showDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").show()},this.hideDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").hide()},this.___________END_SET_CONTROLS___________=function(){},this.___________PLAY_MODE___________=function(){},this.startPlayMode=function(){if(g_temp.isPlayMode=!0,g_temp.isPlayModePaused=!1,g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval),g_temp.objProgress){var e=g_temp.objProgress.getElement();g_temp.objProgress.setProgress(0),e.show()}g_objGallery.trigger(t.events.START_PLAY),g_objSlider&&1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying()},this.resetPlaying=function(){if(0==g_temp.isPlayMode)return!0;g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now()},this.pausePlaying=function(){if(1==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!0,clearInterval(g_temp.playHandle),g_objGallery.trigger(t.events.PAUSE_PLAYING)},this.continuePlaying=function(){if(0==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!1,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval)},this.stopPlayMode=function(){(g_temp.isPlayMode=!1,clearInterval(g_temp.playHandle),g_temp.playTimePassed=0,g_temp.objProgress)&&g_temp.objProgress.getElement().hide();g_objGallery.trigger(t.events.STOP_PLAY)},this.isPlayMode=function(){return g_temp.isPlayMode},this.togglePlayMode=function(){0==t.isPlayMode()?t.startPlayMode():t.stopPlayMode()},this.___________GENERAL_EXTERNAL___________=function(){},this.shuffleItems=function(){for(var e in g_arrItems=g_functions.arrayShuffle(g_arrItems))g_arrItems[e].index=parseInt(e)},this.setOptions=function(e){g_options=jQuery.extend(g_options,e)},this.selectItem=function(e,i){"number"==typeof e&&(e=t.getItem(e));var n=e.index;if(n==g_selectedItemIndex)return!0;(unselectSeletedItem(),g_selectedItem=e,g_selectedItemIndex=n,g_objGallery.trigger(t.events.ITEM_CHANGE,[e,i]),1==g_temp.isPlayMode)&&(t.resetPlaying(),1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying())},this.nextItem=function(){var e=g_selectedItemIndex+1;return 0==g_numItems||(0==g_options.gallery_carousel&&e>=g_numItems||(e>=g_numItems&&(e=0),void t.selectItem(e,"next")))},this.prevItem=function(){var e=g_selectedItemIndex-1;return-1==g_selectedItemIndex&&(e=0),0==g_numItems||(0==g_options.gallery_carousel&&e<0||(e<0&&(e=g_numItems-1),void t.selectItem(e,"prev")))},this.isFullScreen=function(){return 1==g_temp.isFakeFullscreen||1==g_functions.isFullScreen()},this.isFakeFullscreen=function(){return g_temp.isFakeFullscreen},this.toFullScreen=function(){g_functions.setGlobalData("fullscreenID",g_galleryID);var e=g_objWrapper.get(0);0==g_functions.toFullscreen(e)&&toFakeFullScreen()},this.exitFullScreen=function(){1==g_temp.isFakeFullscreen?exitFakeFullscreen():g_functions.exitFullscreen()},this.toggleFullscreen=function(){0==t.isFullScreen()?t.toFullScreen():t.exitFullScreen()},this.resize=function(e,t,i){g_objWrapper.css("width","auto"),g_objWrapper.css("max-width",e+"px"),t&&g_objWrapper.height(t),i||!0===i||onGalleryResized()},this.setSizeClass=function(e,i){if(!e)e=g_objWrapper;if(!i)i=t.getSize().width;if(0==i)i=jQuery(window).width();var n="";if(i<=480?n="ug-under-480":i<=780?n="ug-under-780":i<960&&(n="ug-under-960"),1==e.hasClass(n))return!0;removeAllSizeClasses(e),""!=n&&e.addClass(n)},this.isMobileMode=function(){return!!g_objWrapper.hasClass("ug-under-480")},this.isSmallWindow=function(){var e=jQuery(window).width();return!e||e<=480},this.isGalleryVisible=function(){return g_objWrapper.is(":visible")},this.isGalleryInsideScreen=function(){return 1!=g_temp.isFreestyleMode&&(!!g_objSlider&&g_functions.isElementInsideScreen(g_objWrapper))},this.changeItems=function(e,t){if(!e)e="noitems";runGallery(g_galleryID,"nochange",e,t)},this.addItems=function(e){if(!e||0==e.length)return!1;var t=g_objWrapper.children(".ug-newitems-wrapper");if(0==t.length&&g_objWrapper.append("<div class='ug-newitems-wrapper' style='display:none'></div>"),(t=g_objWrapper.children(".ug-newitems-wrapper")).append(e),fillItemsArray(jQuery(t.children()),!0),loadAPIs(),!g_objTheme||"function"!=typeof g_objTheme.addItems)throw new Error("addItems function not found in the theme");t.remove(),g_objTheme.addItems()},this.getNewAddedItemsIndexes=function(){var e=[];return jQuery.each(g_arrItems,function(t,i){1==i.isNewAdded&&e.push(t)}),e},this.showErrorMessageReplaceGallery=function(e){showErrorMessage(e)},this.setFuncCustomHeight=function(e){g_temp.funcCustomHeight=e},this.setObjLightbox=function(e){g_objLightbox=e},this.__________EXTERNAL_EVENTS_______=function(){},this.triggerEvent=function(e,t){t?("array"!=jQuery.type(t)&&(t=[t]),g_objGallery.trigger(e,t)):g_objGallery.trigger(e)},this.onEvent=function(e,t){g_objGallery.on(e,t)},this.destroyEvent=function(e){g_objGallery.off(e)},this.__________AJAX_REQUEST_______=function(){},this.ajaxRequest=function(e,t,i,n){if(!i||"function"!=typeof i)throw new Error("ajaxRequest error: success function should be passed");var r=g_options.gallery_urlajax;if(!r||""==r)throw new Error("ajaxRequest error: Ajax url don't passed");if(void 0===t)t={};var o={action:"unitegallery_ajax_action",client_action:e,galleryID:g_galleryID,data:t};jQuery.ajax({type:"post",url:g_options.gallery_urlajax,dataType:"json",data:o,success:function(e){if(!e)throw new Error("Empty ajax response!");if(-1==e||0===e)throw new Error("ajax error!!!");if(void 0===e.success)throw new Error("ajax error!!!");if(0==e.success)return showErrorMessage(e.message,"ajax error"),!1;i(e)},error:function(e,t,i){console.log("Ajax Error!!! "+t),responseText=e.responseText,n&&"function"==typeof n?n(responseText):trace(responseText)}})},this.requestNewItems=function(e,i,n){var r=g_options.gallery_enable_cache;if(n||(n=e),1==i&&(r=!1),1==r&&g_objCache.hasOwnProperty(n)){var o=g_objCache[n];t.changeItems(o,n)}else g_objGallery.trigger(t.events.GALLERY_BEFORE_REQUEST_ITEMS),t.ajaxRequest("front_get_cat_items",{catid:e},function(e){var i=e.html;t.changeItems(i,n)})},this.run=function(e,t){if(t&&t.hasOwnProperty("gallery_debug_errors")&&(g_options.gallery_debug_errors=t.gallery_debug_errors),1==g_options.gallery_debug_errors)try{runGallery(e,t)}catch(e){if("object"==typeof e){var i=e.message,n=e.lineNumber,r=e.fileName;e.stack;i+=" <br><br> in file: "+r,i+=" <b> line "+n+"</b>",trace(e)}else i=e;showErrorMessage(i=i.replace("Error:",""))}else runGallery(e,t)}}function UGLightbox(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UniteGalleryMain,_=new UGSlider,g=new UGFunctions,c=new UGTextPanel,h={lightbox_type:"wide",lightbox_show_textpanel:!0,lightbox_textpanel_width:550,lightbox_hide_arrows_onvideoplay:!0,lightbox_arrows_position:"sides",lightbox_arrows_offset:10,lightbox_arrows_inside_offset:10,lightbox_arrows_inside_alwayson:!1,lightbox_overlay_color:null,lightbox_overlay_opacity:1,lightbox_top_panel_opacity:null,lightbox_show_numbers:!0,lightbox_numbers_size:null,lightbox_numbers_color:null,lightbox_numbers_padding_top:null,lightbox_numbers_padding_right:null,lightbox_compact_closebutton_offsetx:1,lightbox_compact_closebutton_offsety:1,lightbox_close_on_emptyspace:!0};this.events={LIGHTBOX_INIT:"lightbox_init"};var p={topPanelHeight:44,initTextPanelHeight:26,isOpened:!1,isRightNowOpened:!1,putSlider:!0,isCompact:!1,fadeDuration:300,positionFrom:null,textPanelTop:null,textPanelLeft:null,isArrowsInside:!1,isArrowsOnHoverMode:!1,lastMouseX:null,lastMouseY:null,originalOptions:null,isSliderChangedOnce:!1,isTopPanelEnabled:!0},m={lightbox_slider_controls_always_on:!0,lightbox_slider_enable_bullets:!1,lightbox_slider_enable_arrows:!1,lightbox_slider_enable_progress_indicator:!1,lightbox_slider_enable_play_button:!1,lightbox_slider_enable_fullscreen_button:!1,lightbox_slider_enable_zoom_panel:!1,lightbox_slider_enable_text_panel:!1,lightbox_slider_scale_mode_media:"down",lightbox_slider_scale_mode:"down",lightbox_slider_loader_type:3,lightbox_slider_loader_color:"black",lightbox_slider_transition:"fade",lightbox_slider_image_padding_top:p.topPanelHeight,lightbox_slider_image_padding_bottom:0,lightbox_slider_video_padding_top:0,lightbox_slider_video_padding_bottom:0,lightbox_textpanel_align:"middle",lightbox_textpanel_padding_top:5,lightbox_textpanel_padding_bottom:5,slider_video_constantsize:!1,lightbox_slider_image_border:!1,lightbox_textpanel_enable_title:!0,lightbox_textpanel_enable_description:!1,lightbox_textpanel_desc_style_as_title:!0,lightbox_textpanel_enable_bg:!1,video_enable_closebutton:!1,lightbox_slider_video_enable_closebutton:!1,video_youtube_showinfo:!1,lightbox_slider_enable_links:!1},f={lightbox_overlay_opacity:.6,lightbox_slider_image_border:!0,lightbox_slider_image_shadow:!0,lightbox_slider_image_padding_top:30,lightbox_slider_image_padding_bottom:30,slider_video_constantsize:!0,lightbox_textpanel_align:"bottom",lightbox_textpanel_title_text_align:"left",lightbox_textpanel_desc_text_align:"left",lightbox_textpanel_padding_left:10,lightbox_textpanel_padding_right:10};function b(){1==p.isCompact&&1==h.lightbox_show_textpanel&&(h.lightbox_slider_image_padding_bottom=p.initTextPanelHeight),1==p.isCompact&&"inside"==h.lightbox_arrows_position&&(p.isArrowsInside=!0),1==p.isArrowsInside&&0==h.lightbox_arrows_inside_alwayson&&(p.isArrowsOnHoverMode=!0),0==h.lightbox_show_textpanel&&(p.isTopPanelEnabled=!1,p.topPanelHeight=0,h.lightbox_slider_image_padding_top=0)}function v(e){if(!_)return!0;var t={slider_image_padding_top:e};_.setOptions(t),_.refreshSlideItems()}function y(e){if(!s)return!1;if(!c)return!1;var t=s.height();if(0==t)return!1;if(0==s.is(":visible"))return!1;var i=t,n=c.getSize().height;t!=p.topPanelHeight&&(i=p.topPanelHeight),n>i&&(i=n),t!=i&&(s.height(i),_&&0==_.isAnimating()&&v(i))}function I(e){if(0==p.isOpened)return!1;if(!c)return!1;if(!_)return!1;var i=g.getElementSize(t),n=c.getSize();if(0==n.width||n.height>120)return!1;if(!e){var r=_.getSlideImage();e=g.getElementSize(r)}if(0==e.height||0==e.width)return!1;if(e.bottom+n.height<i.height)return!1;var o=_.getOptions(),a=n.height;if(a!=o.slider_image_padding_bottom){var s={slider_image_padding_bottom:a};if(0==_.isAnimating())return _.setOptions(s),_.refreshSlideItems(),!0}return!1}function w(e){g.getElementSize(t);var i=_.getSlideImage(),n=g.getElementSize(i);if(0==n.width)return!1;p.textPanelLeft=n.left,p.textPanelTop=n.bottom;var r=n.width;if(a){var o=g.getElementSize(a);r-=o.width;var s=n.right-o.width;g.placeElement(a,s,p.textPanelTop)}c&&(c.show(),c.refresh(!0,!0,r),function(e,t){if(!e){var i=_.getSlideImage();e=g.getElementSize(i)}p.textPanelTop=e.bottom,!0===t&&c.positionPanel(p.textPanelTop,p.textPanelLeft)}(n)),0==I(n)&&(p.positionFrom="handleCompactTextpanelSizes",c&&(c.positionPanel(p.textPanelTop,p.textPanelLeft),!0===e&&(e(),H())))}function E(){return 0==_.isCurrentSlideType("image")||1==_.isCurrentImageInPlace()}function T(e,t){if(0==p.isArrowsInside)return!1;if(!n)return!1;var i=E();if(n.show(),r.show(),p.positionFrom="positionArrowsInside",1==p.isArrowsOnHoverMode&&1==i&&0==A()&&M(!0),0==i)var o=g.getElementRelativePos(n,"left",h.lightbox_arrows_offset),a=g.getElementRelativePos(n,"middle"),s=g.getElementRelativePos(r,"right",h.lightbox_arrows_offset),l=a;else{var u=_.getSlideImage(),d=g.getElementSize(u);g.getElementSize(_.getElement()),o=g.getElementRelativePos(n,"left",0,u)+d.left+h.lightbox_arrows_inside_offset,a=g.getElementRelativePos(n,"middle",0,u)+d.top,s=g.getElementRelativePos(n,"right",0,u)+d.left-h.lightbox_arrows_inside_offset,l=a}if(!0===t){var c={left:o,top:a},m={left:s,top:l};n.stop().animate(c,{duration:p.fadeDuration}),r.stop().animate(m,{duration:p.fadeDuration})}else n.stop(),r.stop(),g.placeElement(n,o,a),g.placeElement(r,s,l);1==e&&O(t)}function S(e,i){p.positionFrom=null;var n=E(),r=g.getElementRelativePos(o,"right",2,t);if(0==n)var a=2,s=r;else{var l=_.getSlideImage(),u=g.getElementSize(l),d=g.getElementSize(_.getElement()),c=g.getElementSize(o);d.top==d.height&&(d.top=0);s=d.left+u.right-c.width/2+h.lightbox_compact_closebutton_offsetx;(a=d.top+u.top-c.height/2-h.lightbox_compact_closebutton_offsety)<2&&(a=2),s>r&&(s=r)}if(!0===i){var m={left:s,top:a};o.stop().animate(m,{duration:p.fadeDuration})}else o.stop(),g.placeElement(o,s,a);!0===e&&function(e){!0!==e&&o.stop();o.fadeTo(p.fadeDuration,1)}(i)}function P(){o&&o.stop().fadeTo(p.fadeDuration,0),j(),C(),p.positionFrom="hideCompactElements",1==p.isArrowsInside&&M()}function x(){var e=g.getElementSize(t);s&&g.setElementSizeAndPosition(s,0,0,e.width,p.topPanelHeight),n&&0==p.isArrowsInside&&(1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show()),g.placeElement(n,"left","middle",h.lightbox_arrows_offset),g.placeElement(r,"right","middle",h.lightbox_arrows_offset)),0==p.isCompact&&g.placeElement(o,"right","top",2,2),c&&(p.positionFrom="positionElements",0==p.isCompact?function(e){var t={},i=h.lightbox_textpanel_width;i>e.width-47-40?(t.textpanel_padding_left=47,t.textpanel_padding_right=40,t.textpanel_title_text_align="center",t.textpanel_desc_text_align="center"):(t.textpanel_padding_left=Math.floor((e.width-i)/2),t.textpanel_padding_right=t.textpanel_padding_left,t.textpanel_title_text_align="left",t.textpanel_desc_text_align="left",h.lightbox_textpanel_title_text_align&&(t.textpanel_title_text_align=h.lightbox_textpanel_desc_text_align),h.lightbox_textpanel_desc_text_align&&(t.textpanel_desc_text_align=h.lightbox_textpanel_desc_text_align)),c.setOptions(t),c.refresh(!0,!0),y(),c.positionPanel()}(e):(N(),H()));var i=e.width,a=e.height;if(_){if(s){var l={slider_image_padding_top:s.height()};_.setOptions(l)}_.setSize(i,a),_.setPosition(0,0)}}function j(){c&&c.getElement().stop().fadeTo(p.fadeDuration,0)}function C(){a&&a.stop().fadeTo(p.fadeDuration,0)}function A(){if(!p.lastMouseX)return!0;var e={pageX:p.lastMouseX,pageY:p.lastMouseY};return _.isMouseInsideSlideImage(e)}function M(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!1===t?(A(),!0):void(!0===e?(n.stop().fadeTo(0,0),r.stop().fadeTo(0,0)):(n.stop().fadeTo(p.fadeDuration,0),r.stop().fadeTo(p.fadeDuration,0))))}function O(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!0!==t&&1==E()||(1==_.isSwiping()||(!0!==e&&(n.stop(),r.stop()),n.fadeTo(p.fadeDuration,1),void r.fadeTo(p.fadeDuration,1))))}function z(e){if(!c)return!1;if(!e)e=_.getCurrentItem();c.setTextPlain(e.title,e.description)}function L(e){if(!a)return!1;if(!e)e=_.getCurrentItem();var t=d.getNumItems(),i=e.index+1;a.html(i+" / "+t)}function N(){if(!c)return!1;c.getElement().show().stop().fadeTo(p.fadeDuration,1)}function H(){a&&a.stop().fadeTo(p.fadeDuration,1)}function k(){if(0==p.isCompact)return!0;P()}function R(){if(0==p.isCompact)return!0;(p.positionFrom="onZoomChange",S(!1,!0),T(!1,!0),1==p.isCompact)&&(0==(_.isCurrentSlideType("image")&&1==_.isCurrentImageInPlace())?(j(),C()):(p.positionFrom="onZoomChange",N(),H()))}function G(){if(0==p.isCompact)return!0;p.positionFrom="onSliderAfterReturn",S(!0),T(!0),0==I()&&w(),N(),H()}function D(e,t){return t=jQuery(t),0==p.isCompact||(0==_.isSlideCurrent(t)||(p.positionFrom="onSliderAfterPutImage",S(!0),T(!0),void w()))}function Q(){var e=_.getOptions().slider_image_padding_top;if(s){var t=s.height();t!=e&&v(t)}if(1==p.isCompact){if(z(),L(),p.positionFrom="onSliderTransitionEnd",S(!0),T(!0),0==_.isSlideActionActive())0==I()&&w();N(),H()}}function W(e,t){0==p.isCompact?(a&&L(t),c&&(z(t),0==p.isRightNowOpened&&(c.positionElements(!1),y(),c.positionPanel()))):0==_.isAnimating()&&(c&&z(t),a&&L(t)),0==p.isSliderChangedOnce&&(p.isSliderChangedOnce=!0,u.trigger(l.events.LIGHTBOX_INIT))}function F(e,t){if("image"!=_.getSlideType()&&0==p.isCompact&&_.isSlideActionActive())return!0;if(1==_.isPreloading())return l.close("slider"),!0;1==h.lightbox_close_on_emptyspace&&(0==_.isMouseInsideSlideImage(t)&&l.close("slider_inside"))}function B(){x()}function Y(){s?function(){if(!s)return!1;s.hide()}():a&&a.hide(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.hide(),r.hide())}function U(){s?(!function(){if(!s)return!1;s.show()}(),y()):a&&a.show(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show())}function V(e,t,i){var n=!1;switch(t){case 27:1==p.isOpened&&l.close("keypress");break;case 38:case 40:case 33:case 34:n=!0}1==p.isOpened&&1==n&&i.preventDefault()}function X(){1==p.isArrowsOnHoverMode&&O(!1,!0)}function Z(e){p.positionFrom="hideCompactElements",1==p.isArrowsOnHoverMode&&1==E()&&M(!1,!0)}function q(e){p.lastMouseX=e.pageX,p.lastMouseY=e.pageY,1==(!n||0==n.is(":visible")||1!=n.css("opacity"))&&A()&&0==_.isAnimating()&&(p.positionFrom="onMouseMove",n&&0==n.is(":animated")&&O(!1,!0))}function K(e,t,i,n){if(0==p.isOpened)return!0;switch(h.gallery_mousewheel_role){default:case"zoom":"image"!=_.getSlideType()&&e.preventDefault();break;case"none":e.preventDefault();break;case"advance":d.onGalleryMouseWheel(e,t,i,n)}}this.destroy=function(){if(jQuery(document).unbind("mousemove"),i.off("touchstart"),i.off("touchend"),o.off("click"),e.off(d.events.ITEM_CHANGE),_){jQuery(_).off(_.events.TRANSITION_END),jQuery(_).off(_.events.CLICK),jQuery(_).off(_.events.START_DRAG),jQuery(_).off(_.events.TRANSITION_START),jQuery(_).off(_.events.AFTER_DRAG_CHANGE),jQuery(_).off(_.events.AFTER_RETURN);var n=_.getVideoObject();jQuery(n).off(n.events.PLAY_START),jQuery(n).off(n.events.PLAY_STOP),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z),_.destroy()}jQuery(window).unbind("resize"),e.off(d.events.GALLERY_KEYPRESS,V),t.off("mousewheel"),t.remove()},this.isOpened=function(){return p.isOpened},this.open=function(s){var l=d.getItem(s);(p.isOpened=!0,p.isRightNowOpened=!0,setTimeout(function(){p.isRightNowOpened=!1},100),_&&_.setItem(l,"lightbox_open"),c&&c.setTextPlain(l.title,l.description),i.stop().fadeTo(0,0),t.show(),t.fadeTo(0,1),i.stop().fadeTo(p.fadeDuration,h.lightbox_overlay_opacity),x(),1==p.isCompact)&&(1==_.isPreloading()?(o&&o.hide(),n&&1==p.isArrowsInside&&(n.hide(),r.hide()),a&&a.hide(),c&&c.hide()):1==p.isArrowsInside&&(n.hide(),r.hide()));_&&_.startSlideAction(),e.trigger(d.events.OPEN_LIGHTBOX,l)},this.close=function(i){p.isOpened=!1,1==p.isCompact&&P(),_&&_.stopSlideAction(),"image"!=_.getSlideType()?t.hide():t.fadeTo(p.fadeDuration,0,function(){t.hide()}),e.trigger(d.events.CLOSE_LIGHTBOX)},this.init=function(t,i){!function(t,i){d=t,e=jQuery(t),d.setObjLightbox(l),h=jQuery.extend(h,m),h=jQuery.extend(h,i),p.originalOptions=jQuery.extend({},h),"compact"==h.lightbox_type&&(p.isCompact=!0,h=jQuery.extend(h,f),h=jQuery.extend(h,i)),b(),1==p.putSlider?(d.initSlider(h,"lightbox"),g_objects=t.getObjects(),_=g_objects.g_objSlider):_=null,1==h.lightbox_show_textpanel?c.init(d,h,"lightbox"):c=null}(t,i)},this.putHtml=function(){var e,l;d.isSmallWindow()&&1==p.isCompact&&(p.isCompact=!1,b(),p.isArrowsInside=!1,p.isArrowsOnHoverMode=!1,(h=jQuery.extend({},p.originalOptions)).lightbox_arrows_position="sides",_.setOptions(h)),e="",l="",1==p.isCompact&&(l=" ug-lightbox-compact"),e+="<div class='ug-gallery-wrapper ug-lightbox"+l+"'>",e+="<div class='ug-lightbox-overlay'></div>",0==p.isCompact&&p.isTopPanelEnabled?(e+="<div class='ug-lightbox-top-panel'>",e+="<div class='ug-lightbox-top-panel-overlay'></div>",h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="</div>"):h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="<div class='ug-lightbox-button-close'></div>",e+="<div class='ug-lightbox-arrow-left'></div>",e+="<div class='ug-lightbox-arrow-right'></div>",e+="</div>",t=jQuery(e),jQuery("body").append(t),_&&_.setHtml(t),i=t.children(".ug-lightbox-overlay"),0==p.isCompact&&1==p.isTopPanelEnabled&&0==(s=t.children(".ug-lightbox-top-panel")).length&&(s=null),o=t.find(".ug-lightbox-button-close"),h.lightbox_show_numbers&&(a=t.find(".ug-lightbox-numbers")),n=t.children(".ug-lightbox-arrow-left"),r=t.children(".ug-lightbox-arrow-right"),c&&(s?c.appendHTML(s):c.appendHTML(t))},this.run=function(){!function(){if(null!==h.lightbox_overlay_color&&i.css("background-color",h.lightbox_overlay_color),null!==h.lightbox_overlay_opacity&&i.fadeTo(0,h.lightbox_overlay_opacity),s&&null!==h.lightbox_top_panel_opacity&&s.children(".ug-lightbox-top-panel-overlay").fadeTo(0,h.lightbox_top_panel_opacity),a){var e={};null!==h.lightbox_numbers_size&&(e["font-size"]=h.lightbox_numbers_size+"px"),h.lightbox_numbers_color&&(e.color=h.lightbox_numbers_color),null!==h.lightbox_numbers_padding_right&&(e["padding-right"]=h.lightbox_numbers_padding_right+"px"),null!==h.lightbox_numbers_padding_top&&(e["padding-top"]=h.lightbox_numbers_padding_top+"px"),a.css(e)}}(),_&&_.run(),function(){if(i.on("touchstart",function(e){e.preventDefault()}),i.on("touchend",function(e){l.close("overlay")}),g.addClassOnHover(r,"ug-arrow-hover"),g.addClassOnHover(n,"ug-arrow-hover"),g.addClassOnHover(o),d.setNextButton(r),d.setPrevButton(n),o.click(function(){l.close("button")}),e.on(d.events.ITEM_CHANGE,W),_){jQuery(_).on(_.events.TRANSITION_END,Q),jQuery(_).on(_.events.CLICK,F);var a=_.getVideoObject();jQuery(a).on(a.events.PLAY_START,Y),jQuery(a).on(a.events.PLAY_STOP,U),jQuery(_).on(_.events.START_DRAG,k),jQuery(_).on(_.events.TRANSITION_START,k),jQuery(_).on(_.events.AFTER_DRAG_CHANGE,G),jQuery(_).on(_.events.AFTER_RETURN,G),jQuery(_).on(_.events.AFTER_PUT_IMAGE,D),jQuery(_).on(_.events.ZOOM_CHANGE,R),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z)}jQuery(window).resize(function(){if(0==p.isOpened)return!0;g.whenContiniousEventOver("lightbox_resize",B,100)}),e.on(d.events.GALLERY_KEYPRESS,V),1==p.isArrowsOnHoverMode&&jQuery(document).bind("mousemove",q),t.on("mousewheel",K)}()}}function UGCarousel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGTileDesign,u=new UGThumbsGeneral,d={carousel_padding:8,carousel_space_between_tiles:20,carousel_navigation_numtiles:3,carousel_scroll_duration:500,carousel_scroll_easing:"easeOutCubic",carousel_autoplay:!0,carousel_autoplay_timeout:3e3,carousel_autoplay_direction:"right",carousel_autoplay_pause_onhover:!0,carousel_vertical_scroll_ondrag:!1};this.events={START_PLAY:"carousel_start_play",PAUSE_PLAY:"carousel_pause_play",STOP_PLAY:"carousel_stop_play"};var _={eventSizeChange:"thumb_size_change",isFirstTimeRun:!0,carouselMaxWidth:null,tileWidth:0,initTileWidth:0,initTileHeight:0,sideSpace:1500,spaceActionSize:500,numCurrent:0,touchActive:!1,startInnerPos:0,lastTime:0,startTime:0,startMousePos:0,lastMousePos:0,scrollShortDuration:200,scrollShortEasing:"easeOutQuad",handle:null,isPlayMode:!1,isPaused:!1,storedEventID:"carousel"};function g(e,t){if(!t)t=_.initTileHeight/_.initTileWidth*e;_.tileWidth=e;var i={tile_width:e,tile_height:t};l.setOptions(i),d.tile_width=e,d.tile_height=t,l.resizeAllTiles(e),I(!0)}function c(){if(null===_.carouselMaxWidth)throw new Error("The carousel width not set");if(_.tileWidth<_.initTileWidth){(a=_.carouselMaxWidth-2*d.carousel_padding)>_.initTileWidth&&(a=_.initTileWidth),g(a);var o=s.getNumItemsInSpace(_.carouselMaxWidth,a,d.carousel_space_between_tiles)}else{var a;if((o=s.getNumItemsInSpace(_.carouselMaxWidth,_.tileWidth,d.carousel_space_between_tiles))<=0)o=1,g(a=_.carouselMaxWidth-2*d.carousel_padding)}var u=s.getSpaceByNumItems(o,_.tileWidth,d.carousel_space_between_tiles);u+=2*d.carousel_padding,i.width(u),1==_.isFirstTimeRun?(l.initEvents(),i.bind("mousedown touchstart",C),jQuery("body").bind("mousemove touchmove",A),jQuery(window).add("body").bind("mouseup touchend",M),i.hover(O,z),l.run(),jQuery.each(t,function(t,i){i.objThumbWrapper.data("index",t),e.trigger(_.eventSizeChange,[i.objThumbWrapper,!0]),i.objTileOriginal=i.objThumbWrapper.clone(!0,!0)}),I(!0),1==d.carousel_autoplay&&r.startAutoplay()):(1==d.carousel_autoplay&&r.pauseAutoplay(),S(0,!1),1==d.carousel_autoplay&&r.startAutoplay()),s.placeElement(n,0,d.carousel_padding),x(),_.isFirstTimeRun=!1}function h(){return s.getElementSize(n).left}function p(e){return s.getMousePosition(e).pageX}function m(){return n.children(".ug-thumb-wrapper")}function f(e){return s.getNumItemsInSpace(e,_.tileWidth,d.carousel_space_between_tiles)}function b(){return m().length}function v(e){w(e);var t=m();return jQuery(t[e])}function y(){return f(s.getElementSize(i).width)}function I(e){if(!e)e=!1;var t,r=m(),o=0,a=0;return jQuery.each(r,function(e,i){i=jQuery(i),s.placeElement(i,o,0);var n=s.getElementSize(i);o+=n.width+d.carousel_space_between_tiles,a=Math.max(a,n.height),e==r.length-1&&(t=n.right)}),n.width(t),a+=2*d.carousel_padding,!0===e&&(n.height(a),i.height(a)),S(_.numCurrent,!1),t}function w(e){if(e>m().length-1)throw new Error("Wrogn tile number: "+e)}function E(t,i){if("left"==i)var r=n.children(".ug-thumb-wrapper").first();else r=n.children(".ug-thumb-wrapper").last();var o=function(e,t,i){var n=e.data("index");if(null==n)throw new Error("every tile should have index!");for(var r=[],o=0;o<t;o++){if("prev"==i)var s=a.getPrevItem(n,!0);else s=a.getNextItem(n,!0);if(!s)throw new Error("the item to add is empty");var l=s.objTileOriginal.clone(!0,!0);n=s.index,l.addClass("cloned"),r.push(l)}return r}(r,t,"left"==i?"prev":"next");jQuery.each(o,function(t,r){"left"==i?n.prepend(r):n.append(r),e.trigger(_.eventSizeChange,r),l.loadTileImage(r)})}function T(e,t){w(n);for(var i=m(),n=i.length,r=0;r<e;r++)"left"==t?jQuery(i[r]).remove():jQuery(i[n-1-r]).remove()}function S(e,t,i){if(void 0===t){t=!0;if(n.is(":animated"))return!0}var r=v(e),o={left:-s.getElementSize(r).left+d.carousel_padding+"px"};if(!0===t){var a=d.carousel_scroll_duration,l=d.carousel_scroll_easing;!0===i&&(a=_.scrollShortDuration,l=_.scrollShortEasing),n.stop(!0).animate(o,{duration:a,easing:l,queue:!1,complete:function(){_.numCurrent=e,x()}})}else _.numCurrent=e,n.css(o)}function P(){var e,t,i,n;S((e=-h(),t=f(e),i=s.getElementSize(v(t)).left,n=s.getElementSize(v(t+1)).left,Math.abs(i-e)<Math.abs(n-e)?t:t+1),!0,!0)}function x(){var e,t=(e=-h(),_.sideSpace-e),r=function(){var e=s.getElementSize(i),t=s.getElementSize(n),r=t.width-e.width+t.left;return _.sideSpace-r}(),o=0,a=0,l=0,u=0,d=b();if(t>_.spaceActionSize)E(o=f(t),"left"),_.numCurrent+=o;else if(t<-_.spaceActionSize){T(l=f(Math.abs(t)),"left"),_.numCurrent-=l}if(r>_.spaceActionSize?E(a=f(r),"right"):r<-_.spaceActionSize&&T(u=f(Math.abs(r)),"right"),u>d)throw new Error("Can't remove more then num tiles");var g=!1;return(o||a||l||u)&&(I(),g=!0),g}function j(){"left"==d.carousel_autoplay_direction?r.scrollRight(1):r.scrollLeft(1)}function C(e){if(1==_.touchActive)return!0;_.touchActive=!0,r.pauseAutoplay(),_.startTime=jQuery.now(),_.startMousePos=p(e),_.startInnerPos=h(),_.lastTime=_.startTime,_.lastMousePos=_.startMousePos,s.storeEventData(e,_.storedEventID)}function A(e){if(0==_.touchActive)return!0;s.updateStoredEventData(e,_.storedEventID),e.preventDefault();var t=null;if(1==d.carousel_vertical_scroll_ondrag&&(t=s.handleScrollTop(_.storedEventID)),"vert"===t)return!0;_.lastMousePos=p(e);var i,r=_.lastMousePos-_.startMousePos,o=_.startInnerPos+r,a=r>0?"prev":"next";o>0&&"prev"==a&&(o/=3),o<-s.getElementSize(n).width&&"next"==a&&(o=_.startInnerPos+r/3),i={left:o+"px"},n.css(i)}function M(e){if(0==_.touchActive)return!0;_.touchActive=!1,P(),r.unpauseAutoplay()}function O(e){if(0==d.carousel_autoplay_pause_onhover)return!0;1==_.isPlayMode&&0==_.isPaused&&r.pauseAutoplay()}function z(e){if(0==d.carousel_autoplay_pause_onhover)return!0;r.unpauseAutoplay()}function L(){var e=_.lastTime-_.startTime,t=Math.abs(_.lastMousePos-_.startMousePos);return!(e>300)&&!(t>30)}this.startAutoplay=function(){_.isPlayMode=!0,_.isPaused=!1,o.trigger(r.events.START_PLAY),_.handle&&clearInterval(_.handle),_.handle=setInterval(j,d.carousel_autoplay_timeout)},this.unpauseAutoplay=function(){return 0==_.isPlayMode||(0==_.isPaused||void r.startAutoplay())},this.pauseAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!0,_.handle&&clearInterval(_.handle),o.trigger(r.events.PAUSE_PLAY)},this.stopAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!1,_.isPlayMode=!1,_.handle&&clearInterval(_.handle),o.trigger(r.events.STOP_PLAY)},this.destroy=function(){_.handle&&clearInterval(_.handle),o.off(r.events.START_PLAY),o.off(r.events.STOP_PLAY),i.unbind("mousedown"),i.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),i.off("mouseenter").off("mouseleave"),l.destroy()},this.init=function(i,n,r){r&&this.setMaxWidth(r),function(i,n){g_objects=i.getObjects(),a=i,jQuery(i),e=g_objects.g_objWrapper,t=g_objects.g_arrItems,d=jQuery.extend(d,n),l.setFixedMode(),l.setApproveClickFunction(L),l.init(i,d),u=l.getObjThumbs(),d=l.getOptions(),_.initTileWidth=d.tile_width,_.initTileHeight=d.tile_height,_.tileWidth=d.tile_width}(i,n)},this.setMaxWidth=function(e){_.carouselMaxWidth=e},this.setHtml=function(t){!function(t){t||(t=e);e.append("<div class='ug-carousel-wrapper'><div class='ug-carousel-inner'></div></div>"),i=e.children(".ug-carousel-wrapper"),n=i.children(".ug-carousel-inner"),l.setHtml(n),u.getThumbs().fadeTo(0,1)}(t)},this.getElement=function(){return i},this.getObjTileDesign=function(){return l},this.getEstimatedHeight=function(){return d.tile_height+2*d.carousel_padding},this.run=function(){c()},this.scrollRight=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=_.numCurrent-e;i<=0&&(i=0),S(i)},this.scrollLeft=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=b(),n=_.numCurrent+e;n>=i&&(n=i-1),S(n)},this.setScrollLeftButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollLeft)},this.setScrollRightButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollRight)},this.setPlayPauseButton=function(e){s.setButtonMobileReady(e),1==_.isPlayMode&&0==_.isPaused&&e.addClass("ug-pause-icon"),o.on(r.events.START_PLAY,function(){e.addClass("ug-pause-icon")}),o.on(r.events.STOP_PLAY,function(){e.removeClass("ug-pause-icon")}),s.setButtonOnClick(e,function(){0==_.isPlayMode||1==_.isPaused?r.startAutoplay():r.stopAutoplay()})}}function UGLoadMore(){jQuery(this);var e,t,i,n,r=new UniteGalleryMain,o=(new UGFunctions,{isInited:!1}),a={loadmore_container:"ug_loadmore_wrapper"};function s(){e.show()}function l(){t.hide(),i.show();var o={numitems:r.getNumItems()};r.ajaxRequest("front_loadmore",o,function(n){i.hide();var o=n.html_items;1==n.show_loadmore?(t.blur().show(),i.hide()):e.hide(),r.addItems(o)},function(e){e="Ajax Error!"+e,i.hide(),n.show(),n.html(e)})}this.events={},this.destroy=function(){if(0==o.isInited)return!1},this.init=function(u,d){if(r=u,jQuery(r),a=jQuery.extend(a,d),0!=(e=jQuery("#"+a.loadmore_container)).length&&0!=(t=e.find(".ug-loadmore-button")).length&&0!=(i=e.find(".ug-loadmore-loader")).length&&0!=(n=e.find(".ug-loadmore-error")).length&&(o.isInited=!0),0==o.isInited)return trace("load more not inited, something is wrong"),!1;r.onEvent("tiles_first_placed",s),t.click(l)}}function UGTabs(){jQuery(this);var e,t,i=new UniteGalleryMain,n=(new UGFunctions,{tabs_type:"tabs",tabs_container:"#ug_tabs",tabs_class_selected:"ug-tab-selected"});function r(){"select"==n.tabs_type?t.change(s):e.click(a)}function o(e){i.requestNewItems(e)}function a(){var t=n.tabs_class_selected,i=jQuery(this);if(i.hasClass(t))return!0;e.not(i).removeClass(t),i.addClass(t);var r=i.data("catid");if(!r)return!0;o(r)}function s(){var e=jQuery(this).val();if(!e)return!0;o(e)}this.events={},this.destroy=function(){t&&t.off("change"),e&&e.off("click")},this.init=function(r,o){!function(r,o){i=r,jQuery(i),"select"==(n=jQuery.extend(n,o)).tabs_type?t=jQuery(n.tabs_container):e=jQuery(n.tabs_container+" .ug-tab")}(r,o)},this.run=function(){r()}}function UG_API(e){var t,i=this,n=(jQuery(i),new UniteGalleryMain),r=[];function o(e){var t={index:e.index,title:e.title,description:e.description,urlImage:e.urlImage,urlThumb:e.urlThumb},i=e.objThumbImage.data();for(var n in i){switch(n){case"image":case"description":continue}t[n]=i[n]}return t}n=e,t=jQuery(e),this.events={API_INIT_FUNCTIONS:"api_init",API_ON_EVENT:"api_on_event"},this.on=function(e,a,s){switch(!0!==s&&r.push({event:e,func:a}),e){case"item_change":t.on(n.events.ITEM_CHANGE,function(){var e=o(n.getSelectedItem());a(e.index,e)});break;case"resize":t.on(n.events.SIZE_CHANGE,a);break;case"enter_fullscreen":t.on(n.events.ENTER_FULLSCREEN,a);break;case"exit_fullscreen":t.on(n.events.EXIT_FULLSCREEN,a);break;case"play":t.on(n.events.START_PLAY,a);break;case"stop":t.on(n.events.STOP_PLAY,a);break;case"pause":t.on(n.events.PAUSE_PLAYING,a);break;case"continue":t.on(n.events.CONTINUE_PLAYING,a);break;case"open_lightbox":t.on(n.events.OPEN_LIGHTBOX,a);break;case"close_lightbox":t.on(n.events.CLOSE_LIGHTBOX,a);break;default:console&&console.log("wrong api event: "+e)}t.trigger(i.events.API_ON_EVENT,[e,a])},this.play=function(){n.startPlayMode()},this.stop=function(){n.stopPlayMode()},this.togglePlay=function(){n.togglePlayMode()},this.enterFullscreen=function(){n.toFullScreen()},this.exitFullscreen=function(){n.exitFullScreen()},this.toggleFullscreen=function(){n.toggleFullscreen()},this.resetZoom=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomBack()},this.zoomIn=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomIn()},this.zoomOut=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomOut()},this.nextItem=function(){n.nextItem()},this.prevItem=function(){n.prevItem()},this.selectItem=function(e){n.selectItem(e)},this.resize=function(e,t){t?n.resize(e,t):n.resize(e)},this.getItem=function(e){return o(n.getItem(e))},this.getNumItems=function(){return n.getNumItems()},this.reloadGallery=function(e){if(!e)e={};n.run(null,e),r.map(function(e){i.on(e.event,e.func,!0)})},this.destroy=function(){n.destroy()},t.trigger(i.events.API_INIT_FUNCTIONS,i)}jQuery.fn.unitegallery=function(e){var t="#"+jQuery(this).attr("id");if(!e)e={};var i=new UniteGalleryMain;return i.run(t,e),void 0===window.ugArrGalleriesObjects&&(window.ugArrGalleriesObjects=[]),window.ugArrGalleriesObjects.push(i),new UG_API(i)};
|
assets_libraries/unitegallery/release_log.txt
ADDED
@@ -0,0 +1,554 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
version 1.7.56
|
3 |
+
|
4 |
+
-bug fix: fixed some lazy load related bugs
|
5 |
+
|
6 |
+
version 1.7.55
|
7 |
+
|
8 |
+
-feature: added video start option (data-start option)
|
9 |
+
|
10 |
+
version 1.7.54
|
11 |
+
|
12 |
+
-bug fix: fixed internet explorer 11 compatability of the latest version
|
13 |
+
|
14 |
+
version 1.7.53
|
15 |
+
|
16 |
+
-fixed arrows next / prev buttons, better events passing across the galleries
|
17 |
+
|
18 |
+
version 1.7.52
|
19 |
+
|
20 |
+
-synced with wp version
|
21 |
+
|
22 |
+
version 1.7.47
|
23 |
+
|
24 |
+
-feature: added "textpanel_title_as_link" option in text panel
|
25 |
+
|
26 |
+
version 1.7.46
|
27 |
+
|
28 |
+
-change: made option for including video api externally, not within js
|
29 |
+
-change: in ug-libararies.js, put jquery easing unpacked version
|
30 |
+
|
31 |
+
|
32 |
+
version 1.7.45
|
33 |
+
|
34 |
+
-bug fix: fixed fullscreen button on webkit with touch events
|
35 |
+
|
36 |
+
version 1.7.44
|
37 |
+
|
38 |
+
-bug fix: fixed text panel size when the gallery is hidden
|
39 |
+
|
40 |
+
version 1.7.43
|
41 |
+
|
42 |
+
-bug fix: fixed tiles type resize after 10 seconds
|
43 |
+
|
44 |
+
version 1.7.42
|
45 |
+
|
46 |
+
-feature: added load more functionality support
|
47 |
+
|
48 |
+
version 1.7.41
|
49 |
+
|
50 |
+
-bug fix: fixed issue for small screen galleries
|
51 |
+
|
52 |
+
version 1.7.40
|
53 |
+
|
54 |
+
-bug fix: fixed some ratio related js issue
|
55 |
+
|
56 |
+
version 1.7.39
|
57 |
+
|
58 |
+
-bug fix: fixed easing functions jquery 3.0 compatability
|
59 |
+
|
60 |
+
version 1.7.38
|
61 |
+
|
62 |
+
-bug fix: fixed some js error in case of iframes in the page
|
63 |
+
|
64 |
+
version 1.7.37
|
65 |
+
|
66 |
+
-bug fix: fixed the thumb image as big image bug
|
67 |
+
|
68 |
+
version 1.7.36
|
69 |
+
|
70 |
+
-protection: made some protection against video visibility:hidden
|
71 |
+
-protection: added some protection against js scripts that add additional items inside the gallery
|
72 |
+
-change: add a check if the gallery resized once in 2 seconds
|
73 |
+
|
74 |
+
version 1.7.35
|
75 |
+
|
76 |
+
-bug fix: fixed some errors related to jquery 3.0
|
77 |
+
|
78 |
+
version 1.7.34
|
79 |
+
|
80 |
+
-bug fix: the lightbox was switched to wide even on normal screens
|
81 |
+
|
82 |
+
version 1.7.33
|
83 |
+
|
84 |
+
-bug fix: fixed no thumb image bug
|
85 |
+
|
86 |
+
version 1.7.32
|
87 |
+
|
88 |
+
-bug fix: fixed left arrow inside arrows not in place bug
|
89 |
+
|
90 |
+
version 1.7.31
|
91 |
+
|
92 |
+
-bug fix: on keyboard event only first gallery affected
|
93 |
+
|
94 |
+
version 1.7.30
|
95 |
+
|
96 |
+
-bug fix: made option for removing "src" from the image and replace it by data-image=""
|
97 |
+
|
98 |
+
version 1.7.29
|
99 |
+
|
100 |
+
-bug fix: fixed slash in paths issues
|
101 |
+
|
102 |
+
version 1.7.28
|
103 |
+
|
104 |
+
-feature: updated tiles grid with options: grid_min_cols, grid_space_between_mobile for better responsiveness
|
105 |
+
-protection: added protection for margin and padding in the slider
|
106 |
+
|
107 |
+
version 1.7.27
|
108 |
+
|
109 |
+
-feature: added "open_lightbox" and "close_lightbox" to the API
|
110 |
+
|
111 |
+
version 1.7.26
|
112 |
+
|
113 |
+
-feature: added option for: data-thumb-mobile and data-image-mobile in the items for mobile urls
|
114 |
+
|
115 |
+
version 1.7.25
|
116 |
+
|
117 |
+
-bug fix: fixed lightbox compact bottom text issue
|
118 |
+
-bug fix: loading youtube API only from https
|
119 |
+
-protection: added protection to html5 video player for css size change
|
120 |
+
|
121 |
+
version 1.7.24
|
122 |
+
|
123 |
+
-bug fix: escaped "'" character in image url's
|
124 |
+
|
125 |
+
version 1.7.23
|
126 |
+
|
127 |
+
-feature: added theme_next_video_onend function in video gallery theme
|
128 |
+
|
129 |
+
-bug fix: fixed the api events issue on tab change
|
130 |
+
-bug fix: fixed option: theme_text_type in default theme
|
131 |
+
|
132 |
+
version 1.7.22
|
133 |
+
|
134 |
+
-bug fix: fixed bug related to video sizes in lightbox
|
135 |
+
-bug fix: fixed bug when right button was disabled on non fixed thumbs
|
136 |
+
|
137 |
+
version 1.7.21
|
138 |
+
|
139 |
+
-bug fix: fixed one row only bug in tiles grid
|
140 |
+
|
141 |
+
version 1.7.20
|
142 |
+
|
143 |
+
-bug fix: fixed youtube player destroy function, was a bug there
|
144 |
+
|
145 |
+
version 1.7.19
|
146 |
+
|
147 |
+
change: changed functionality to: tile_videoplay_icon_always_on
|
148 |
+
|
149 |
+
version 1.7.18
|
150 |
+
|
151 |
+
-bug fix: fixed various bugs from 17.7.17
|
152 |
+
|
153 |
+
version 1.7.17
|
154 |
+
|
155 |
+
-bug fix: fixed jquery 1.8 issue with fading.
|
156 |
+
-bug fix: fixed icon always on issue
|
157 |
+
|
158 |
+
version 1.7.16
|
159 |
+
|
160 |
+
-bug fix: fixed image border issue.
|
161 |
+
|
162 |
+
version 1.7.15
|
163 |
+
|
164 |
+
-bug fix: fixed tiles grid small issue with rtl
|
165 |
+
|
166 |
+
version 1.7.14
|
167 |
+
|
168 |
+
-bug fix: fixed nested type arrange on first load for mobile mode
|
169 |
+
|
170 |
+
version 1.7.13
|
171 |
+
|
172 |
+
-bug fix: fixed small js bug, about html variable
|
173 |
+
-bug fix: added better protection against unwanted css transitions
|
174 |
+
-bug fix: fixed vimeo didn't changed bug (vimeo removed the quick change video option)
|
175 |
+
|
176 |
+
version 1.7.12
|
177 |
+
|
178 |
+
-change: added line height to video title
|
179 |
+
-bug fix: bring back the fixed tiles_max_columns function
|
180 |
+
|
181 |
+
version 1.7.11
|
182 |
+
|
183 |
+
-bog fix: improved lightbox wide video player
|
184 |
+
|
185 |
+
version 1.7.10
|
186 |
+
|
187 |
+
-change: added theme_align option to tiles grid
|
188 |
+
|
189 |
+
version 1.7.9
|
190 |
+
|
191 |
+
-bug fix: fixed some preloader error with tabs
|
192 |
+
-bug fix: fixed tilegrid resize issues
|
193 |
+
|
194 |
+
version 1.7.8
|
195 |
+
|
196 |
+
-made some small js changes
|
197 |
+
|
198 |
+
version 1.7.7
|
199 |
+
|
200 |
+
-added support for image src as full image, and data-thumb as thumb
|
201 |
+
|
202 |
+
version 1.7.7
|
203 |
+
|
204 |
+
-bug fix: fixed direction arrows slide direction
|
205 |
+
-bug fix: fixed titles with html tags
|
206 |
+
|
207 |
+
version 1.7.6
|
208 |
+
|
209 |
+
-feature: added tile text panel description
|
210 |
+
-protection: added protection against width:100% css
|
211 |
+
|
212 |
+
version 1.7.5
|
213 |
+
|
214 |
+
-feature: added tile text panel top/bottom/middle positions (text outside image)
|
215 |
+
-bug fix: fixed ie11 fullscreen mode
|
216 |
+
|
217 |
+
version 1.7.4
|
218 |
+
|
219 |
+
-bug fix: fixed left / right buttons on input objects
|
220 |
+
|
221 |
+
version 1.7.3
|
222 |
+
|
223 |
+
-feature: added category tab select type
|
224 |
+
-bug fix: fixed video player misplaced on gallery resize
|
225 |
+
|
226 |
+
version 1.7.2
|
227 |
+
|
228 |
+
-protection: added protection agains lasy load
|
229 |
+
|
230 |
+
version 1.7.1
|
231 |
+
|
232 |
+
-feature: added "open lightbox at start" option for tiles theme
|
233 |
+
|
234 |
+
version 1.7
|
235 |
+
|
236 |
+
-feature: added "tiles - nested" gallery type
|
237 |
+
-feature: added API functions to carousel type
|
238 |
+
|
239 |
+
version 1.6.8
|
240 |
+
|
241 |
+
-addition: added protection against undefined big images url's for the slider.
|
242 |
+
-change: changed mediaelement to new version
|
243 |
+
-bug fix: added z-index:0 to the gallery to avoid menu over the gallery
|
244 |
+
|
245 |
+
version 1.6.7
|
246 |
+
|
247 |
+
-change: changed files order include
|
248 |
+
-change: improved error message on some cases
|
249 |
+
|
250 |
+
version 1.6.6
|
251 |
+
|
252 |
+
-bug fix: fixed min jquery version checking.
|
253 |
+
|
254 |
+
version 1.6.5
|
255 |
+
|
256 |
+
-feature: added minimal version jquery validation
|
257 |
+
-bug fix: fixed tiles text panel appear
|
258 |
+
|
259 |
+
|
260 |
+
version 1.6.4
|
261 |
+
|
262 |
+
-feature: keep order option in tiles columns
|
263 |
+
-bug fix: text panel was blined on tiles resize
|
264 |
+
|
265 |
+
version 1.6.3
|
266 |
+
|
267 |
+
-bug fix: fixed text panel always on on tiles types
|
268 |
+
|
269 |
+
version 1.6.2
|
270 |
+
|
271 |
+
-bug fix: text panel was not hided on some of the cases
|
272 |
+
-chagne: improved show/hide controls display
|
273 |
+
|
274 |
+
version 1.6.1
|
275 |
+
|
276 |
+
bug fix: fixed a small bug with tiles image effect
|
277 |
+
|
278 |
+
version 1.6
|
279 |
+
|
280 |
+
-feature: changed tiles view - make variable number of columns
|
281 |
+
-change: improvement transition movement of tiles and justified types
|
282 |
+
|
283 |
+
version 1.5.9
|
284 |
+
|
285 |
+
-feature: added option thumb_fixed_size that alow to run dynamic size strips.
|
286 |
+
|
287 |
+
version 1.5.8
|
288 |
+
|
289 |
+
-bug fix: the video player stayed on compact mode on slide change
|
290 |
+
|
291 |
+
version 1.5.7
|
292 |
+
|
293 |
+
-feature: added option: tiles_align for columns type
|
294 |
+
-change: changed default lightbox transition to "fade"
|
295 |
+
|
296 |
+
version 1.5.6
|
297 |
+
|
298 |
+
-bug fix: add "ug-rtl" style
|
299 |
+
-feature: added option: tile_videoplay_icon_always_on in tile design section
|
300 |
+
|
301 |
+
version 1.5.5
|
302 |
+
|
303 |
+
-bug fix: fixed size bugs in justified type
|
304 |
+
|
305 |
+
version 1.5.4
|
306 |
+
|
307 |
+
-bug fix: fixed video gallery with tabs
|
308 |
+
|
309 |
+
version 1.5.3
|
310 |
+
|
311 |
+
-feature: added "destroy function to API"
|
312 |
+
-bug fix: fixed destroy function
|
313 |
+
|
314 |
+
version 1.5.2
|
315 |
+
|
316 |
+
-bug fix: added remove html function to lightbox
|
317 |
+
-bug fix: fixed some ie8 related issues
|
318 |
+
-bug fix: disabled scrolling on lightbox with mousewheel: none
|
319 |
+
|
320 |
+
version 1.5.1
|
321 |
+
|
322 |
+
-bog fix: fixed theme default options (like autoplay=true) that was brocken in the last update
|
323 |
+
|
324 |
+
version 1.5
|
325 |
+
|
326 |
+
-feature: added "category tabs" support
|
327 |
+
|
328 |
+
version 1.4.6
|
329 |
+
|
330 |
+
-bug fix: fixed js error on carousel without navigation
|
331 |
+
|
332 |
+
version 1.4.5
|
333 |
+
|
334 |
+
- change: added support for "title" attribute as item description
|
335 |
+
|
336 |
+
version 1.4.4
|
337 |
+
|
338 |
+
-feature: enable slider area links
|
339 |
+
-bug fix: on playing mode slides was advanced even when images was not loaded
|
340 |
+
-bug fix: fixed mousewheel advance item on lightbox
|
341 |
+
|
342 |
+
version 1.4.3
|
343 |
+
|
344 |
+
-bug fix: gallery on hidden tab was dissapeared on fullscreen
|
345 |
+
|
346 |
+
version 1.4.2
|
347 |
+
|
348 |
+
-feature: added option gallery_shuffle
|
349 |
+
-bug fix: bullets miss position after back from full screen
|
350 |
+
|
351 |
+
version 1.4.1
|
352 |
+
|
353 |
+
-bug fix: fixed some bug in justified tiles view in mobile width
|
354 |
+
-bug fix: fixed issue with video size at tabs
|
355 |
+
|
356 |
+
version 1.4
|
357 |
+
|
358 |
+
-bug fix: add preloader to video player
|
359 |
+
-change: video in lightbox compact mode opens in frame instead of on full screen
|
360 |
+
|
361 |
+
version 1.3.9
|
362 |
+
|
363 |
+
-feature: added option: slider_background_opacity
|
364 |
+
-feature: added option: gallery_mousewheel_role
|
365 |
+
-feature: added scale mode: fitdown
|
366 |
+
-feature: added vertical page scroll on drag
|
367 |
+
|
368 |
+
-change: when go to full screen mode, disable the pause on mouseover mode
|
369 |
+
-bug fix: carousel tile was dissapeared when size change less then tile width
|
370 |
+
|
371 |
+
version 1.3.8
|
372 |
+
|
373 |
+
-bug fix: fixed carousel related bug that text panel was over the icons
|
374 |
+
|
375 |
+
version 1.3.7
|
376 |
+
|
377 |
+
-bug fix: fixed carousel text panel didn't appeared on cloned items
|
378 |
+
|
379 |
+
version 1.3.6
|
380 |
+
|
381 |
+
-bug fix: fixed bug when closing the lightbox
|
382 |
+
|
383 |
+
version 1.3.5
|
384 |
+
|
385 |
+
-bug fix: the lightbox was closing on video slider touch
|
386 |
+
|
387 |
+
version 1.3.4
|
388 |
+
|
389 |
+
-feature: added mobile hide options to slider buttons and zoom panel
|
390 |
+
|
391 |
+
version 1.3.3
|
392 |
+
|
393 |
+
-feature: added top position navigation option in carousel view
|
394 |
+
|
395 |
+
version 1.3.2
|
396 |
+
|
397 |
+
-bug fix: fixed the flickering when close compact lightbox with view playing.
|
398 |
+
-bug fix: fixed bug with text panel not always on on themes.
|
399 |
+
|
400 |
+
version 1.3.1
|
401 |
+
|
402 |
+
-bug fix: text panel was not show on carousel cloned items
|
403 |
+
-bug fix: fixed issue with one item only on carousel
|
404 |
+
|
405 |
+
version 1.3
|
406 |
+
|
407 |
+
-feature: added "compact" lightbox type
|
408 |
+
|
409 |
+
version 1.2.16
|
410 |
+
|
411 |
+
-bug fix: fixed the responsivness of regular themes.
|
412 |
+
|
413 |
+
version 1.2.15
|
414 |
+
|
415 |
+
-bug fix: fixed hide preloader on tiles theme
|
416 |
+
-bug fix: fixed empty image was trying to load
|
417 |
+
|
418 |
+
version 1.2.14
|
419 |
+
|
420 |
+
-feature: added lightbox close on escape key
|
421 |
+
|
422 |
+
version 1.2.13
|
423 |
+
|
424 |
+
-bug fix: make all the themes work within tabs
|
425 |
+
|
426 |
+
version 1.2.12
|
427 |
+
|
428 |
+
-bug fix: make the gallery to work within tabs
|
429 |
+
|
430 |
+
version 1.2.11
|
431 |
+
|
432 |
+
-bug fix: added clickable function for carousel and tiles grid mode for mobile and tablet
|
433 |
+
|
434 |
+
version 1.2.10
|
435 |
+
|
436 |
+
-bug fix: adopted tiles clickable functions for mobile and tablet
|
437 |
+
|
438 |
+
version 1.2.9
|
439 |
+
|
440 |
+
-bug fix: fixed text align in lightbox
|
441 |
+
|
442 |
+
version 1.2.8
|
443 |
+
|
444 |
+
-feature: added tiles text panel text source, title or description
|
445 |
+
|
446 |
+
version 1.2.7
|
447 |
+
|
448 |
+
-feature: added disable lightbox option (tile_enable_action).
|
449 |
+
|
450 |
+
version 1.2.6
|
451 |
+
|
452 |
+
-bug fix: fixed some bug with lightbox text cut off
|
453 |
+
|
454 |
+
version 1.2.5
|
455 |
+
|
456 |
+
-change: added css protection against unwanted css transitions
|
457 |
+
|
458 |
+
version 1.2.4
|
459 |
+
|
460 |
+
- bug fix: fixed destorted images on some of the themes like avada
|
461 |
+
|
462 |
+
version 1.2.3
|
463 |
+
|
464 |
+
-feature: added lightbox additional options including lightbox slider options
|
465 |
+
|
466 |
+
version 1.2.2
|
467 |
+
|
468 |
+
-bug fix: fixed lightbox textpanel positioning on mobile
|
469 |
+
|
470 |
+
version 1.2.1
|
471 |
+
|
472 |
+
-bug fix: fixed tiles type total height
|
473 |
+
-bug fix: adopted the tiles galleries for touch
|
474 |
+
-bug fix: fixed lightbox positioning when back from drag
|
475 |
+
-bug fix: fixed tiles youtube play issues
|
476 |
+
|
477 |
+
version 1.2
|
478 |
+
|
479 |
+
-added theme: tiles (columns,justified)
|
480 |
+
-added theme: tilesgrid
|
481 |
+
-added theme: carousel
|
482 |
+
|
483 |
+
-option add: added grid option: grid_padding.
|
484 |
+
-option add: added textpanel options: textpanel_fontfamily, etc.
|
485 |
+
-option add: added option: slider_background_color
|
486 |
+
-option add: added option: bullets_space_between to bullets object (for tiles types)
|
487 |
+
-option add: added option: tiles_height, tiles_width for tiles fixed type
|
488 |
+
-option add: added youtube video options: video_youtube_showinfo,
|
489 |
+
|
490 |
+
-change: removed background color from the gallery wrapper
|
491 |
+
-change: changed gallery min height and min width options to fit into mobile devices.
|
492 |
+
|
493 |
+
-bug fix: fixed video gallery autoplay for vimeo video
|
494 |
+
-bug fix: fixed video gallery description size
|
495 |
+
-bug fix: fixed keyboard navigation in google chrome
|
496 |
+
-bug fix: fixed bullets left margin on first item
|
497 |
+
|
498 |
+
|
499 |
+
version (1.1.2015) 1.1.6
|
500 |
+
|
501 |
+
- bug fix: fixed video gallery title and description skin mobile view
|
502 |
+
|
503 |
+
version (13.12.2014) 1.1.5
|
504 |
+
|
505 |
+
- feature: added bottom buttons for video gallery
|
506 |
+
- feature: added ugCheckForErrors function for error message output
|
507 |
+
|
508 |
+
version (2.12.2014) 1.1.4
|
509 |
+
|
510 |
+
- bug fix: fixed multiple video galleries on one page
|
511 |
+
|
512 |
+
version (2.12.2014) 1.1.3
|
513 |
+
|
514 |
+
- added video gallery theme
|
515 |
+
- added option to disble panel at start for some seconds
|
516 |
+
- bug fix: fixed small bug with youtube playback
|
517 |
+
|
518 |
+
version (29.11.2014) 1.1.2
|
519 |
+
|
520 |
+
- bug fix: when controls not alwqays on, don't show progress bar
|
521 |
+
- bug fix: fixed fullscreen on ie11
|
522 |
+
|
523 |
+
version 1.1.1
|
524 |
+
|
525 |
+
-feature: added option: slider_videoplay_button_type. slider video play button type, square or round
|
526 |
+
|
527 |
+
version 1.1 (20.10.2014)
|
528 |
+
|
529 |
+
-feature: add grid bottom and grid top types
|
530 |
+
-feature: added media players for youtube, vimeo, html5 video, soundcloud, wistia
|
531 |
+
-feature: get automatically youtube images and thumbs by id
|
532 |
+
-feature: added option: slider_zoom_max_ratio for limit the zooming
|
533 |
+
-feature: added option: slider_scale_mode_media - saparate scale mode option for slider media item
|
534 |
+
|
535 |
+
-bug fix: fixed first image was not loaded sometimes.
|
536 |
+
|
537 |
+
version 1.0.3
|
538 |
+
|
539 |
+
-feature: add grid bottom and grid top types
|
540 |
+
|
541 |
+
version 1.0.2
|
542 |
+
|
543 |
+
-bug fix: fixed avia strip navigation.
|
544 |
+
|
545 |
+
version 1.0.1
|
546 |
+
|
547 |
+
- bug fix: removed max-width:100% from the images
|
548 |
+
- bug fix: added strip arrows to alexis theme
|
549 |
+
- change: set option "debug errors" to false
|
550 |
+
- bug fix: added transition setting to strip scroll, was hard coded.
|
551 |
+
- bug fix: fixed small bug in compact theme related to galllery resize
|
552 |
+
- bug fix: fixed compatability with other draggable components
|
553 |
+
|
554 |
+
version 1.0 - first release
|
inc_php/unitecreator_output.class.php
CHANGED
@@ -1330,7 +1330,8 @@ class UniteCreatorOutputWork extends HtmlOutputBaseUC{
|
|
1330 |
$status = $post->post_status;
|
1331 |
$menuOrder = $post->menu_order;
|
1332 |
|
1333 |
-
$arrTermsNames = UniteFunctionsWPUC::getPostTermsTitles($post);
|
|
|
1334 |
$strTerms = implode(",", $arrTermsNames);
|
1335 |
|
1336 |
$htmlAfterAlias = "";
|
1330 |
$status = $post->post_status;
|
1331 |
$menuOrder = $post->menu_order;
|
1332 |
|
1333 |
+
$arrTermsNames = UniteFunctionsWPUC::getPostTermsTitles($post, true);
|
1334 |
+
|
1335 |
$strTerms = implode(",", $arrTermsNames);
|
1336 |
|
1337 |
$htmlAfterAlias = "";
|
includes.php
CHANGED
@@ -12,7 +12,7 @@ if(!defined('UNLIMITED_ELEMENTS_INC'))
|
|
12 |
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
|
13 |
|
14 |
if(!defined("UNLIMITED_ELEMENTS_VERSION"))
|
15 |
-
define("UNLIMITED_ELEMENTS_VERSION", "1.4.
|
16 |
|
17 |
$currentFile = __FILE__;
|
18 |
$currentFolder = dirname($currentFile);
|
12 |
defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
|
13 |
|
14 |
if(!defined("UNLIMITED_ELEMENTS_VERSION"))
|
15 |
+
define("UNLIMITED_ELEMENTS_VERSION", "1.4.99");
|
16 |
|
17 |
$currentFile = __FILE__;
|
18 |
$currentFolder = dirname($currentFile);
|
provider/core/plugins/unlimited_elements/elementor/assets/uc_editor_admin.js
CHANGED
@@ -38,7 +38,6 @@ function UniteCreatorElementorEditorAdmin(){
|
|
38 |
}
|
39 |
|
40 |
|
41 |
-
|
42 |
function a________AUDIO_CONTROL_________(){}
|
43 |
|
44 |
|
38 |
}
|
39 |
|
40 |
|
|
|
41 |
function a________AUDIO_CONTROL_________(){}
|
42 |
|
43 |
|
provider/core/plugins/unlimited_elements/elementor/elementor_integrate.class.php
CHANGED
@@ -1517,12 +1517,18 @@ class UniteCreatorElementorIntegrate{
|
|
1517 |
$enableDynamicVisibility = HelperProviderCoreUC_EL::getGeneralSetting("enable_dynamic_visibility");
|
1518 |
$enableDynamicVisibility = UniteFunctionsUC::strToBool($enableDynamicVisibility);
|
1519 |
}
|
1520 |
-
|
1521 |
if($enableExportImport == false){
|
1522 |
$this->enableExportTemplate = false;
|
1523 |
$this->enableImportTemplate = false;
|
1524 |
}
|
1525 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1526 |
add_action('elementor/editor/init', array($this, 'onEditorInit'));
|
1527 |
|
1528 |
add_action('elementor/widgets/widgets_registered', array($this, 'onWidgetsRegistered'));
|
1517 |
$enableDynamicVisibility = HelperProviderCoreUC_EL::getGeneralSetting("enable_dynamic_visibility");
|
1518 |
$enableDynamicVisibility = UniteFunctionsUC::strToBool($enableDynamicVisibility);
|
1519 |
}
|
1520 |
+
|
1521 |
if($enableExportImport == false){
|
1522 |
$this->enableExportTemplate = false;
|
1523 |
$this->enableImportTemplate = false;
|
1524 |
}
|
1525 |
+
|
1526 |
+
//disable post_content filtering (in functionsWP)
|
1527 |
+
|
1528 |
+
GlobalsProviderUC::$disablePostContentFiltering = HelperProviderCoreUC_EL::getGeneralSetting("disable_post_content_filters");
|
1529 |
+
GlobalsProviderUC::$disablePostContentFiltering = UniteFunctionsUC::strToBool(GlobalsProviderUC::$disablePostContentFiltering);
|
1530 |
+
|
1531 |
+
|
1532 |
add_action('elementor/editor/init', array($this, 'onEditorInit'));
|
1533 |
|
1534 |
add_action('elementor/widgets/widgets_registered', array($this, 'onWidgetsRegistered'));
|
provider/core/plugins/unlimited_elements/elementor/elementor_widget.class.php
CHANGED
@@ -1427,6 +1427,7 @@ class UniteCreatorElementorWidget extends Widget_Base {
|
|
1427 |
//---- add selectors ---
|
1428 |
|
1429 |
switch($type){ //single selector
|
|
|
1430 |
case UniteCreatorDialogParam::PARAM_TEXTSHADOW:
|
1431 |
case UniteCreatorDialogParam::PARAM_BOXSHADOW:
|
1432 |
case UniteCreatorDialogParam::PARAM_BORDER:
|
1427 |
//---- add selectors ---
|
1428 |
|
1429 |
switch($type){ //single selector
|
1430 |
+
case UniteCreatorDialogParam::PARAM_AUDIO:
|
1431 |
case UniteCreatorDialogParam::PARAM_TEXTSHADOW:
|
1432 |
case UniteCreatorDialogParam::PARAM_BOXSHADOW:
|
1433 |
case UniteCreatorDialogParam::PARAM_BORDER:
|
provider/core/plugins/unlimited_elements/settings/general_settings_el.xml
CHANGED
@@ -185,25 +185,36 @@
|
|
185 |
description="Use it when you have some memory crash. <br> When enabling it it will log every addon and field register operation <br> and sugniffically slow down the editor work. Use it only for testing and turn it off after.">
|
186 |
</field>
|
187 |
|
188 |
-
<field name="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
type="hr">
|
190 |
</field>
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
<field name="show_php_error"
|
193 |
type="boolean"
|
194 |
default="false"
|
195 |
label="Show PHP Error Message"
|
196 |
description="Use it when you see some text about php error and want to see it.">
|
197 |
</field>
|
198 |
-
|
199 |
-
<field name="memory_usage_button"
|
200 |
-
type="button"
|
201 |
-
value="Show Memory Usage Log"
|
202 |
-
gotoview="troubleshooting-memory-usage"
|
203 |
-
label="Show last memory usage log <br> Run it after the editor run with the memory test"
|
204 |
-
>
|
205 |
-
</field>
|
206 |
-
|
207 |
<field type="control" parent="enable_memory_usage_test" child="memory_usage_button" ctype="show" value="true" />
|
208 |
|
209 |
<field name="troubleshooting-hr1"
|
185 |
description="Use it when you have some memory crash. <br> When enabling it it will log every addon and field register operation <br> and sugniffically slow down the editor work. Use it only for testing and turn it off after.">
|
186 |
</field>
|
187 |
|
188 |
+
<field name="memory_usage_button"
|
189 |
+
type="button"
|
190 |
+
value="Show Memory Usage Log"
|
191 |
+
gotoview="troubleshooting-memory-usage"
|
192 |
+
label="Show last memory usage log <br> Run it after the editor run with the memory test"
|
193 |
+
>
|
194 |
+
</field>
|
195 |
+
|
196 |
+
<field name="before_disable_post_content_filters"
|
197 |
type="hr">
|
198 |
</field>
|
199 |
|
200 |
+
<field name="disable_post_content_filters"
|
201 |
+
type="boolean"
|
202 |
+
default="false"
|
203 |
+
label="Disable post content output filters"
|
204 |
+
description="Sometimes post content filters causing memory errors. Disabling them can make the page load in case stucked pages">
|
205 |
+
</field>
|
206 |
+
|
207 |
+
<field name="before_show_php_message"
|
208 |
+
type="hr">
|
209 |
+
</field>
|
210 |
+
|
211 |
<field name="show_php_error"
|
212 |
type="boolean"
|
213 |
default="false"
|
214 |
label="Show PHP Error Message"
|
215 |
description="Use it when you see some text about php error and want to see it.">
|
216 |
</field>
|
217 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
<field type="control" parent="enable_memory_usage_test" child="memory_usage_button" ctype="show" value="true" />
|
219 |
|
220 |
<field name="troubleshooting-hr1"
|
provider/functions_wordpress.class.php
CHANGED
@@ -663,7 +663,7 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
|
|
663 |
/**
|
664 |
* get post terms titles
|
665 |
*/
|
666 |
-
public static function getPostTermsTitles($post){
|
667 |
|
668 |
$arrTermsWithTax = self::getPostTerms($post);
|
669 |
|
@@ -680,6 +680,14 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
|
|
680 |
foreach($arrTerms as $term){
|
681 |
|
682 |
$name = UniteFunctionsUC::getVal($term, "name");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
if(empty($name))
|
684 |
continue;
|
685 |
|
@@ -1922,8 +1930,9 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
|
|
1922 |
else
|
1923 |
$content = $post->post_content;
|
1924 |
|
1925 |
-
|
1926 |
-
|
|
|
1927 |
return($content);
|
1928 |
}
|
1929 |
|
663 |
/**
|
664 |
* get post terms titles
|
665 |
*/
|
666 |
+
public static function getPostTermsTitles($post, $withTax = false){
|
667 |
|
668 |
$arrTermsWithTax = self::getPostTerms($post);
|
669 |
|
680 |
foreach($arrTerms as $term){
|
681 |
|
682 |
$name = UniteFunctionsUC::getVal($term, "name");
|
683 |
+
|
684 |
+
if($withTax == true){
|
685 |
+
$taxonomy = UniteFunctionsUC::getVal($term, "taxonomy");
|
686 |
+
|
687 |
+
if(!empty($taxanomy) && $taxanomy != "category")
|
688 |
+
$name .= "($taxanomy)";
|
689 |
+
}
|
690 |
+
|
691 |
if(empty($name))
|
692 |
continue;
|
693 |
|
1930 |
else
|
1931 |
$content = $post->post_content;
|
1932 |
|
1933 |
+
if(GlobalsProviderUC::$disablePostContentFiltering !== true)
|
1934 |
+
$content = apply_filters("widget_text_content", $content);
|
1935 |
+
|
1936 |
return($content);
|
1937 |
}
|
1938 |
|
provider/provider_globals.class.php
CHANGED
@@ -35,6 +35,8 @@ class GlobalsProviderUC{
|
|
35 |
|
36 |
public static $arrTestTermIDs = null; //test term id's for render taxonomies under ajax
|
37 |
|
|
|
|
|
38 |
const QUERY_TYPE_CURRENT = "current";
|
39 |
const QUERY_TYPE_CUSTOM = "custom";
|
40 |
const QUERY_TYPE_MANUAL = "manual";
|
35 |
|
36 |
public static $arrTestTermIDs = null; //test term id's for render taxonomies under ajax
|
37 |
|
38 |
+
public static $disablePostContentFiltering = false;
|
39 |
+
|
40 |
const QUERY_TYPE_CURRENT = "current";
|
41 |
const QUERY_TYPE_CUSTOM = "custom";
|
42 |
const QUERY_TYPE_MANUAL = "manual";
|
provider/provider_params_processor.class.php
CHANGED
@@ -2591,7 +2591,9 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
|
|
2591 |
}
|
2592 |
|
2593 |
HelperUC::addRemoteControlsScript();
|
2594 |
-
|
|
|
|
|
2595 |
//get the name
|
2596 |
if($isEnable == true){
|
2597 |
|
2591 |
}
|
2592 |
|
2593 |
HelperUC::addRemoteControlsScript();
|
2594 |
+
|
2595 |
+
$attributes = "";
|
2596 |
+
|
2597 |
//get the name
|
2598 |
if($isEnable == true){
|
2599 |
|
readme.txt
CHANGED
@@ -476,7 +476,15 @@ Note : This plugin works with Elementor. Make sure you have [Elementor](https://
|
|
476 |
|
477 |
== Changelog ==
|
478 |
|
479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
|
481 |
* Feature: modified remote general js api to fit more types of widgets
|
482 |
* Feature: added support for put meta field in post list
|
476 |
|
477 |
== Changelog ==
|
478 |
|
479 |
+
|
480 |
+
version 1.4.99: 2022-01-27:
|
481 |
+
|
482 |
+
* Feature: added option for disable content filtering in general settings->troubleshooting
|
483 |
+
* Feature: added taxonomies in widget debug output
|
484 |
+
* Fix: fixed some gallery lazy load related js bugs
|
485 |
+
|
486 |
+
|
487 |
+
version 1.4.98: 2022-01-14:
|
488 |
|
489 |
* Feature: modified remote general js api to fit more types of widgets
|
490 |
* Feature: added support for put meta field in post list
|
release_log.txt
CHANGED
@@ -1,5 +1,12 @@
|
|
1 |
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
version 1.4.98:
|
4 |
|
5 |
-feature: modified remote general js api to fit more types of widgets
|
1 |
|
2 |
|
3 |
+
version 1.4.99:
|
4 |
+
|
5 |
+
-feature: added option for disable content filtering in general settings->troubleshooting
|
6 |
+
-feature: added taxonomies in widget debug output
|
7 |
+
-bug fix: fixed some gallery lazy load related js bugs
|
8 |
+
|
9 |
+
|
10 |
version 1.4.98:
|
11 |
|
12 |
-feature: modified remote general js api to fit more types of widgets
|
unlimited_elements.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: http://unlimited-elements.com
|
5 |
* Description: Unlimited Elements - Huge Widgets Pack for Elementor Website Builder, with html/css/js widget creator and editor
|
6 |
* Author: Unlimited Elements
|
7 |
-
* Version: 1.4.
|
8 |
* Author URI: http://unlimited-elements.com
|
9 |
* Text Domain: unlimited-elements-for-elementor
|
10 |
* Domain Path: /languages
|
4 |
* Plugin URI: http://unlimited-elements.com
|
5 |
* Description: Unlimited Elements - Huge Widgets Pack for Elementor Website Builder, with html/css/js widget creator and editor
|
6 |
* Author: Unlimited Elements
|
7 |
+
* Version: 1.4.99
|
8 |
* Author URI: http://unlimited-elements.com
|
9 |
* Text Domain: unlimited-elements-for-elementor
|
10 |
* Domain Path: /languages
|