
/* -- FILE: [javascripts/main.js]*/
$window=$(window);$htmlBody=$('html, body');var $menu={mainContainer:$('main'),menuContainer:$('#menu'),menuEmptyItem:$('#menu a[href="#"]'),menuHeader:$('#menu-header'),menuOverlay:$('#menu .menu-overlay'),openButton:$('#menu-button'),header:$('#menu-header'),headerLogos:$('#main-logos a'),searchButton:$('#search-button'),searchInput:$('#searchphrase'),subMenu:$('#sub-menu'),subMenuEmptyItem:$('#sub-menu a[href="#"]'),subMenuSon:$('#sub-menu ul:first-child'),subMenuDropDown:$('#sub-menu li.parent ul'),subMenuItemsWidth:400,closeButton:false,menuHeaderVisible:false,};var $mainSlider={container:$('#main-slider'),loop:($('#main-slider').find('.item').length==1)?false:true,downArrow:$('#nav-down-arrow'),};var $hashSlider={container:$('.hash-slider'),};var $albumSlider={container:$('.album-slider'),item:$('.album-slider a'),fullContainer:$('.detail-album-slider'),fullItem:$('.detail-album-slider a'),};var $oneSlider={container:$('.one-slider'),};var $fullAutoSlowSlider={container:$('.full-auto-slow-slider'),};var $catList={container:$('.col-catalog-category'),son:$('.col-catalog-category div'),topFix:40};var hashLink=$('.hash-link');var arrowTop={container:$('.arrow-scroll-top')};var $lightGallery=$('.light-gallery');function toogleArrowScrollTop(wst,showHeight){if(wst>showHeight&&arrowTop.container.hasClass('d-n')){arrowTop.container.removeClass('d-n');}else if(wst<showHeight&&!arrowTop.container.hasClass('d-n')){arrowTop.container.addClass('d-n');}}
function setFixed(item,scrollTop,offsetTop){if($(window).scrollTop()>=offsetTop-scrollTop){item.css({'position':'fixed','top':scrollTop});}else{item.css({'position':'','top':''});}}
function setCookie(cname,cvalue,exdays){var d=new Date();d.setTime(d.getTime()+(exdays*24*60*60*1000));var expires="expires="+d.toUTCString();document.cookie=cname+"="+cvalue+";"+expires+";path=/";}
function getCookie(cname){var name=cname+"=";var decodedCookie=decodeURIComponent(document.cookie);var ca=decodedCookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1);}
if(c.indexOf(name)===0){return c.substring(name.length,c.length);}}
return"";}
function savePrevPage(){setCookie('prevPage',window.location,1);}
function setPrevPageLink(){$('.prev-page-link').attr('href',getCookie('prevPage'));}
function toggleAttr(obj,attr,val_01,val_02){if(obj.attr(attr)==val_01){obj.attr(attr,val_02);}else if(obj.attr(attr)==val_02){obj.attr(attr,val_01);}}
var eachSymbol;function setPlaceholder(input,text,speed){clearInterval(eachSymbol);var textLength=text.length;var i=0;eachSymbol=setInterval(function(){input.attr('placeholder',text.substr(0,i));i++;if(i==textLength+1){clearInterval(eachSymbol);}},speed);}
function displaySubMenu(wh,wst){if(wst>wh/4&&!$menu.menuHeaderVisible){toggleAttr($menu.menuHeader,'data-scroll','hidden','show');toggleAttr($menu.subMenu,'data-scroll','hidden','show');$menu.menuHeaderVisible=true;}else if(wst<wh/4&&$menu.menuHeaderVisible){toggleAttr($menu.menuHeader,'data-scroll','hidden','show');toggleAttr($menu.subMenu,'data-scroll','hidden','show');$menu.menuHeaderVisible=false;}}
function resizeSubMenu(ww){if(ww<$menu.subMenu.width()+$menu.subMenuItemsWidth){$menu.subMenu.css({'max-width':ww-$menu.subMenuItemsWidth});$menu.subMenuSon.css({'margin-top':'20px'});}else if(ww>$menu.subMenu.width()+$menu.subMenuItemsWidth){$menu.subMenu.css({'max-width':ww-$menu.subMenuItemsWidth});if($menu.subMenuSon.height()<62&&$menu.subMenuSon.is(':visible')){$menu.subMenuSon.css({'margin-top':'35px'});}}}
function toggleMenu(){toggleAttr($menu.menuContainer,'data-open','open','close');toggleAttr($menu.mainContainer,'data-menu-open','open','close');toggleAttr($menu.header,'data-menu-open','open','close');toggleAttr($menu.subMenu,'data-open','open','close');$menu.headerLogos.toggleClass('menu-open');$menu.openButton.toggleClass('is-close');$menu.openButton.toggleClass('is-open');}
function focusSearchInput(){if($menu.menuContainer.attr('data-open')=='open'){$menu.searchInput.val('');$menu.searchInput.focus();setPlaceholder($menu.searchInput,'Vyhledávání: zadejte text...',80);}else{toggleMenu();$menu.searchInput.val('');$menu.searchInput.focus();setPlaceholder($menu.searchInput,'Vyhledávání: zadejte text...',80);}}
function slideToContent(){$htmlBody.animate({scrollTop:$mainSlider.container.height()},800);}
var $cs={c:$('.custom-slider'),};$window.on('load',function(){var rightSideBlock=$('.right-side-block'),cssData,rsbResizeDelay;if(rightSideBlock[0]){if($window.scrollTop()+$window.outerHeight(true)>$htmlBody.outerHeight(true)-$('#footer').outerHeight(true)-60){cssData={width:'',left:'',top:''};rightSideBlock.css(cssData);}else if($window.scrollTop()>$('.detail-slide').outerHeight(true)-$menu.menuHeader.outerHeight(true)){cssData={width:rightSideBlock.outerWidth(),left:rightSideBlock.offset().left,top:$menu.menuHeader.outerHeight(true)-1};rightSideBlock.css(cssData);}
$window.resize(function(){clearTimeout(rsbResizeDelay);rsbResizeDelay=setTimeout(function(){rightSideBlock.css({width:$('.right-side-block-position-controll').outerWidth(true),left:''});},50);});rightSideBlock.affix({offset:{top:function(){if(rightSideBlock.hasClass('affix-bottom')){return $('#footer').outerHeight(true)+60;}else{return($('.detail-slide').outerHeight(true)-$menu.menuHeader.outerHeight(true));}},bottom:function(){return($('#footer').outerHeight(true)+60);}}});rightSideBlock.on('affix.bs.affix',function(){var cssData={width:rightSideBlock.outerWidth(),left:rightSideBlock.offset().left,top:$menu.menuHeader.outerHeight(true)-1};rightSideBlock.css(cssData);});rightSideBlock.on('affix-top.bs.affix',function(){var cssData={width:'',height:'',left:'',top:''};rightSideBlock.css(cssData);});rightSideBlock.on('affix-bottom.bs.affix',function(){var cssData={left:''};rightSideBlock.css(cssData);});}});function LightGalleryControl()
{this.option={enableSwipe:true,enableDrag:true,loop:true,hideBarsDelay:2000,loadVimeoThumbnail:true,loadYoutubeThumbnail:true,videoMaxWidth:'80%',thumbWidth:140,showThumbByDefault:false,download:false,selector:'.owl-item:not(.cloned) .lg-item'}
this.ready=false;this.gallery=null;this.masonry=null;this.masonryOption={itemSelector:'.grid-item',columnWidth:'.grid-item-sizer',percentPosition:true,gutter:0};this._initGallery=function($cnt)
{if($cnt.hasClass('grid'))this.option.selector='.lg-item';this.gallery=$cnt.lightGallery(this.option);$('body').on('mouseenter','.lg-autoplay-button',function(){$(this).tooltip({placement:'bottom',title:'Autoplay'})})}
this._appendAssets=function($cnt)
{var self=this;var css=$('<link />',{href:content_url+"/files/css/lightgallery.min.css",rel:'stylesheet',type:'text/css'})
$('head').append([css]);(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}
js=d.createElement(s);js.id=id;js.onload=function(){self._initGallery($cnt)};js.src=content_url+'/files/js/lightgallery-all.min.js';fjs.parentNode.insertBefore(js,fjs);}(document,'script','lg-script'));(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}
js=d.createElement(s);js.id=id;js.onload=function(){self.masonry=$('.grid').masonry(self.masonryOption);};js.src='https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js';fjs.parentNode.insertBefore(js,fjs);}(document,'script','masonry-script'));}
this.init=function($cnt)
{if(!$cnt[0])return;this.ready=true;this._appendAssets($cnt)}
return this;}
var lg=new LightGalleryControl();lg.init($lightGallery);function LightSliderControl()
{this.option={}
this.ready=false;this._appendAssets=function($cnt)
{var self=this;var lgCss=$('<link />',{href:content_url+"/files/css/lightgallery.min.css",rel:'stylesheet',type:'text/css'})
var lScss=$('<link />',{href:content_url+"/files/css/lightslider.min.css",rel:'stylesheet',type:'text/css'})
$('head').append([lgCss,lScss]);(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}
js=d.createElement(s);js.id=id;js.onload=function(){console.log('LightGallery ready');};js.src=content_url+'/files/js/lightgallery-all.min.js';fjs.parentNode.insertBefore(js,fjs);}(document,'script','lg-script'));(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}
js=d.createElement(s);js.id=id;js.onload=function(){console.log('LightGallery ready');$cnt.lightSlider({gallery:true,item:4,loop:true,thumbItem:9,slideMargin:0,enableDrag:false,currentPagerPosition:'left',onSliderLoad:function(el){el.lightGallery({selector:'#imageGallery .lslide'});}});};js.src=content_url+'/files/js/lightslider.min.js';fjs.parentNode.insertBefore(js,fjs);}(document,'script','ls-script'));}
this.init=function($cnt)
{if(!$cnt[0])return;this.ready=true;this._appendAssets($cnt)}
return this;}
var ls=new LightSliderControl();ls.init($('.light-slider'));function lazyLoadImages($images)
{this._appendAssets=function()
{var self=this;(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}
js=d.createElement(s);js.id=id;js.onload=function(){$images.Lazy({delay:200,afterLoad:function(element){if(lg&&lg.ready)lg.masonry.masonry(lg.masonryOption)},});};js.src=content_url+'/files/js/jquery.lazy.min.js';fjs.parentNode.insertBefore(js,fjs);}(document,'script','lazy-script'));}
if($images.length)this._appendAssets();}
var lazyImages=lazyLoadImages($('.lazy'));$(function(){if($cs.c){$cs.c.each(function(){$(this).owlCarousel({nav:false,dots:$(this).attr('data-dots')=='true',loop:$(this).attr('data-loop')=='true',autoplay:$(this).attr('data-autoplay')=='true',autoplayHoverPause:$(this).attr('data-autoplayHoverPause')=='true',lazyLoad:$(this).attr('data-lazy')=='true',autoHeight:$(this).attr('data-autoHeight')=='true',margin:parseInt($(this).attr('data-margin')),items:parseInt($(this).attr('data-items')),smartSpeed:parseInt($(this).attr('data-smartSpeed')),autoplayTimeout:parseInt($(this).attr('data-autoplayTimeout')),});});}
if($.fn.srtc){$(document).srtc({commands:{'s':function(){focusSearchInput();},' ':function(){toggleMenu();},'cpp':function(){window.location.replace(root_url+"/cpp/");},'cpc':function(){window.location.replace(root_url+"/cpc/");},'cpa':function(){window.location.replace(root_url+"/cpa/");},'cnp':function(){window.location.replace(root_url+"/cnp/");},'home':function(){window.location.replace(root_url+"/");},'cz':function(){window.location.replace(root_url+"/");},'en':function(){window.location.replace(root_url+"/en/cp-en/");},'news':function(){window.location.replace(root_url+"/novinky/");},'b':function(){window.location.replace(getCookie('prevPage'));},},clearDelay:500,});}else{console.error('srtc() is not defined')}
arrowTop.container.on('click',function(){$htmlBody.animate({scrollTop:0},800);});hashLink.on('click',function(event){if(this.hash!==""){event.preventDefault();var hash=this.hash;$htmlBody.animate({scrollTop:$(hash).offset().top-$menu.menuHeader.height()-15},800);}});if(window.location.hash&&window.location.hash.indexOf('#cat-')==0){var hash=window.location.hash;$htmlBody.animate({scrollTop:$(hash).offset().top-$menu.menuHeader.height()-15},50);}
var wh=$(window).height(),ww=$(window).width(),wst=$(window).scrollTop(),bh=$('body').height();$(window).resize(function(){wh=$(window).height();ww=$(window).width();bh=$('body').height();resizeSubMenu(ww);});resizeSubMenu(ww);$(window).scroll(function(){wst=$(window).scrollTop();displaySubMenu(wh,wst);if($catList.container.length>0&&ww>=1300){setFixed($catList.son,115,305);}
toogleArrowScrollTop(wst,wh);});displaySubMenu(wh,wst);if($catList.container.length>0&&ww>=1300){setFixed($catList.son,115,305);}
$(window).bind('beforeunload',function(){savePrevPage();});setPrevPageLink();$menu.openButton.click(function(){toggleMenu();});$menu.menuOverlay.click(function(){toggleMenu();});$menu.searchButton.click(function(){focusSearchInput();});$menu.subMenuEmptyItem.click(function(e){e.preventDefault()});$menu.menuEmptyItem.click(function(e){e.preventDefault()});$mainSlider.container.owlCarousel({nav:true,dots:false,loop:$mainSlider.loop,items:1,autoplay:true,smartSpeed:1500,});$mainSlider.downArrow.click(slideToContent);setTimeout(function(){$hashSlider.container.owlCarousel({dots:false,loop:false,items:1,smartSpeed:500,URLhashListener:true,startPosition:'URLHash',autoplayHoverPause:true,autoHeight:true,onTranslate:function(event){var hash=window.location.hash;$('.toggle-header-list li a').removeClass('active');$('a[href='+hash+']').addClass('active');},});},200);$albumSlider.container.owlCarousel({stagePadding:50,autoplay:true,dots:false,loop:true,lazyLoad:false,items:5,margin:10,smartSpeed:500,autoHeight:true,responsive:{0:{items:1,},400:{items:3,},1000:{items:5,}},onInitialized:function(){setTimeout(function(){$albumSlider.container.trigger('prev.owl.carousel');},200)
setTimeout(function(){$albumSlider.container.trigger('next.owl.carousel');},225)}});$albumSlider.fullContainer.hideGallery=function(){if($('.gallery-iframe')[0]){$('.gallery-iframe').each(function(){el=$(this);el.attr('src',el.attr('src'));});}
$albumSlider.fullContainer.hide();}
$albumSlider.fullContainer.owlCarousel({nav:true,dots:false,loop:true,lazyLoad:true,items:1,smartSpeed:500,autoplayHoverPause:false,autoHeight:false,URLhashListener:true,startPosition:'URLHash',onInitialized:function(){$albumSlider.fullContainer.hide();$albumSlider.fullContainer.append('<span class="close" onclick="$albumSlider.fullContainer.hideGallery();"></span>');$(document).keyup(function(e){if(e.keyCode==27){$albumSlider.fullContainer.hide();if(typeof refreshIframe!=="undefined")refreshIframe();}else if(e.keyCode==37){$albumSlider.fullContainer.trigger('prev.owl.carousel');console.log('left');}else if(e.keyCode==39){$albumSlider.fullContainer.trigger('next.owl.carousel');console.log('right');}});},});$('.album-slider a').click(function(){$albumSlider.fullContainer.show();});$oneSlider.container.owlCarousel({dots:true,loop:true,lazyLoad:false,items:1,margin:10,smartSpeed:500,autoplay:true,autoHeight:true,});if($oneSlider.container.length>0){var firstDetailImg=new Image();firstDetailImg.src=$('.one-slider img').attr('src');firstDetailImg.onload=function(){$('.owl-height').css({'height':$('#category-detail-slider-0 img').height()});};}
$fullAutoSlowSlider.container.owlCarousel({nav:false,dots:true,loop:false,lazyLoad:false,items:1,margin:10,smartSpeed:500,autoHeight:false,stagePadding:50,});});

/* -- FILE: [javascripts/cookies-optin-cz.js]*/
var cookie_name='cookie_czechphoto';var iframemanager=iframemanager();var cc=initCookieConsent();urlStyle=cookies_content_url+'/files/cookies/cookieconsent.css';iframemanager.run({currLang:'cs',services:{youtube:{embedUrl:'https://www.youtube-nocookie.com/embed/{data-id}',thumbnailUrl:'https://i3.ytimg.com/vi/{data-id}/hqdefault.jpg',iframe:{allow:'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',},cookie:{name:'cc_youtube'},languages:{en:{notice:'To play the video you need to agree to the cookie terms.',cookieBtn:'Show cookies settings'},cs:{notice:'Pro přehrání videa je potřeba souhlasit s podmínkami cookies.',cookieBtn:'Zobrazit nastavení cookies'}}},googlemaps:{embedUrl:'https://www.google.com/maps/embed?pb={data-id}',iframe:{allow:'picture-in-picture; fullscreen;'},cookie:{name:'cc_maps'},languages:{cs:{notice:'Pro zobrazení videa je potřeba souhlasit s podmínkami <a href="" data-cc="c-settings">cookies</a>.',}}},}});cc.run({current_lang:'en',autoclear_cookies:true,page_scripts:true,auto_language:"document",force_consent:false,remove_cookie_tables:true,cookie_name:cookie_name,gui_options:{consent_modal:{layout:'box',position:'bottom left',transition:'slide',swap_buttons:true},settings_modal:{layout:'bar',position:'left',transition:'slide'}},onFirstAction:function(user_preferences,cookie){},onAccept:function(cookie){window.dataLayer.push({'event':'cookies_agreement','ad_storage':cookie.level.includes('ad_storage')?'granted':'denied','analytics_storage':cookie.level.includes('analytics_storage')?'granted':'denied','functionality_storage':cookie.level.includes('functionality_storage')?'granted':'denied','personalization_storage':cookie.level.includes('personalization_storage')?'granted':'denied','security_storage':cookie.level.includes('security_storage')?'granted':'denied'});if(cc.allowedCategory('analytics_storage')===true){iframemanager.acceptService('all')}
if(cc.allowedCategory('analytics_storage')===false){iframemanager.rejectService('all');}},onChange:function(cookie,changed_preferences){window.dataLayer.push({'event':'cookies_agreement','ad_storage':cookie.level.includes('ad_storage')?'granted':'denied','analytics_storage':cookie.level.includes('analytics_storage')?'granted':'denied','functionality_storage':cookie.level.includes('functionality_storage')?'granted':'denied','personalization_storage':cookie.level.includes('personalization_storage')?'granted':'denied','security_storage':cookie.level.includes('security_storage')?'granted':'denied'});if(cc.allowedCategory('analytics_storage')===true){iframemanager.acceptService('all')}
if(cc.allowedCategory('analytics_storage')===false){iframemanager.rejectService('all');}},languages:{'en':{consent_modal:{title:'We use cookies!',description:'Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent. <button type="button" data-cc="c-settings" class="cc-link">Let me choose</button>',primary_btn:{text:'Accept all',role:'accept_all'},secondary_btn:{text:'Edit settings',role:'settings'}},settings_modal:{title:'Cookie preferences',save_settings_btn:'Save settings',accept_all_btn:'Accept all',reject_all_btn:'Reject all',close_btn_label:'Close',cookie_table_headers:[{col1:'Name'},{col2:'Domain'},{col3:'Expiration'},{col4:'Description'}],blocks:[{title:'Cookie usage',description:'I use cookies to ensure the basic functionalities of the website and to enhance your online experience. You can choose for each category to opt-in/out whenever you want. For more details relative to cookies and other sensitive data, please read the full <a target="_blank" href="https://policies.google.com/privacy?hl=en" class="cc-link">privacy policy</a>.'},{title:'Strictly necessary cookies',description:'These cookies are essential for the proper functioning of my website. Without these cookies, the website would not work properly',toggle:{value:'necessary',enabled:true,readonly:true}},{title:'Analytics and statistics cookies',description:'Enables storage (such as cookies) related to analytics e.g. visit duration.',toggle:{value:'analytics_storage',enabled:false,readonly:false},},{title:'Advertisement cookies',description:'Enables storage (such as cookies) related to advertising.',toggle:{value:'ad_storage',enabled:false,readonly:false}}]}},'cs':{consent_modal:{title:'Czech Photo používá cookies',description:'K personalizaci obsahu a reklam, poskytování funkcí sociálních médií a analýze naší návštěvnosti využíváme soubory cookie. Informace o tom, jak náš web používáte, sdílíme se svými partnery pro sociální média, inzerci a analýzy.',primary_btn:{text:'Povolit vše',role:'accept_all'},secondary_btn:{text:'Upravit nastavení',role:'settings'}},settings_modal:{title:'Předvolby souborů cookie',save_settings_btn:'Uložit nastavení',accept_all_btn:'Povolit vše',reject_all_btn:'Zakázat vše',close_btn_label:'Zavřít',cookie_table_headers:[{col1:'Název'},{col2:'Doména'},{col3:'Expirace'},{col4:'Popis'}],blocks:[{title:'Používání souborů cookie',description:'Soubory cookie používáme k zajištění základních funkcí webu a ke zlepšení vašeho online zážitku. Pro každou kategorii si můžete vybrat, zda se chcete přihlásit/odhlásit. Další podrobnosti týkající se souborů cookie a dalších citlivých údajů naleznete v úplném znění <a href="https://policies.google.com/privacy?hl=cs" target="_blank" class="cc-link">zásady ochrany osobních údajů</a>.'},{title:'Nezbytné cookies',description:'Tyto soubory cookie jsou nezbytné pro správné fungování našich webových stránek. Bez těchto cookies by web nefungoval správně.',toggle:{value:'necessary',enabled:true,readonly:true}},{title:'Analytické a statistické cookies',description:'Umožňuje ukládání informací (jako jsou soubory cookie) souvisejících s analýzou, např. délka návštěvy',toggle:{value:'analytics_storage',enabled:false,readonly:false},},{title:'Reklamní cookies',description:'Umožňuje ukládání informací (jako jsou soubory cookie) souvisejících s inzercí',toggle:{value:'ad_storage',enabled:false,readonly:false}}]}},}});
