jQuery(document).foundation();var mySlider=null;var contentList=[];var timer;jQuery(window).bind("resize",function(){timer&&clearTimeout(timer);timer=setTimeout(initSlider,100)});function initSlider(){if(mySlider&&typeof mySlider.destroySlider==="function"){mySlider.destroySlider()}mySlider=jQuery("#gallery-single-line .bxslider"),mySliderConfig={infiniteLoop:false,hideControlOnEnd:true,minSlides:1,maxSlides:3,moveSlides:1,pager:false,onSliderLoad:function(){jQuery("#gallery-single-line").css("visibility","visible")},onSlideNext:function(){setTimeout(function(){jQuery(window).trigger("scroll")},100)},onSlidePrev:function(){setTimeout(function(){jQuery(window).trigger("scroll")},100)}};if(mySlider.length){manageSliderDescription();mySlider.bxSlider(mySliderConfig);jQuery(document).keydown(function(e){if(e.keyCode==39){mySlider.goToNextSlide();return false}else if(e.keyCode==37){mySlider.goToPrevSlide();return false}})}}function manageSliderDescription(){var ww=jQuery(window).width();if(ww<=1024){removeSliderDescription()}else if(ww>1024){mySlider.prepend(contentList[0]);if(contentList.length>1){mySlider.append(contentList[1])}}}function removeSliderDescription(){var slide=mySlider.children();if(jQuery(slide).find(".slide-content").length){contentList=[]}jQuery(slide).each(function(){if(jQuery(this).children(".slide-content").length>0){contentList.push(jQuery(this));jQuery(this).remove()}})}function floPlayVideo(post_id){jQuery("#flo-loading").css("background","rgba(255,255,255,0.2)");jQuery("#flo-loading").fadeIn("slow");jQuery.ajax({url:ajaxurl,data:"&action=video_embed&post_id="+post_id,type:"POST",dataType:"json",cache:false,success:function(json){if(json.video){jQuery(".feat-video-img").html(json.video)}jQuery("#flo-loading").fadeOut("slow")}})}function resizeVideo(){if(jQuery(".post-content iframe").length){var iframe_width=jQuery(".post-content iframe").width();var iframe_height=jQuery(".post-content iframe").height();var iframe_src=jQuery(".post-content iframe").attr("src");if(iframe_src.indexOf("vimeo")>-1){var iframe_proportion=1.77}else if(iframe_src.indexOf("youtube")>-1){var iframe_proportion=1.77}else{var iframe_proportion=iframe_width/iframe_height}var new_iframe_width=jQuery(".post-content").width();if(new_iframe_width>900){new_iframe_width=900}var new_iframe_height=new_iframe_width/iframe_proportion;if(new_iframe_height>jQuery(window).height()){new_iframe_height=jQuery(window).height()-40}jQuery(".post-content iframe ").each(function(){jQuery(this).attr("width",new_iframe_width);jQuery(this).attr("height",new_iframe_height)})}if(jQuery(".post-content object").length){var iframe_width1=jQuery(".post-content object").width();var iframe_height1=jQuery(".post-content object").height();var iframe_proportion1=iframe_width1/iframe_height1;var new_iframe_width1=jQuery(".post-content").width();var new_iframe_height1=new_iframe_width1/iframe_proportion1;if(new_iframe_height1>jQuery(window).height()){new_iframe_height1=jQuery(window).height()-40}jQuery(".post-content object ").each(function(){jQuery(this).attr("width",new_iframe_width1);jQuery(this).attr("height",new_iframe_height1)})}}function cosmoSendMail(form,container){jQuery("#cosmo-name").removeClass("input-error");jQuery("#cosmo-email").removeClass("input-error");jQuery(container).html("");jQuery("#flo-loading").css("background","rgba(255,255,255,0.2)");jQuery("#flo-loading").fadeIn("slow");jQuery.ajax({url:ajaxurl,data:"&action=cosmoSendContact&"+jQuery(form).serialize(),type:"POST",dataType:"json",cache:false,success:function(json){jQuery("#flo-loading").fadeOut("slow");if(json.contact_name){jQuery("#cosmo-name").addClass("input-error");jQuery(container).append(json.contact_name)}if(json.contact_email){jQuery("#cosmo-email").addClass("input-error");jQuery(container).append(json.contact_email)}if(json.message){jQuery(".flo-modal").fadeIn("slow");jQuery(form).find('input[type="text"], textarea').val("");setTimeout(function(){jQuery(".flo-modal").fadeOut("slow")},3e3)}}})}function resize_vertical(){var normal_height=jQuery(".normal_item_vert").height();var normal_vertical_height=normal_height*2+20;var window_width=jQuery(window).width();if(window_width>741){jQuery(".vertical_item").each(function(){jQuery(this).css("height",normal_vertical_height);jQuery("a.grid-item__link",this).css("height",normal_vertical_height);jQuery("img",this).css("height",normal_vertical_height)})}else{jQuery(".vertical_item").each(function(){jQuery(this).css("height",normal_height);jQuery("a.grid-item__link",this).css("height",normal_height);jQuery("img",this).css("height",normal_height)})}}function resize_horisontal(){var normal_height=jQuery(".normal_item_hor").height();jQuery(".horizontal_item").each(function(){jQuery(this).css("height",normal_height);jQuery("a.grid-item__link",this).css("height",normal_height);jQuery("img",this).css("height",normal_height)})}function center_middle_menu_logo(){if(jQuery(window).width()>768){var left_length=0,right_length=0,current_menu_side="left";if(jQuery(".header-option-three .menu").length){jQuery(".header-option-three .menu>li").each(function(index){if(jQuery(this).hasClass("menu-logo")){current_menu_side="right";return}if(current_menu_side=="left"){left_length+=jQuery(this).width()}if(current_menu_side=="right"){right_length+=jQuery(this).width()}});var menu_shift=right_length-left_length;var menu_shift_px=menu_shift+"px";if(header_3_logo_shift.header_3_logo_shift_value!==menu_shift_px){jQuery(".header-option-three .menu").animate({marginLeft:menu_shift_px},1e3,"swing");flo_update_header_3_logo_shift(menu_shift_px)}}}else{jQuery(".header-option-three .menu").css("margin-left","0px")}}function flo_update_header_3_logo_shift(menu_shift_px){jQuery.ajax({url:ajaxurl,data:"&action=center_header_3_logo_shift&header_3_logo_shift="+menu_shift_px+"&header_3_logo_nonce="+header_3_logo_shift.header_3_logo_nonce,type:"POST",cache:false,success:function(response){console.log(response)}})}center_middle_menu_logo();function floInitjScrollPane(){jQuery(".js-scroll-pane").each(function(){jQuery(this).jScrollPane();if(jQuery(this).hasClass("jspScrollable")){jQuery(this).parents(".gradient-overflow").addClass("is-visible-gradient-overflow")}var api=jQuery(this).data("jsp");var throttleTimeout;jQuery(window).bind("resize",function(){if(!throttleTimeout){throttleTimeout=setTimeout(function(){api.reinitialise();throttleTimeout=null},50)}})})}jQuery(document).ready(function(){jQuery(".royalSlider").animate({opacity:1});var ww=jQuery(window).width(),wh=jQuery(window).height();resizeVideo();jQuery(".play-video-iframe").click(function(){floPlayVideo(jQuery(this).data("video"))});var mainNavClone=jQuery("#site-navigation").html();jQuery(mainNavClone).clone(true).appendTo(".rwd-main-navigation .row .small-12");var floSlidesOrientation=fw_i18n.orientation;var transitionType=fw_i18n.transitionType;var customSliderWidth=null,customSliderHeight=null,windowWidth;function setCustomSliderDimention(){windowWidth=jQuery(window).width();if(windowWidth<=768){customSliderWidth=800;customSliderHeight=800*floScaleSliderHeight/floScaleSliderWidth}else if(windowWidth>768){customSliderWidth=floScaleSliderWidth;customSliderHeight=floScaleSliderHeight}}setCustomSliderDimention();var autopl=parseInt(slideshow_autoplay);jQuery("#home-page-slider").royalSlider({keyboardNavEnabled:true,imageScaleMode:"fill",autoScaleSlider:true,autoScaleSliderWidth:customSliderWidth,autoScaleSliderHeight:customSliderHeight,slidesSpacing:0,arrowsNav:false,sliderTouch:false,loopRewind:true,transitionType:transitionType,slidesOrientation:floSlidesOrientation,autoPlay:{enabled:autopl,pauseOnHover:true,delay:main_slideshow_autoplay_dalay}});var sliderHome=jQuery("#home-page-slider").data("royalSlider"),sliderGallery=jQuery("#gallery-slider").data("royalSlider");var sliderBullets=jQuery(".royalSlider").children(".rsBullets"),sliderBulletsHeight=sliderBullets.height(),sliderBulletsWidth=sliderBullets.width();if(jQuery("#home-page-slider").length){if(jQuery(".rsVer").length){sliderBullets.css("margin-bottom",-sliderBulletsHeight/2)}else if(jQuery(".rsHor").length){sliderBullets.css("margin-right",-sliderBulletsWidth/2)}}floInitjScrollPane();var delay=4e3;function cycleThru(variable,j){var jmax=jQuery(variable+" div").length;jQuery(variable+" div:eq("+j+")").css("display","block").animate({opacity:1},600).animate({opacity:1},delay).animate({opacity:0},800,function(){if(j+1===jmax){j=0}else{j++}jQuery(this).css("display","none").animate({opacity:0},10);cycleThru(variable,j)})}jQuery(".tweets").each(function(index,val){var parent_tweets=jQuery(val).parent().attr("id");var actioner="#"+parent_tweets+" .tweets .dynamic .flo_twitter .slides_container";cycleThru(actioner,0)});jQuery(".js-toggle-main-navigation, .js-toggle-search-bar").click(function(e){var self=jQuery(this),href=self.attr("href"),id,childIcon=self.children("i");e.preventDefault();if(href=="#main-navigation"){id="#main-navigation";jQuery(".header-main .search-toggle").removeClass("visuallyhidden")}else if(href=="#search-container"){id="#search-container";jQuery(".header-main .search-toggle").addClass("visuallyhidden")}if(jQuery(e.target).parent().is(".js-toggle-main-navigation")){if(childIcon.hasClass("icon-menu")){childIcon.removeClass("icon-menu").addClass("icon-x-")}else if(childIcon.hasClass("icon-x-")){childIcon.removeClass("icon-x-").addClass("icon-menu")}}else{jQuery(".js-toggle-main-navigation i").removeClass("icon-x-").addClass("icon-menu")}checkRwdMenu();if(!jQuery(id).is(":visible")){if(!jQuery(".is-open-top-bar").is(":visible")){jQuery(id).slideDown(200).addClass("is-open-top-bar");jQuery("#siteSearch").focus()}else{jQuery(".is-open-top-bar").removeClass("is-open-top-bar").slideUp(200,function(){setTimeout(function(){jQuery(id).slideDown(200).addClass("is-open-top-bar");jQuery("#siteSearch").focus()},100)})}}else{jQuery(id).slideUp(200).removeClass("is-open-top-bar");jQuery("#siteSearch").blur()}});jQuery(".js-close-header-search").click(function(e){e.preventDefault();jQuery("#search-container").slideUp(200).removeClass("is-open-top-bar");jQuery(".header-main .search-toggle").removeClass("visuallyhidden")});function checkRwdMenu(){if(".is-open-rwd-menu".length){jQuery(".is-open-rwd-menu").removeClass("is-open-rwd-menu")}}jQuery(".menu-toggle").click(function(){if(jQuery("#search-container.is-open-top-bar").length){jQuery("#search-container.is-open-top-bar").slideUp(200,function(){jQuery(".rwd-main-navigation").toggleClass("is-open-rwd-menu")})}else{jQuery(".rwd-main-navigation").toggleClass("is-open-rwd-menu")}});(function submenuOpenDirection(){jQuery(".menu-item-has-children").hover(function(){var el=jQuery(this),ww=jQuery(window).width(),child=el.children(".children"),cw=jQuery(child).width(),cOffset=jQuery(child).offset().left,spaceLeft=ww-cOffset;if(spaceLeft<cw){if(showSubmenu){clearTimeout(showSubmenu)}jQuery(child).css({display:"none"});el.addClass("children-open-left");showSubmenu}else if(ww<cw){return}var showSubmenu=setTimeout(function(){jQuery(child).animate({opacity:1},100).removeAttr("style")},130)},function(){jQuery(".menu-item-has-children").removeClass("children-open-left");jQuery(".menu-item-has-children .children").removeAttr("style")})})();jQuery(window).load(function(){var isotope=jQuery(".isotope-grid");isotope.isotope({itemSelector:".grid-item",layoutMode:"packery"})});jQuery(window).load(function(){var isotopePosts=jQuery(".isotope-posts");isotopePosts.isotope({itemSelector:".isotope-post-item",layoutMode:"packery"})});jQuery(".link-share").click(function(){jQuery(this).parents(".social-links").toggleClass("is-open-share-icons")});if(show_comments_block=="no"){jQuery("#comments").hide();jQuery(".js-open-comments").click(function(e){e.preventDefault();jQuery(this).parents(".article").find("#comments").slideToggle(200)})}else{jQuery(".js-open-comments").click(function(e){e.preventDefault()})}jQuery("#gallery-single-line .lazy").lazyload({effect:"fadeIn",threshold:800});initSlider();if(mySlider.length){jQuery(document).keydown(function(e){if(e.keyCode==39){mySlider.goToNextSlide();return false}else if(e.keyCode==37){mySlider.goToPrevSlide();return false}})}var sliderH=jQuery("#gallery-single-line .bx-viewport").height(),sliderImg=jQuery("#gallery-single-line li img");jQuery(sliderImg).each(function(){var imgH=jQuery(this).attr("height");if(imgH<sliderH){jQuery(this).parent().addClass("image-fit")}});jQuery("a.bx-prev, a.bx-next").bind("click",function(){setTimeout(function(){jQuery(window).trigger("scroll")},10)});function setGallerySliderHeight(){var headerH=jQuery("#musthead").outerHeight(),infoH=jQuery(".gallery-meta_header").outerHeight(),restH=wh-(headerH+infoH),minHeightAllowed=300;if(restH<minHeightAllowed){restH=minHeightAllowed}return restH}var gallerySliderFull=jQuery("#gallery-full-width .royalSlider").royalSlider({loop:false,keyboardNavEnabled:true,imageScaleMode:"fill",controlNavigation:"none",navigateByClick:true,slidesSpacing:0,arrowsNavAutoHide:false,autoScaleSlider:true,autoScaleSliderWidth:ww,autoScaleSliderHeight:setGallerySliderHeight()}).data("royalSlider");var gallerySliderNarrow=jQuery("#gallery-narrow .royalSlider").royalSlider({loop:false,keyboardNavEnabled:true,imageScaleMode:"fit",controlNavigation:"none",navigateByClick:true,slidesSpacing:0,arrowsNavAutoHide:false,numImagesToPreload:4}).data("royalSlider");if(jQuery(".flo-post-slider.royalSlider").length){var post_sl_width,post_sl_height;post_sl_width=jQuery(".flo-post-slider.royalSlider").data("width");post_sl_height=jQuery(".flo-post-slider.royalSlider").data("height");var gallerySliderNarrow=jQuery(".flo-post-slider.royalSlider").royalSlider({loop:false,keyboardNavEnabled:true,imageScaleMode:"fit",controlNavigation:"none",navigateByClick:true,slidesSpacing:0,arrowsNavAutoHide:false,numImagesToPreload:4,autoScaleSlider:true,autoScaleSliderWidth:post_sl_width,autoScaleSliderHeight:post_sl_height}).data("royalSlider")}jQuery(".flo-modal .thx-msg .icon-close").click(function(){jQuery(".flo-modal").fadeOut("slow")});jQuery(window).resize(function(){center_middle_menu_logo();var ww=jQuery(window).width(),generalTimeout;clearTimeout(generalTimeout);if(ww>768){setTimeout(function(){checkRwdMenu()},100)}else if(ww<=767){}resizeVideo()});jQuery(window).resize(function(){resize_vertical();resize_horisontal()});jQuery(window).load(function(){resize_vertical();resize_horisontal()});jQuery("a[data-fancybox-group^='prettyPhoto']").fancybox({padding:0,openEffect:"elastic",openSpeed:150,closeEffect:"elastic",closeSpeed:150,closeClick:true});var topOfssetCustom=jQuery("#popup_anchor"),scrol_to_top;if(jQuery(".sticky").length>0){var header_top=parseInt(jQuery("#musthead .sticky").height());if(topOfssetCustom.length>0){scrol_to_top=topOfssetCustom.offset().top;scrol_to_top=parseInt(scrol_to_top)-parseInt(header_top)-20}}function initFullSliderPopup(){initSlider();setTimeout(function(){jQuery(".gallery-meta-toggle .js-scroll-pane").jScrollPane()},150);jQuery(".js-scroll-pane").each(function(){jQuery(this).jScrollPane();if(jQuery(this).hasClass("jspScrollable")){jQuery(this).parents(".gradient-overflow").addClass("is-visible-gradient-overflow")}var api=jQuery(this).data("jsp");var throttleTimeout;jQuery(window).bind("resize",function(){if(!throttleTimeout){throttleTimeout=setTimeout(function(){api.reinitialise();throttleTimeout=null},50)}})})}function initSliderNarrowPopup(){setTimeout(function(){var narrow_full=jQuery("#gallery-narrow .royalSlider").royalSlider({loop:false,keyboardNavEnabled:true,imageScaleMode:"fit",controlNavigation:"none",navigateByClick:true,slidesSpacing:0,arrowsNavAutoHide:false,numImagesToPreload:4}).data("royalSlider")},100)}function initSliderVisibleArrowPopup(){setTimeout(function(){var arrow_full=jQuery("#gallery-full-width .royalSlider").royalSlider({loop:false,keyboardNavEnabled:true,imageScaleMode:"fill",controlNavigation:"none",navigateByClick:true,slidesSpacing:0,arrowsNavAutoHide:false,autoScaleSlider:true,autoScaleSliderWidth:ww,autoScaleSliderHeight:setGallerySliderHeight()}).data("royalSlider")},100)}function singlePopupRoyal(slide_id){var curId=jQuery("div.popup_container").attr("cur_id");var visible=jQuery("div.popup_container").hasClass("visible");var arrow_full_popup;if(!visible){setTimeout(function(){var visible=jQuery("div.popup_container").hasClass("visible");arrow_full_popup=jQuery("#popup_slider_royal .royalSlider").royalSlider({loop:false,keyboardNavEnabled:true,imageScaleMode:"fit",controlNavigation:"none",navigateByClick:true,slidesSpacing:0,arrowsNavAutoHide:false,numImagesToPreload:4,startSlideId:slide_id,globalCaption:true}).data("royalSlider");jQuery("div.popup_container").addClass("visible")},40)}else{if(curId!=slide_id){setTimeout(function(){var visible=jQuery("div.popup_container").hasClass("visible");arrow_full_popup=jQuery("#popup_slider_royal .royalSlider").royalSlider({loop:false,keyboardNavEnabled:true,imageScaleMode:"fit",controlNavigation:"none",navigateByClick:true,slidesSpacing:0,arrowsNavAutoHide:false,numImagesToPreload:4,startSlideId:slide_id,globalCaption:true}).data("royalSlider");arrow_full_popup.goTo(slide_id);jQuery("div.popup_container").addClass("visible")},100)}}}function scrollToPopup(){jQuery("body").animate({scrollTop:scrol_to_top},1e3)}if(jQuery("#popup_anchor").length>0){if(jQuery(".popup_single").length>0){jQuery(".show_in_popup > a").on("click",function(e){jQuery("div.popup_container").attr("cur_id",slide_id);e.preventDefault();scrollToPopup();var $image_source=jQuery("img",this).attr("src");var slide_id;slide_id=parseInt(jQuery(this).parents("div.small-12").attr("slide_id"));var visible=jQuery("div.popup_container").hasClass("visible");if($image_source.length>0){singlePopupRoyal(slide_id);if(visible){scrollToPopup()}if(!visible){jQuery("div.popup_container").slideDown("slow",function(){scrollToPopup()});jQuery(".single_popup_close").show();if(jQuery(".isotope-grid").length>0){var $container=jQuery(".isotope-grid");$container.isotope("layout")}}}})}else{jQuery(".show_in_popup > a, .show_in_popup figure, .flo-entry-content .show_in_popup a, .flo-entry-content .show_in_popup figure").on("click",function(e){e.preventDefault();jQuery("#main").animate({opacity:0});jQuery("body").find("div.loader").show();scrollToPopup();var data_id=jQuery(this).parents("article").attr("data_id");var popup_id=jQuery("div.popup_container section").attr("gallery_id");if(data_id!=popup_id){singlePopup(data_id)}})}}jQuery(document).on("click","a.close_popup",function(e){jQuery("div.popup_container").removeClass("visible");jQuery("div.popup_container").slideUp("slow");jQuery(".single_popup_close").hide();e.preventDefault()});function singlePopup(post_id){jQuery.ajax({url:flo_ajaxurl,data:"&action=single_gallery_popup&post_id="+post_id,type:"POST",dataType:"html",cache:true,success:function(html){var visible=jQuery("div.popup_container").hasClass("visible");jQuery("div.popup_container").addClass("visible");jQuery("div.popup_container").html(html);jQuery(".royalSlider").animate({opacity:0});if(visible){scrollToPopup();setTimeout(function(){jQuery("#main").animate({opacity:1});jQuery("body").find("div.loader").hide()},400);jQuery(".royalSlider").animate({opacity:1})}if(slider_type=="full_with_content"){initSlider();jQuery("#gallery-single-line .lazy").lazyload({effect:"fadeIn",threshold:800});jQuery(".single_popup_close").show();setTimeout(function(){floInitjScrollPane()},100)}else if(slider_type=="visible_arrow"){initSliderVisibleArrowPopup();jQuery(".royalSlider").animate({opacity:1})}else{initSliderNarrowPopup();jQuery(".royalSlider").animate({opacity:1})}if(!visible){jQuery("div.popup_container").slideDown("slow",function(){scrollToPopup()});setTimeout(function(){jQuery("#main").animate({opacity:1})},400);jQuery("body").find("div.loader").hide()}}})}});