function openSide(t,e){$(t).attr("data-open",e),$(".middlelayer").attr("data-open",e),"close"==e&&setTimeout(function(){sliderMove(1)},2e3),"close"==e?$("body").removeClass("bodyViewport"):"open"==e&&$("body").addClass("bodyViewport"),slider_disable_bit="close"==e?!1:!0,"undefined"!=typeof ga&&ga("send","event",{eventCategory:"Interactions",eventAction:t})}function contactResponse(t){"error"==t.type?($(".feedbackMsg").append("
"+t.text+"
"),$(".feedbackMsg").attr("hidden",!1),$(".feedbackMsg").attr("id","error")):"more"==t.type?($(".feedbackMsg").append(""+t.text+"
"),$(".feedbackMsg").attr("hidden",!1),$(".feedbackMsg").attr("id","more"),$("#contactForm input, #contactForm textarea").attr("disabled",!1),"Datoteka"==t.text.substring(0,8)&&(input='#contactForm input[type="file"]',$(input).replaceWith($(input).clone(!0)))):"success"==t.type?($(".feedbackMsg").append(""+t.text+"
"),$("#contactForm, .vsebina > p:first-of-type").slideUp(),$("#contactForm, .vsebina > p:first-of-type").attr("hidden",!0),document.getElementById("contactForm").reset(),$(".feedbackMsg").attr("hidden",!1),$(".feedbackMsg").attr("id","success")):($(".feedbackMsg").append("NEZNANA NAPAKA
Prosim kontaktirajte nas na e-mail info@fanina.si!
error code:"+t.text+"
"),$("#contactForm, .vsebina > p:first-of-type").slideUp(),$("#contactForm, .vsebina > p:first-of-type").attr("hidden",!0),$(".feedbackMsg").attr("hidden",!1),$(".feedbackMsg").attr("id","error")),$("#progress").attr("id","submit")}function contactAjax(t,e){t.preventDefault();var i=new FormData(e);$("#contactForm input, #contactForm textarea").attr("disabled",!0),$('#contactForm input[type="submit"]').attr("id","progress"),$(".feedbackMsg").empty(),$(".feedbackMsg").prop("hidden","true"),$(".feedbackMsg").removeAttr("id"),$.ajax({type:"POST",url:$(e).attr("action"),data:i,cache:!1,contentType:!1,processData:!1,dataType:"json",success:function(t){contactResponse(t),"undefined"!=typeof ga&&ga("send","event",{eventCategory:"Interactions",eventAction:"Msg send",eventLabel:"success"})},error:function(t){contactResponse(t),"undefined"!=typeof ga&&(ga("send","event",{eventCategory:"Interactions",eventAction:"Msg send",eventLabel:"error"}),ga("send","exception",{exDescription:"Contact: "+t,exFatal:!0}))}})}function sliderMove(t){"undefined"!=typeof slider_interval&&clearInterval(slider_interval),"undefined"!=typeof pause_timeout&&clearTimeout(pause_timeout),slider_disable_bit||(position=parseInt($("main .home-wrapper").attr("data-position")),move=t>0&&4==position?1:0>t&&1==position?4:position+t,$("main .home-wrapper").attr("data-position",move),slider_interval=setInterval(function(){sliderMove(1)},7e3))}function sliderPause(t){clearInterval(slider_interval),"undefined"!=typeof pause_timeout&&clearTimeout(pause_timeout),pause_timeout=setTimeout(function(){slider_interval=setInterval(function(){sliderMove(1)},7e3)},1e3*t)}function galleryFullImg(t){var e=$(t).find("img").prop("src"),e=e.slice(e.search("/assets")),e=e.replace("preview","full");return e}function galleryOpen(t){var e=galleryFullImg(t);$("#imageView").css("background-image","url("+e+")");var i=$(t).index("figure");$("#slike").attr("data-position",i),$("body").css("overflow-y","hidden"),$("#galerija").attr("hidden",!1),galleryAnalytics(e)}function galleryClose(){$("#galerija").attr("hidden",!0),$("body").css("overflow-y","scroll")}function galleryShift(t){var e=parseInt($("#slike").attr("data-position"))+t,i=$("#slike").children("figure").length-1;-1>=e?e=i:e>=i+1&&(e=0),$("#slike").attr("data-position",e);var s=$("#slike").children("figure").eq(e),o=galleryFullImg(s);$("#imageView").css("background-image","url("+o+")"),galleryAnalytics(o),galleryPreload(t)}function galleryPreload(t){var e=parseInt($("#slike").attr("data-position")),i={one:e-1,two:e+1,three:t>0?e+2:e-2},s=$("#slike").children("figure").length-1;for(var o in i)i.hasOwnProperty(o)&&(i[o]<=-1?i[o]=s:i[o]>=s+1&&(i[o]=0));for(var o in i)if(i.hasOwnProperty(o)){var n=$("#slike").children("figure").eq(i[o]),r=galleryFullImg(n),l=sumnikiFix(r.slice(r.lastIndexOf("/")+1,r.lastIndexOf(".")));if("undefined"==typeof galleryCache[l]){var a=new Image;a.src=r,galleryCache[l]=a}}}function galleryAnalytics(t){var e=t.slice(t.lastIndexOf("/")+1),i=window.location.pathname,s=i.slice(i.lastIndexOf("/")+1);e=sumnikiFix(e),s=sumnikiFix(s),"undefined"!=typeof ga&&ga("send","event",{eventCategory:"Images",eventAction:s,eventLabel:e})}function scrollHeader(){if(!($("#title > h1").length<=0)){var t=64,e=$(document).scrollTop(),i=$("#title > h1").offset().top-t-10;e>i?$("header").addClass("fixed"):$("header").removeClass("fixed")}}function scrollFooter(){if(!($("footer").length<1)){var t=$("footer"),e=$(window),i=e.scrollTop()+e.height(),s=t.offset().top,o=i-s;$(".tel_btn, .kontakt_btn").css({bottom:o>0?o:0})}}function sumnikiFix(t){return t=t.replace("%C4%8D","c"),t=t.replace("%C5%A1","s"),t=t.replace("%C5%BE","z"),t=t.replace("č","c"),t=t.replace("š","s"),t=t.replace("ž","z")}function smoothScrollInit(){return"undefined"==typeof smoothScroll?void setTimeout(smoothScrollInit,1e3):(console.log("smoothScroll.init"),void smoothScroll.init({speed:500,easing:"easeInOutCubic",updateURL:!1,offset:65}))}function pageInit(){return"undefined"==typeof $?void setTimeout(pageInit,500):($(document).ready(function(){if($("#contactForm").on("submit",function(t){contactAjax(t,this)}),$("header > ul > li:first-of-type").click(function(){openSide("nav","open")}),$("nav > .glava, .middlelayer").click(function(){openSide("nav","close")}),$("nav > ul > li, header > ul > li").click(function(){$(this).find("span").length||(window.location=$(this).children("a").attr("href"))}),$("header > ul > li:last-of-type").click(function(){openSide(".kontakt","open")}),$(".kontakt_btn").click(function(){openSide(".kontakt","open")}),$(".kontakt > .glava, .middlelayer").click(function(){openSide(".kontakt","close")}),$(".kontakt address .info-item").click(function(t){t.preventDefault();var e=this,i=$(e).children("span:nth-of-type(2)").children("a");if(i.length){var s=i.attr("href");if("_blank"==i.attr("target")?window.open(s,"_blank"):window.location=s,"undefined"!=typeof ga){var o=i.parent().siblings('[class^="icons-"]').attr("class");o="kontakt: "+o.slice(o.lastIndexOf("-")+1),ga("send","event",{eventCategory:"Interactions",eventAction:"link",eventLabel:o})}}return!1}),$("main > div.icons-arrow-left").click(function(){sliderMove(-1),sliderPause(5)}),$("main > div.icons-arrow-right").click(function(){sliderMove(1),sliderPause(0)}),$("main figure > figcaption").click(function(){var t=this;window.location=$(t).children("a").attr("href")}),$("main figure > figcaption").hover(function(){sliderPause(5)},function(){}),$("#slike > figure").click(function(){galleryOpen(this)}),$("#galerija > .glava > .icons-close").click(function(){galleryClose()}),$("#imageView > span:first-of-type").click(function(){galleryShift(-1)}),$("#imageView > span:last-of-type").click(function(){galleryShift(1)}),$("video").click(function(){var t=window.chrome,e=window.navigator.vendor;null!==t&&void 0!==t&&"Google Inc."===e&&(this.paused?this.play():this.pause()),this.volume=.5}),document.querySelector("video")&&(document.querySelector("video").onpause=function(){"undefined"!=typeof ga&&ga("send","event",{eventCategory:"video",eventAction:"pause",eventLabel:"pergola",eventValue:0|document.querySelector("video").currentTime})}),$(".copyrightKontakt").click(function(){openSide(".kontakt","open")}),$(document).scroll(function(){scrollHeader(),scrollFooter()}),"undefined"!=typeof $("#tekst2")&&$("#tekst2 > *").clone().appendTo("#tekst"),"undefined"!=typeof $("#leto")){var t=new Date;$("#leto").text(t.getFullYear())}$("a[data-scroll]").click(function(){var t=$(this).attr("href"),e=window.location.pathname,i=e.slice(e.lastIndexOf("/")+1);i=sumnikiFix(i),"undefined"!=typeof ga&&ga("send","event",{eventCategory:"Interactions",eventAction:i,eventLabel:t})}),$(".tel_btn a").click(function(){"undefined"!=typeof ga&&ga("send","event",{eventCategory:"Test",eventAction:"mobile number",eventLabel:"red bottom left"})}),("/"==window.location.pathname||"/index"==window.location.pathname)&&(home=!0),slider_disable_bit=!1,galleryCache=new Array,pause_timeout=setTimeout(function(){},0),slider_interval=setInterval(function(){sliderMove(1)},7e3),scrollHeader(),scrollFooter(),"kontakt"==window.location.hash.substring(1)&&openSide(".kontakt","open"),window.location.search&&"undefined"!=typeof ga&&ga("send","event",{eventCategory:"Interactions",eventAction:"url search",eventLabel:window.location.search})}),void $(document).keydown(function(t){if("undefined"!=typeof slider_disable_bit&&!slider_disable_bit){switch(t.which){case 37:"undefined"!=typeof home&&home?(sliderMove(-1),sliderPause(5)):galleryShift(-1);break;case 39:"undefined"!=typeof home&&home?(sliderMove(1),sliderPause(0)):galleryShift(1);break;case 27:"undefined"==typeof home&&galleryClose();break;default:return}t.preventDefault()}}))}function $buo_f(){var t=document.createElement("script");t.src="//browser-update.org/update.min.js",document.body.appendChild(t)}"undefined"==typeof $?setTimeout(pageInit,500):pageInit(),"undefined"==typeof smoothScroll?setTimeout(smoothScrollInit,1e3):smoothScrollInit(),window.onload=function(){"undefined"==typeof jQuery&&(document.write(unescape("%3Cscript src='assets/scripts/jquery/jquery.min.js' %3E%3C/script%3E")),console.warn("loading jQ from fanina.si"))},window.onerror=function(t,e,i,s,o){try{o&&(t=o.stack),ga("send","event","everyError",e+i,t)}catch(n){}};var $buoop={c:2};try{document.addEventListener("DOMContentLoaded",$buo_f,!1)}catch(e){window.attachEvent("onload",$buo_f)}