"use strict";jQuery.each(param_obj,function(index,value){if(!isNaN(value)){param_obj[index]=parseInt(value);}});function Gallery_Video_Content_Popup(id){var _this=this;_this.body=jQuery('body');_this.container=jQuery('#'+id+'.view-content-popup');_this.content=_this.container.parent();_this.element=_this.container.find('.video-element');_this.defaultBlockHeight=param_obj.gallery_video_ht_view2_element_height;_this.defaultBlockWidth=param_obj.gallery_video_ht_view2_element_width;_this.imageOverlay=_this.element.find('.videogallery-image-overlay a');_this.popupList=_this.content.next();_this.popupCloseButton=_this.popupList.find('a.close');_this.leftButton=_this.popupList.find('.heading-navigation .left-change');_this.rightButton=_this.popupList.find('.heading-navigation .right-change');_this.isCentered=_this.container.data("show-center")=='on';_this.imageBehaviour=_this.container.data("image-behaviour");_this.loadMoreBtn=_this.content.find('.load_more_button5');_this.loadingIcon=_this.content.find('.loading5');_this.galleryVideoId=_this.content.attr('data-gallery-video-id');_this.contentPerPage=_this.content.attr('data-gallery-video-perpage');_this.documentReady=function(){var options={itemSelector:_this.element,masonry:{columnWidth:_this.defaultBlockWidth+20+param_obj.gallery_video_ht_view2_element_border_width*2,},masonryHorizontal:{rowHeight:300+20},cellsByRow:{columnWidth:300+20,rowHeight:240},cellsByColumn:{columnWidth:300+20,rowHeight:240},getSortData:{symbol:function($elem){return $elem.attr('data-symbol');},category:function($elem){return $elem.attr('data-category');},number:function($elem){return parseInt($elem.find('.number').text(),10);},weight:function($elem){return parseFloat($elem.find('.weight').text().replace(/[\(\)]/g,''));},id:function($elem){return $elem.find('.id').text();}}};galleryVideoIsotope(_this.container.children().first());galleryVideoIsotope(_this.container.children(),options);};_this.showCenter=function(){if(_this.isCentered){var count=_this.element.length;var elementwidth=_this.defaultBlockWidth+20+param_obj.gallery_video_ht_view2_element_border_width*2;var enterycontent=_this.content.width();var whole=Math.floor(enterycontent/elementwidth);if(whole>count)whole=count;if(whole==0){return false;} else{var sectionwidth=whole*elementwidth;} _this.container.css({"width":sectionwidth,"max-width":"100%","margin":"0px auto","overflow":"hidden"});var loadInterval=setInterval(function(){galleryVideoIsotope(_this.container.children(),'layout');},100);setTimeout(function(){clearInterval(loadInterval);},5000);}};_this.addEventListeners=function(){_this.container.on('click','.videogallery-image-overlay a',_this.overlayClick);_this.popupList.on('click','a.close',_this.closePopup);_this.body.on('click','#huge-popup-overlay',_this.closePopup);_this.popupList.on('click','.heading-navigation .left-change',_this.leftChange);_this.popupList.on('click','.heading-navigation .right-change',_this.rightChange);_this.popupList.on('click','.hg_iframe_class_sub',_this.playVideo);_this.body.keydown(_this.changeRightAndLeft);_this.loadMoreBtn.on('click',_this.loadMoreBtnClick);jQuery(window).resize(_this.resizeEvent);};_this.playVideo=function(){var video_src=jQuery(this).parent().find("iframe").attr('src');if(video_src.indexOf("youtube")>=0){jQuery(this).parent().find("iframe").attr('src',video_src+'?autoplay=1');} else{jQuery(this).parent().find("iframe").attr('src',video_src+'&autoplay=1');} jQuery(this).addClass("hg_display_none_block");} _this.overlayClick=function(){var strid=jQuery(this).attr('href').replace('#','');jQuery('body').append('
');_this.popupList.insertBefore('#huge-popup-overlay');var height=jQuery(window).height();var width=jQuery(window).width();if(width<=767){jQuery(window).scrollTop(0);_this.popupList.find('.popup-wrapper .image-block iframe').height(jQuery('body').width()*0.5);}else{_this.popupList.find('.popup-wrapper .image-block iframe').height(jQuery('body').width()*0.23);} jQuery('#huge_it_videogallery_pupup_element_'+strid).addClass('active').css({height:height*0.7});_this.popupList.addClass('active');if(jQuery('.pupup-element.active .description').height()+jQuery('.right-block h3').height()+200>jQuery('.pupup-element.active .right-block').height()){if(jQuery('.pupup-element.active img').height()>jQuery('.pupup-element.active .image-block').height()){jQuery('.pupup-element.active .right-block').css('overflow-y','');jQuery('.pupup-element.active .popup-wrapper').css('overflow-y','auto');}else{jQuery('.pupup-element.active .right-block').css('overflow-y','auto');}}else{if(jQuery('.pupup-element.active img').height()>jQuery('.pupup-element.active .image-block').height()){jQuery('.pupup-element.active .popup-wrapper').css('overflow-y','auto');}} return false;};_this.leftChange=function(){var height=jQuery(window).height();var num=jQuery(this).find("a").attr("href").replace('#','');var videoSrc=_this.popupList.find('.pupup-element.active .image-block .hg_iframe_class > iframe').attr('src');if(videoSrc.indexOf('autoplay=1')){videoSrc=videoSrc.replace('autoplay=1','autoplay=0');_this.popupList.find('.pupup-element.active .image-block .hg_iframe_class > iframe').attr('src',videoSrc);} if(num>=1){var strid=jQuery(this).closest(".pupup-element").prev(".pupup-element").find('a').data('popupid').replace('#','');_this.popupList.find('#huge_it_videogallery_pupup_element_'+strid).css({height:height*0.7});jQuery(this).closest(".pupup-element").removeClass("active");jQuery(this).closest(".pupup-element").prev(".pupup-element").addClass("active");}else{var strid=_this.popupList.find(".pupup-element").last().find('a').data('popupid').replace('#','');_this.popupList.find('#huge_it_videogallery_pupup_element_'+strid).css({height:height*0.7});jQuery(this).closest(".pupup-element").removeClass("active");_this.popupList.find(".pupup-element").last().addClass("active");} if(jQuery('.pupup-element.active .description').height()+jQuery('.right-block h3').height()+200>jQuery('.pupup-element.active .right-block').height()){if(jQuery('.pupup-element.active img').height()>jQuery('.pupup-element.active .image-block').height()){jQuery('.pupup-element.active .right-block').css('overflow-y','');jQuery('.pupup-element.active .popup-wrapper').css('overflow-y','auto');}else{jQuery('.pupup-element.active .right-block').css('overflow-y','auto');}}else{if(jQuery('.pupup-element.active img').height()>jQuery('.pupup-element.active .image-block').height()){jQuery('.pupup-element.active .popup-wrapper').css('overflow-y','auto');}}};_this.rightChange=function(){var height=jQuery(window).height();var num=jQuery(this).find("a").attr("href").replace('#','');var cnt=0;var videoSrc=_this.popupList.find('.pupup-element.active .image-block .hg_iframe_class > iframe').attr('src');if(videoSrc.indexOf('autoplay=1')){videoSrc=videoSrc.replace('autoplay=1','autoplay=0');_this.popupList.find('.pupup-element.active .image-block .hg_iframe_class > iframe').attr('src',videoSrc);} _this.popupList.find(".pupup-element").each(function(){cnt++;});if(num<=cnt){var strid=jQuery(this).closest(".pupup-element").next(".pupup-element").find('a').data('popupid').replace('#','');_this.popupList.find('#huge_it_videogallery_pupup_element_'+strid).css({height:height*0.7});jQuery(this).closest(".pupup-element").removeClass("active");jQuery(this).closest(".pupup-element").next(".pupup-element").addClass("active");}else{var strid=_this.popupList.find(".pupup-element:first-child a").data('popupid').replace('#','');_this.popupList.find('#huge_it_videogallery_pupup_element_'+strid).css({height:height*0.7});jQuery(this).closest(".pupup-element").removeClass("active");_this.popupList.find(".pupup-element:first-child").addClass("active");} if(jQuery('.pupup-element.active .description').height()+jQuery('.right-block h3').height()+200>jQuery('.pupup-element.active .right-block').height()){if(jQuery('.pupup-element.active img').height()>jQuery('.pupup-element.active .image-block').height()){jQuery('.pupup-element.active .right-block').css('overflow-y','');jQuery('.pupup-element.active .popup-wrapper').css('overflow-y','auto');}else{jQuery('.pupup-element.active .right-block').css('overflow-y','auto');}}else{if(jQuery('.pupup-element.active img').height()>jQuery('.pupup-element.active .image-block').height()){jQuery('.pupup-element.active .popup-wrapper').css('overflow-y','auto');}}};_this.closePopup=function(){jQuery('#huge-popup-overlay').remove();var videoSrc=_this.popupList.find('li.active iframe').attr('src');videoSrc=videoSrc.split('?');videoSrc=videoSrc[0];_this.popupList.find('li.active iframe').attr('src','');_this.popupList.find('li.active iframe').attr('src',videoSrc);_this.popupList.find('li').removeClass('active');_this.popupList.removeClass('active');};_this.changeRightAndLeft=function(e){if(e.keyCode==37){_this.popupList.find('li.active .heading-navigation .left-change').click();} if(e.keyCode==39){_this.popupList.find('li.active .heading-navigation .right-change').click();} if(e.keyCode==27){_this.closePopup();}};_this.resizeEvent=function(){var iframeHeight=jQuery('body').width()*0.23;_this.popupList.find('.popup-wrapper .image-block iframe').height(iframeHeight);galleryVideoIsotope(_this.container.children(),'layout');_this.showCenter();};_this.imagesBehavior=function(){_this.container.find('.video-element .image-block img').each(function(i,img){var naturalRatio=jQuery(this).prop('naturalWidth')/jQuery(this).prop('naturalHeight');var defaultRatio=_this.defaultBlockWidth/_this.defaultBlockHeight;if(naturalRatio<=defaultRatio){jQuery(img).css({position:"relative",width:'100%',top:'50%',transform:'translateY(-50%)'});}else{jQuery(img).css({position:"relative",height:'100%',left:'50%',transform:'translateX(-50%)'});}});};_this.loadMoreBtnClick=function(){var contentLoadNonce=jQuery(this).attr('data-content-nonce-value');if(parseInt(_this.content.find(".pagenum:last").val())