/*! jQuery Migrate v3.4.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ "undefined"==typeof jQuery.migrateMute&&(jQuery.migrateMute=!0),function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e,window)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery"),window):t(jQuery,window)}(function(s,n){"use strict";function e(e){return 0<=function(e,t){for(var r=/^(\d+)\.(\d+)\.(\d+)/,n=r.exec(e)||[],o=r.exec(t)||[],a=1;a<=3;a++){if(+o[a]<+n[a])return 1;if(+n[a]<+o[a])return-1}return 0}(s.fn.jquery,e)}s.migrateVersion="3.4.1";var t=Object.create(null);s.migrateDisablePatches=function(){for(var e=0;e\x20\t\r\n\f]*)[^>]*)\/>/gi;s.UNSAFE_restoreLegacyHtmlPrefilter=function(){s.migrateEnablePatches("self-closed-tags")},i(s,"htmlPrefilter",function(e){var t,r;return(r=(t=e).replace(F,"<$1>"))!==t&&T(t)!==T(r)&&u("self-closed-tags","HTML tags must be properly nested and closed: "+t),e.replace(F,"<$1>")},"self-closed-tags"),s.migrateDisablePatches("self-closed-tags");var D,W,_,I=s.fn.offset;return i(s.fn,"offset",function(){var e=this[0];return!e||e.nodeType&&e.getBoundingClientRect?I.apply(this,arguments):(u("offset-valid-elem","jQuery.fn.offset() requires a valid DOM element"),arguments.length?this:void 0)},"offset-valid-elem"),s.ajax&&(D=s.param,i(s,"param",function(e,t){var r=s.ajaxSettings&&s.ajaxSettings.traditional;return void 0===t&&r&&(u("param-ajax-traditional","jQuery.param() no longer uses jQuery.ajaxSettings.traditional"),t=r),D.call(this,e,t)},"param-ajax-traditional")),c(s.fn,"andSelf",s.fn.addBack,"andSelf","jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()"),s.Deferred&&(W=s.Deferred,_=[["resolve","done",s.Callbacks("once memory"),s.Callbacks("once memory"),"resolved"],["reject","fail",s.Callbacks("once memory"),s.Callbacks("once memory"),"rejected"],["notify","progress",s.Callbacks("memory"),s.Callbacks("memory")]],i(s,"Deferred",function(e){var a=W(),i=a.promise();function t(){var o=arguments;return s.Deferred(function(n){s.each(_,function(e,t){var r="function"==typeof o[e]&&o[e];a[t[1]](function(){var e=r&&r.apply(this,arguments);e&&"function"==typeof e.promise?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[t[0]+"With"](this===i?n.promise():this,r?[e]:arguments)})}),o=null}).promise()}return c(a,"pipe",t,"deferred-pipe","deferred.pipe() is deprecated"),c(i,"pipe",t,"deferred-pipe","deferred.pipe() is deprecated"),e&&e.call(a,a),a},"deferred-pipe"),s.Deferred.exceptionHook=W.exceptionHook),s}); function SGPopup(config) {var integrations=config.integrations;var popupName=config.popupName;var initialConfig=config;var prefix=config.prefix||'sgpb';var isInited=false;var mainDiv=null;var contentDiv=null;var DIV=null;var opened=false;var resizeTimeout=null;var overlayDiv=null;var defaultZIndex=config.contentBox.zIndex||9999;var defaultWidth="640px";var defaultHeight=config.autoHeight;var closeButtonImage=null;var popupId=config.id;var showOnce=config.showOnce||false;var events=config.events||[];var openDelay=config.openDelay||0;var popupTheme=config.popupTheme;var popupType=config.popupType;var fitBackgroundImg=null;var parentThis=this;var openAnimation=config.openAnimation||{type:"none",speed:0};var closeAnimation=config.closeAnimation||{type:"none",speed:0};var closeBehavior=config.closeBehavior||{allowed:true,showButton:true,buttonPosition:'topLeft',buttonInside:true,autoclose:false,overlayShouldClose:true,contentShouldClose:false,escShouldClose:true};var closeButton=config.closeButton||{data:sgpbPublicUrl+'img/close.png',width:16,height:16,widthType:'px',heightType:'px',closeButtonType:'IMG',closeButtonText:'Close'};var overlay=config.overlay||{visible:true,color:"#000",opacity:0.7};var contentBox=config.contentBox||{padding:8,showBackground:true,backgroundColor:"#fff",borderStyle:"solid",borderColor:"#ccc",borderRadius:config.contentBox.borderRadius,borderRadiusType:config.contentBox.borderRadiusType,borderWidth:1,shadowColor:"#ccc",shadowSpread:0,shadowBlur:10,scrollingEnabled:true,backgroundPosition:''};var contents=config.contents||"";var inline=config.inline||false;var href=config.href||false;var position=config.position||{left:"center",top:"center"};if((typeof position.left==="undefined"||(isNaN(parseInt(position.left))&&position.left!=="center"))&&(typeof position.right==="undefined"||(isNaN(parseInt(position.right))&&position.right!=="center"))){position.left="center";} if((typeof position.top==="undefined"||(isNaN(parseInt(position.top))&&position.top!=="center"))&&(typeof position.bottom==="undefined"||(isNaN(parseInt(position.bottom))&&position.bottom!=="center"))){position.top="center";} var sizingRanges=config.sizingRanges||[{screenFrom:{width:-1,height:-1},screenTo:{width:-1,height:-1},width:defaultWidth,height:defaultHeight,maxWidth:-1,maxHeight:-1,minWidth:-1,minHeight:-1}];var shouldOpen=config.shouldOpen||function(){return true;};var willOpen=config.willOpen||function(){};var didOpen=config.didOpen||function(){};var shouldClose=config.shouldClose||function(){return true;};var willClose=config.willClose||function(){};var didClose=config.didClose||function(){};SGPopup.inlinePrevTarget=SGPopup.inlinePrevTarget||{};function resetInlineContent() {if(inline){var htmlElement=document.getElementById(inline);if(SGPopup.inlinePrevTarget.hasPreviousElement){if(typeof SGPopup.inlinePrevTarget.parentNode!=='undefined'){SGPopup.inlinePrevTarget.parentNode.insertBefore(htmlElement,SGPopup.inlinePrevTarget.node.nextSibling);}} else{SGPopup.inlinePrevTarget.node.appendChild(htmlElement);}}} var OPEN_ANIMATION_POP="@-webkit-keyframes popin{from{-webkit-transform:scale(.8);opacity:0}to{-webkit-transform:scale(1);opacity:1}}@-moz-keyframes popin{from{-moz-transform:scale(.8);opacity:0}to{-moz-transform:scale(1);opacity:1}}@keyframes popin{from{transform:scale(.8);opacity:0}to{transform:scale(1);opacity:1}}";var OPEN_ANIMATION_FADE="@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}";var OPEN_ANIMATION_FLIP="@-webkit-keyframes flipintoright{from{-webkit-transform:rotateY(90deg) scale(.9)}to{-webkit-transform:rotateY(0)}}@-moz-keyframes flipintoright{from{-moz-transform:rotateY(90deg) scale(.9)}to{-moz-transform:rotateY(0)}}@keyframes flipintoright{from{transform:rotateY(90deg) scale(.9)}to{transform:rotateY(0)}}";var OPEN_ANIMATION_SLIDELEFT="@-webkit-keyframes slideinfromright{from{-webkit-transform:translate3d({start},0,0)}to{-webkit-transform:translate3d(0,0,0)}}@-moz-keyframes slideinfromright{from{-moz-transform:translateX({start})}to{-moz-transform:translateX(0)}}@keyframes slideinfromright{from{transform:translateX({start})}to{transform:translateX(0)}}";var OPEN_ANIMATION_SLIDERIGHT="@-webkit-keyframes slideinfromleft{from{-webkit-transform:translate3d({start},0,0)}to{-webkit-transform:translate3d(0,0,0)}}@-moz-keyframes slideinfromleft{from{-moz-transform:translateX({start})}to{-moz-transform:translateX(0)}}@keyframes slideinfromleft{from{transform:translateX({start})}to{transform:translateX(0)}}";var OPEN_ANIMATION_FLOW="@-webkit-keyframes flowinfromright{0%{-webkit-transform:translateX(100%) scale(.7)}30%,40%{-webkit-transform:translateX(0) scale(.7)}100%{-webkit-transform:translateX(0) scale(1)}}@-moz-keyframes flowinfromright{0%{-moz-transform:translateX(100%) scale(.7)}30%,40%{-moz-transform:translateX(0) scale(.7)}100%{-moz-transform:translateX(0) scale(1)}}@keyframes flowinfromright{0%{transform:translateX(100%) scale(.7)}30%,40%{transform:translateX(0) scale(.7)}100%{transform:translateX(0) scale(1)}}";var OPEN_ANIMATION_SLIDEUP="@-webkit-keyframes slideinfrombottom{from{-webkit-transform:translateY({start})}to{-webkit-transform:translateY(0)}}@-moz-keyframes slideinfrombottom{from{-moz-transform:translateY({start})}to{-moz-transform:translateY(0)}}@keyframes slideinfrombottom{from{transform:translateY({start})}to{transform:translateY(0)}}";var OPEN_ANIMATION_SLIDEDOWN="@-webkit-keyframes slideinfromtop{from{-webkit-transform:translateY({start})}to{-webkit-transform:translateY(0)}}@-moz-keyframes slideinfromtop{from{-moz-transform:translateY({start})}to{-moz-transform:translateY(0)}}@keyframes slideinfromtop{from{transform:translateY({start})}to{transform:translateY(0)}}";var CLOSE_ANIMATION_SLIDELEFT="@-webkit-keyframes slideouttoleft{from{-webkit-transform:translate3d(0,0,0)}to{-webkit-transform:translate3d({end},0,0)}}@-moz-keyframes slideouttoleft{from{-moz-transform:translateX(0)}to{-moz-transform:translateX({end})}}@keyframes slideouttoleft{from{transform:translateX(0)}to{transform:translateX({end})}}";var CLOSE_ANIMATION_SLIDERIGHT="@-webkit-keyframes slideouttoright{from{-webkit-transform:translate3d(0,0,0)}to{-webkit-transform:translate3d({end},0,0)}}@-moz-keyframes slideouttoright{from{-moz-transform:translateX(0)}to{-moz-transform:translateX({end})}}@keyframes slideouttoright{from{transform:translateX(0)}to{transform:translateX({end})}}";var CLOSE_ANIMATION_POP="@-webkit-keyframes popout{from{-webkit-transform:scale(1);opacity:1}to{-webkit-transform:scale(.8);opacity:0}}@-moz-keyframes popout{from{-moz-transform:scale(1);opacity:1}to{-moz-transform:scale(.8);opacity:0}}@keyframes popout{from{transform:scale(1);opacity:1}to{transform:scale(.8);opacity:0}}";var CLOSE_ANIMATION_FADE="@-webkit-keyframes fadeout{from{opacity:1}to{opacity:0}}@-moz-keyframes fadeout{from{opacity:1}to{opacity:0}}@keyframes fadeout{from{opacity:1}to{opacity:0}}";var CLOSE_ANIMATION_FLIP="@-webkit-keyframes flipouttoright{from{-webkit-transform:rotateY(0)}to{-webkit-transform:rotateY(90deg) scale(.9)}}@-moz-keyframes flipouttoright{from{-moz-transform:rotateY(0)}to{-moz-transform:rotateY(90deg) scale(.9)}}@keyframes flipouttoright{from{transform:rotateY(0)}to{transform:rotateY(90deg) scale(.9)}}";var CLOSE_ANIMATION_FLOW="@-webkit-keyframes flowouttoright{0%{-webkit-transform:translateX(0) scale(1)}60%,70%{-webkit-transform:translateX(0) scale(.7)}100%{-webkit-transform:translateX(100%) scale(.7)}}@-moz-keyframes flowouttoright{0%{-moz-transform:translateX(0) scale(1)}60%,70%{-moz-transform:translateX(0) scale(.7)}100%{-moz-transform:translateX(100%) scale(.7)}}@keyframes flowouttoright{0%{transform:translateX(0) scale(1)}60%,70%{transform:translateX(0) scale(.7)}100%{transform:translateX(100%) scale(.7)}}";var CLOSE_ANIMATION_SLIDEUP="@-webkit-keyframes slideouttotop{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY({end})}}@-moz-keyframes slideouttotop{from{-moz-transform:translateY(0)}to{-moz-transform:translateY({end})}}@keyframes slideouttotop{from{transform:translateY(0)}to{transform:translateY({end})}}";var CLOSE_ANIMATION_SLIDEDOWN="@-webkit-keyframes slideouttobottom{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY({end})}}@-moz-keyframes slideouttobottom{from{-moz-transform:translateY(0)}to{-moz-transform:translateY({end})}}@keyframes slideouttobottom{from{transform:translateY(0)}to{transform:translateY({end})}}";function addAnimationClass(classString) {var style=document.createElement('style');style.type='text/css';style.innerHTML=classString;style.id=prefix+"-effect-custom-style";document.getElementsByTagName('head')[0].appendChild(style);} function setMainDivStyles(sizeConfig) {jQuery(window).trigger('sgpbPopupBuilderAdditionalDimensionSettings');contentDiv.style.zIndex=defaultZIndex+10;mainDiv.style.boxSizing='content-box';if(sizeConfig.minHeight!=-1){var minHeight=sizeConfig.minHeight;var popupMinHeight=window.innerHeight;if(typeof minHeight==='string'&&minHeight.indexOf('%')!==-1){var popupMinhHeight=(popupMinhHeight/100)*parseInt(minHeight);mainDiv.style.minHeight=popupMinhHeight+'px';} else{mainDiv.style.minHeight=parseInt(minHeight)+'px';}} if(sizeConfig.minWidth!=-1){var popupMinhWidth=window.innerWidth;var minWidth=sizeConfig.minWidth;if(typeof minWidth==='string'&&minWidth.indexOf('%')!==-1){popupMinhWidth=(popupMinhWidth/100)*parseInt(minWidth);mainDiv.style.minWidth=popupMinhWidth+'px';} else{mainDiv.style.minWidth=parseInt(minWidth)+'px';}} if(sizeConfig.maxHeight!=-1&&sizeConfig.maxHeight){var maxHeight=sizeConfig.maxHeight;var popupMaxHeight=window.innerHeight;if(maxHeight.indexOf('%')!==-1){popupMaxHeight=(popupMaxHeight/100)*parseInt(maxHeight);this.calculatedMaxHeight=calculateMaxHeight(popupMaxHeight);mainDiv.style.maxHeight=this.calculatedMaxHeight;} else{this.calculatedMaxHeight=calculateMaxHeight(parseInt(maxHeight));mainDiv.style.maxHeight=this.calculatedMaxHeight;}} else{var popupMaxHeight=window.innerHeight;mainDiv.style.maxHeight=calculateMaxHeight(popupMaxHeight);} if(sizeConfig.maxWidth!=-1&&sizeConfig.maxWidth){var maxWidth=sizeConfig.maxWidth;var popupMaxWidth=window.innerWidth;if(maxWidth.indexOf('%')!==-1){popupMaxWidth=(popupMaxWidth/100)*parseInt(maxWidth);this.calculatedMaxWidth=calculateMaxWidth(popupMaxWidth);mainDiv.style.maxWidth=this.calculatedMaxWidth;} else{this.calculatedMaxWidth=calculateMaxWidth(parseInt(maxWidth));mainDiv.style.maxWidth=this.calculatedMaxWidth;}} else{var popupMaxWidth=window.innerWidth;mainDiv.style.maxWidth=calculateMaxWidth(popupMaxWidth);} if(contentBox.borderStyle){mainDiv.style.borderStyle=contentBox.borderStyle;} if(contentBox.borderColor){mainDiv.style.borderColor=contentBox.borderColor;} if(contentBox.borderRadius){var borderRadiusMeasure='%';if(contentBox.borderRadiusType){borderRadiusMeasure=contentBox.borderRadiusType;} mainDiv.style.borderRadius=contentBox.borderRadius+borderRadiusMeasure;} mainDiv.style.borderWidth=contentBox.borderWidth+"px";if(contentBox.padding){mainDiv.style.padding=contentBox.padding+"px";} var widthToSet=sizeConfig.width||defaultWidth;if(widthToSet.indexOf("%")>-1){var widthNum=parseFloat(widthToSet);if(widthToSet.indexOf("fullScreen")>-1){widthNum=window.innerWidth;} var closeButtonWidthToSubtract=parseInt(closeButton.width);if(closeBehavior.showButton===false||config.closeButton.type==='button'){closeButtonWidthToSubtract=0;} widthToSet=(((widthNum/100)*window.innerWidth)-(2*(contentBox.padding?contentBox.padding:0))-parseFloat(mainDiv.style.borderLeftWidth)-parseFloat(mainDiv.style.borderRightWidth)-(parseFloat(contentBox.shadowSpread)/2)-closeButtonWidthToSubtract)+'px';} else{widthToSet=parseFloat(widthToSet)-2*(contentBox.padding?contentBox.padding:0)+'px';} mainDiv.style.width=widthToSet;if(config.popupType==='image'){mainDiv.style.backgroundImage="url("+contentBox.backgroundImage+")";} if(contentBox.showBackground){if(contentBox.backgroundImage){mainDiv.style.backgroundImage="url("+contentBox.backgroundImage+")";} if(contentBox.backgroundMode==="cover"){mainDiv.style.backgroundSize="cover";mainDiv.style.backgroundRepeat="no-repeat";} else if(contentBox.backgroundMode==="contain"){mainDiv.style.backgroundSize="contain";mainDiv.style.backgroundRepeat="no-repeat";} else if(contentBox.backgroundMode==="repeat"){mainDiv.style.backgroundRepeat="repeat";} else if(contentBox.backgroundMode==='fit'){if(!fitBackgroundImg){fitBackgroundImg=document.createElement('img');fitBackgroundImg.style.position='fixed';fitBackgroundImg.style.bottom='-9999999999999px';fitBackgroundImg.className='sgpb-background-image-'+config.popupId;document.body.appendChild(fitBackgroundImg);fitBackgroundImg.onload=function(){changePopupDimensionRelatedImage(this);};fitBackgroundImg.src=contentBox.backgroundImage;mainDiv.style.backgroundSize='100% 100%';mainDiv.style.backgroundRepeat='no-repeat';}} else{mainDiv.style.backgroundRepeat="no-repeat";}} if(window.sgWindowOldWidth!==window.innerWidth||window.sgWindowOldHeight!==window.innerHeight){window.sgWindowOldWidth=window.innerWidth;window.sgWindowOldHeight=window.innerHeight;var images=document.getElementsByClassName('sgpb-background-image-'+config.popupId);if(images.length){changePopupDimensionRelatedImage(images[0]);}} mainDiv.style.backgroundPosition=contentBox.backgroundPosition;var heightToSet=sizeConfig.height||defaultHeight;if(typeof heightToSet!=='undefined'&&heightToSet.indexOf("%")>-1){var heightNum=parseFloat(heightToSet);heightToSet=(((heightNum/100)*window.innerHeight)-(2*(contentBox.padding?contentBox.padding:0))-parseInt(mainDiv.style.borderTopWidth)-parseInt(mainDiv.style.borderBottomWidth))+"px";} else{heightToSet=parseInt(heightToSet)-2*(contentBox.padding?contentBox.padding:0)+"px";if(sizeConfig.width.indexOf("fullScreen")>-1){heightToSet=(window.innerHeight)+"px";}} mainDiv.style.height=heightToSet;if(contentBox.showBackground&&contentBox.backgroundColor){mainDiv.style.backgroundColor=contentBox.backgroundColor;} if(contentBox.shadowColor){mainDiv.style.boxShadow="0 0 "+contentBox.shadowBlur+"px "+contentBox.shadowSpread+"px "+contentBox.shadowColor;} if(contentBox.scrollingEnabled){mainDiv.style.overflow="auto";} else{mainDiv.style.overflow="hidden";}} function changePopupDimensionRelatedImage(image) {var result=resizeConfig(image);var oldSizeConfig=getSizeConfig();oldSizeConfig.width=result.width+'px';oldSizeConfig.height=result.height+'px';oldSizeConfig.modified=true;this.sizeConfig=oldSizeConfig;windowResizeHandler();} function resizeConfig(backgroundImage) {var maxWidth=parseInt(this.calculatedMaxWidth);var maxHeight=parseInt(this.calculatedMaxHeight);var imageWidth=backgroundImage.width;var imageHeight=backgroundImage.height;var windowMaxHeight=parseInt(calculateMaxHeight(window.innerHeight));var windowMaxWidth=parseInt(calculateMaxWidth(window.innerWidth));if(isNaN(maxHeight)||maxHeight>windowMaxHeight){maxHeight=windowMaxHeight;} if(isNaN(maxWidth)||maxWidth>windowMaxWidth){maxWidth=windowMaxWidth;} var widthDifference=imageWidth-maxWidth;var heightDifference=imageHeight-maxHeight;if(heightDifference>widthDifference){if(imageHeight>maxHeight){var modifiedHeightPercent=100-(maxHeight/imageHeight)*100;var withMustDecrease=(imageWidth*modifiedHeightPercent)/100;var modifiedWidth=imageWidth-withMustDecrease;imageWidth=modifiedWidth;imageHeight=maxHeight;}} else if(imageWidth>maxWidth){var modifiedWidthPercent=Math.floor((widthDifference/imageWidth)*100);var heightMustDecrease=Math.floor((imageHeight*modifiedWidthPercent)/100);var modifiedHeight=imageHeight-heightMustDecrease;imageWidth-=widthDifference;imageHeight-=heightMustDecrease;} var result={width:imageWidth,height:imageHeight};return result;} function calculateMaxWidth(maxWidth) {var sizeConfig=getSizeConfig();var dimension=sizeConfig.width;var contentPadding=(contentBox.padding||0)*2;var shadowSpread=(contentBox.shadowSpread||0)*2;var borderWidth=(contentBox.borderWidth||0)*2;var boxBorderWidth=(contentBox.boxBorderWidth||0)*4;var closeButtonRight=(parseInt(closeBehavior.right)||0)*2;var closeButtonLeft=(parseInt(closeBehavior.left)||0)*2;if(dimension.indexOf('fullScreen')=='-1'){maxWidth-=contentPadding;maxWidth-=34;maxWidth-=shadowSpread;maxWidth-=borderWidth;maxWidth-=boxBorderWidth;} if(!closeBehavior.buttonInside){if(closeButtonRight){maxWidth-=Math.abs(closeButtonRight);} if(closeButtonLeft){maxWidth-=Math.abs(closeButtonLeft);}} if(maxWidth<0){return'30px';} return maxWidth+'px';} function setFitBackground() {if(!fitBackgroundImg){return;} var imgHeight=fitBackgroundImg.height;var imgWidth=fitBackgroundImg.width;var winHeight=window.innerHeight;var winWidth=window.innerWidth;var minMargin=40;var popupWidth=0,popupHeight=0;if(imgWidth<(winWidth-2*minMargin)&&imgHeight<(winHeight-2*minMargin)){popupWidth=imgWidth;popupHeight=imgHeight;}else{var widthDif=winWidth-imgWidth;var heightDif=winHeight-imgHeight;if(widthDiftmpConf.screenFrom.width)||(windowWidthtmpConf.screenFrom.width)){candidates.push(tmpConf);}} for(var i=0;itmpConf.screenFrom.height)||(windowHeighttmpConf.screenFrom.height)){continue;} else{candidates.splice(i,1);i--;}} config=candidates[0];if(!config){config={screenFrom:{width:-1,height:-1},screenTo:{width:-1,height:-1},width:"640px",height:defaultHeight,maxWidth:-1,maxHeight:-1,minWidth:-1,minHeight:-1}} return config;} function drawOverlay() {if(!overlay.visible){return;} overlayDiv=document.createElement("DIV");overlayDiv.style.zIndex=defaultZIndex;overlayDiv.style.backgroundColor=overlay.color;overlayDiv.style.opacity=overlay.opacity/100;overlayDiv.style.position="fixed";overlayDiv.style.left="0";overlayDiv.style.top="0";overlayDiv.style.width="100%";overlayDiv.style.height="100%";if(overlay.addClass){overlayDiv.className=overlay.addClass;} if(closeBehavior.overlayShouldClose){overlayDiv.onclick=closePopup;} document.body.appendChild(overlayDiv);} function removeOverlay() {if(overlayDiv){overlayDiv.style.display="none";document.body.removeChild(overlayDiv);overlayDiv=null;}} function setCloseButton(mainDiv) {if(!closeButton.data){return;} if(closeBehavior.showButton===false){return;} closeButtonImage.style.zIndex=defaultZIndex+20;closeButtonImage.style.position="absolute";closeButtonImage.style.float="left";closeButtonImage.style.top=closeBehavior.top;closeButtonImage.style.right=closeBehavior.right;closeButtonImage.style.bottom=closeBehavior.bottom;closeButtonImage.style.left=closeBehavior.left;closeButtonImage.alt=SGPB_JS_LOCALIZATION.closeButtonAltText;closeButtonImage.title=SGPB_JS_LOCALIZATION.closeButtonAltText;if(closeButton.type=='button'){closeButtonImage.id=prefix+'-close-button';closeButtonImage.innerHTML=config.closeButton.text;} closeButtonImage.style.width=closeButton.width+closeButton.widthType;closeButtonImage.style.cursor="pointer";closeButtonImage.style.height=closeButton.height+closeButton.heightType;closeButtonImage.src=closeButton.data;closeButtonImage.style.backgroundRepeat="no-repeat";closeButtonImage.style.backgroundSize="cover";closeButtonImage.onclick=closePopup;positionCloseButton(mainDiv);} function positionCloseButton(mainDiv) {if(closeBehavior.buttonPosition=="left"){closeButtonImage.style.left=(closeButton.width/2+parseFloat(closeBehavior.leftPosition))+"px";} else if(closeBehavior.buttonPosition=="right"){var border=contentBox.borderWidth||0;var left=0;var mainDivWidth=mainDiv.style.width;if(mainDiv.style.maxWidth&&parseInt(mainDivWidth)>parseInt(mainDiv.style.maxWidth)){mainDivWidth=mainDiv.style.maxWidth;} left=parseFloat(mainDivWidth)-Math.ceil(closeButton.width/2)+2*contentBox.padding+2*border;if(closeBehavior.leftPosition){left-=parseFloat(closeBehavior.leftPosition);} closeButtonImage.style.left=left+"px";} closeButtonImage.style.top=parseFloat(closeBehavior.topPosition)+"px";} function onWindowRsize() {clearTimeout(resizeTimeout);resizeTimeout=setTimeout(function(){resizeBox();positionPopup();positionCloseButton(mainDiv);jQuery(window).trigger('sgpbPopupReload')},0);} function windowResizeHandler() {resizeBox();positionPopup();positionCloseButton(mainDiv);jQuery(window).trigger('sgpbPopupReload')} function setOpenAnimation() {if(!openAnimation.status){return false;} contentDiv.style.animationTimingFunction="linear";var border=contentBox.borderWidth||0;var padding=contentBox.padding||0;if(openAnimation.type=="slideleft"){var start=window.innerWidth-parseInt(contentDiv.style.left)+2*border;addAnimationClass(OPEN_ANIMATION_SLIDELEFT.replace(/\{start\}/g,start+"px"));contentDiv.style.animationName="slideinfromright";} else if(openAnimation.type=="slideright"){var start=parseInt(mainDiv.style.width)+parseInt(contentDiv.style.left)+2*border+2*padding;addAnimationClass(OPEN_ANIMATION_SLIDERIGHT.replace(/\{start\}/g,"-"+start+"px"));contentDiv.style.animationName="slideinfromleft";} else if(openAnimation.type=="pop"){addAnimationClass(OPEN_ANIMATION_POP);contentDiv.style.transform="scale(1)";contentDiv.style.animationName="popin";contentDiv.style.opacity="1";} else if(openAnimation.type=="fade"){addAnimationClass(OPEN_ANIMATION_FADE);contentDiv.style.animationName="fadein";contentDiv.style.opacity="1";} else if(openAnimation.type=="flip"){addAnimationClass(OPEN_ANIMATION_FLIP);contentDiv.style.animationName="flipintoright";contentDiv.style.transform="translateX(0)";} else if(openAnimation.type=="turn"){addAnimationClass(OPEN_ANIMATION_FLIP);contentDiv.style.animationName="flipintoright";contentDiv.style.transform="translateX(0)";contentDiv.style.transformOrigin="0";} else if(openAnimation.type=="flow"){addAnimationClass(OPEN_ANIMATION_FLOW);contentDiv.style.animationName="flowinfromright";contentDiv.style.transformOrigin="50% 30%";} else if(openAnimation.type=="slideup"){var bottom=0;if(contentDiv.style.bottom){bottom=parseInt(mainDiv.style.height)+2*border+parseInt(contentDiv.style.bottom)+2*padding;} else{bottom=window.innerHeight-parseInt(contentDiv.style.top)+2*border;} var start=bottom;addAnimationClass(OPEN_ANIMATION_SLIDEUP.replace(/\{start\}/g,start+"px"));contentDiv.style.animationName="slideinfrombottom";} else if(openAnimation.type=="slidedown"){var top=0;if(contentDiv.style.top){top=parseInt(contentDiv.style.top)+2*border+2*padding;} else{top=window.innerHeight-parseInt(contentDiv.style.bottom)-parseInt(mainDiv.style.height);} var start=top+parseInt(mainDiv.style.height);addAnimationClass(OPEN_ANIMATION_SLIDEDOWN.replace(/\{start\}/g,"-"+start+"px"));contentDiv.style.animationName="slideinfromtop";} else{contentDiv.className+=' sg-animated '+openAnimation.type;} contentDiv.style.animationDuration=openAnimation.speed+"ms";} function setCloseAnimation() {contentDiv.style.animationTimingFunction="linear";var border=contentBox.borderWidth||0;var padding=contentBox.padding||0;if(closeAnimation.type=="slideleft"){var end=parseInt(mainDiv.style.width)+parseInt(contentDiv.style.left)+2*border+2*padding;addAnimationClass(CLOSE_ANIMATION_SLIDELEFT.replace(/\{end\}/g,"-"+end+"px"));contentDiv.style.animationName="slideouttoleft";} else if(closeAnimation.type=="slideright"){var end=window.innerWidth-parseInt(contentDiv.style.left)+2*border;addAnimationClass(CLOSE_ANIMATION_SLIDERIGHT.replace(/\{end\}/g,end+"px"));contentDiv.style.animationName="slideouttoright";} else if(closeAnimation.type=="pop"){addAnimationClass(CLOSE_ANIMATION_POP);contentDiv.style.animationName="popout";contentDiv.style.transform="scale(0)";contentDiv.style.opacity="0";} else if(closeAnimation.type=="fade"){addAnimationClass(CLOSE_ANIMATION_FADE);contentDiv.style.animationName="fadeout";contentDiv.style.opacity="0";} else if(closeAnimation.type=="flip"){addAnimationClass(CLOSE_ANIMATION_FLIP);contentDiv.style.animationName="flipouttoright";contentDiv.style.transform="rotateY(-90deg) scale(.9)";} else if(closeAnimation.type=="turn"){addAnimationClass(CLOSE_ANIMATION_FLIP);contentDiv.style.animationName="flipouttoright";contentDiv.style.transform="rotateY(-90deg) scale(.9)";contentDiv.style.transformOrigin="0";} else if(closeAnimation.type=="flow"){addAnimationClass(CLOSE_ANIMATION_FLOW);contentDiv.style.animationName="flowouttoright";contentDiv.style.transformOrigin="50% 30%";} else if(closeAnimation.type=="slideup"){var top=0;if(contentDiv.style.top){top=parseInt(contentDiv.style.top)+2*border+2*padding;} else{top=window.innerHeight-parseInt(contentDiv.style.bottom)-parseInt(mainDiv.style.height);} var end=top+parseInt(mainDiv.style.height);addAnimationClass(CLOSE_ANIMATION_SLIDEUP.replace(/\{end\}/g,"-"+end+"px"));contentDiv.style.animationName="slideouttotop";} else if(closeAnimation.type=="slidedown"){var bottom=0;if(contentDiv.style.bottom){bottom=parseInt(mainDiv.style.height)+2*border+parseInt(contentDiv.style.bottom)+2*padding;} else{bottom=window.innerHeight-parseInt(contentDiv.style.top)+2*border;} var end=bottom;addAnimationClass(CLOSE_ANIMATION_SLIDEDOWN.replace(/\{end\}/g,end+"px"));contentDiv.style.animationName="slideouttobottom";} else{contentDiv.className=prefix+'-popup-dialog-main-div-theme-wrapper-'+config.popupTheme+' sg-animated '+closeAnimation.type;} contentDiv.style.animationDuration=closeAnimation.speed+"ms";window.setTimeout(function(){contentDiv.className=prefix+'-popup-dialog-main-div-theme-wrapper-'+config.popupTheme;contentDiv.style.animationName="";contentDiv.style.transform="";contentDiv.style.transformOrigin="";contentDiv.style.opacity="";},parseInt(closeAnimation.speed)+10);} function setOpenEvents() {for(var i=0;i0){scrollPos=document.body.scrollHeight*(scrollPos/100)-window.innerHeight/2;} var scrollEventFunction=function(){if(document.body.scrollTop>=scrollPos||document.documentElement.scrollTop>=scrollPos){openPopup(false,'onScroll');window.removeEventListener("scroll",scrollEventFunction);}};window.addEventListener("scroll",scrollEventFunction);} function setOpenOnLoadEvent() {if(document.readyState==="complete"){openPopup(false,'onLoad');} else{window.addEventListener("load",function(){openPopup(false,'onLoad');},false);}} function setOpenOnClickEvent(config) {var target=config.target;if(!target){return;} var elements=document.getElementsByClassName(target);for(var i=0;i'+popupContent.innerHTML+'';} if(typeof config.closeButton.type!=='undefined'&&config.closeButton.type=='button'){closeButtonImage=document.createElement(config.closeButton.type);} else{closeButtonImage=document.createElement("IMG");} if(config.closeBehavior.showButton!==false){closeButtonImage.className=prefix+"-popup-close-button-"+config.popupTheme;contentDiv.appendChild(closeButtonImage);} contentDiv.appendChild(mainDiv);DIV.appendChild(contentDiv);document.body.appendChild(DIV);isInited=true;setOpenEvents();} function getInlineContent() {var divElement=document.createElement("div");divElement.innerHTML='';if(inline){var hrefHtml=document.getElementById(inline);if(hrefHtml.previousElementSibling){SGPopup.inlinePrevTarget={hasPreviousElement:true,node:hrefHtml.previousElementSibling}} else{SGPopup.inlinePrevTarget={hasPreviousElement:false,node:hrefHtml.parentNode}} divElement.appendChild(hrefHtml);return divElement;} return divElement;} function openPopup(forced,action) {if(opened){return;} coockieValue=SGPopup.getCookie(popupId);if(coockieValue){return;} if(showOnce){SGPopup.setCookie(popupId,"true",parseInt(showOnce));} if(forced!==true){if(shouldOpen&&typeof shouldOpen=="function"){if(shouldOpen()===false){return;}}} if(!isInited){initPopup();} opened=true;var self=this;window.addEventListener("resize",onWindowRsize);if(closeBehavior.contentShouldClose){mainDiv.onclick=closePopup;} setTimeout(function(){if(willOpen&&typeof willOpen=="function"){willOpen();} drawOverlay();DIV.style.display="";positionPopup();setOpenAnimation();setCloseButton(mainDiv);if(didOpen){var callbackArgs=parentThis.getCallbackArgs();if(typeof didOpen=="function"){didOpen(callbackArgs);}}},openDelay);if(closeBehavior.autoclose&&closeBehavior.autoclose>0){setTimeout(closePopup,closeBehavior.autoclose*1000);} if(closeBehavior.escShouldClose){document.onkeydown=function(e){e=e||window.event;if(e.keyCode==27){closePopup();}};}} function closePopup(forced) {if(forced!==true){if(shouldClose&&typeof shouldClose=="function"){if(shouldClose()===false){return;}}} if(closeBehavior.allowed===false&&forced!==true){return;} if(willClose&&typeof willClose=="function"){willClose();} window.removeEventListener("resize",onWindowRsize);var closeFunction=function() {if(!DIV){return;} DIV.style.display="none";removeOverlay();if(didClose&&typeof didClose=="function"){didClose();opened=false;} if(resetInlineContent&&typeof resetInlineContent=="function"){resetInlineContent();}};if(closeAnimation.type!="none"&&closeAnimation.speed>0){setCloseAnimation();setTimeout(closeFunction,closeAnimation.speed);} else{closeFunction();}} var resizeBox=function() {var sizeConfig=getSizeConfig();setMainDivStyles(sizeConfig)};this.getCallbackArgs=function() {var args={event:this.customEvent} return args;};this.open=function(forced) {openPopup(forced);};this.init=function() {initPopup();};this.close=function(forced) {closePopup(forced);};this.resize=function() {resizeBox();};this.setOpenDelay=function(delay) {openDelay=delay;if(isInited){initPopup();}};this.getOpenDelay=function() {return openDelay;};this.setOpenAnimation=function(animation) {openAnimation=animation;if(isInited){initPopup();}};this.getOpenAnimation=function() {return openAnimation;};this.setCloseAnimation=function(animation) {closeAnimation=animation;if(isInited){initPopup();}};this.getCloseAnimation=function() {return closeAnimation;};this.setCloseBehavior=function(config) {closeBehavior=config;if(isInited){initPopup();}};this.getCloseBehavior=function() {return closeBehavior;};this.setCloseButton=function(button) {closeButton=button;};this.getCloseButton=function() {return closeButton;};this.setOverlay=function(config) {overlay=config;if(isInited){initPopup();}};this.getOverlay=function() {return overlay;};this.setContentBox=function(config) {contentBox=config;if(isInited){initPopup();}};this.getContentBox=function() {return contentBox;};this.setContents=function(content) {contents=content;if(isInited){initPopup();}};this.getContents=function() {return contents;};this.setPosition=function(config) {position=config;};this.getPosition=function() {return position;};this.setSizingRanges=function(ranges) {sizingRanges=ranges;if(isInited){initPopup();}};this.getSizingRanges=function() {return sizingRanges;};this.setShouldOpen=function(func) {shouldOpen=func;if(isInited){initPopup();}};this.getShouldOpen=function() {return shouldOpen;};this.setWillOpen=function(func) {willOpen=func;if(isInited){initPopup();}};this.getWillOpen=function() {return willOpen;};this.setDidOpen=function(func) {didOpen=func;if(isInited){initPopup();}};this.getDidOpen=function() {return didOpen;};this.setShouldClose=function(func) {shouldClose=func;if(isInited){initPopup();}};this.getShouldClose=function() {return shouldClose;};this.setWillClose=function(func) {willClose=func;if(isInited){initPopup();}};this.getWillClose=function() {return willClose;};this.setDidClose=function(func) {didClose=func;if(isInited){initPopup();}};this.getDidClose=function() {return didClose;};} SGPopup.sendGetRequest=function(url,responseHandler,params) {var req;if(window.XMLHttpRequest){req=new XMLHttpRequest();} else if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");} req.onreadystatechange=function(){if(req.readyState==4){if(req.status<400){responseHandler(req,params);}else{}}};req.open("GET",url,true);req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');req.send(null);};SGPopup.getCookie=function(cname) {var name=cname+"=";var ca=document.cookie.split(';');for(var i=0;i-1||ua.indexOf('Trident/')>-1;return isIE;};PopupConfig.prototype.addCustomEvent=function(eventName,args) {if(this.isIE()){var event=document.createEvent('CustomEvent');event.initCustomEvent(eventName,true,true,args);} else{var event=new CustomEvent(eventName,{detail:args,bubbles:true,cancelable:true});} window.dispatchEvent(event);};PopupConfig.prototype.combineConfigObj=function() {var that=this;var eventSendArgs={'popupId':that.popupId,'popupData':that.popupData,'currentObj':that.currentObj};window.sgWindowOldWidth=window.innerWidth;window.sgWindowOldHeight=window.innerHeight;var config={popupId:that.popupId,openDelay:this.openDelay,popupTheme:this.popupTheme,popupType:this.popupType,closeBehavior:{allowed:this.allowed,showButton:this.showButton,buttonPosition:this.buttonPosition,buttonInside:this.buttonInside,autoclose:this.autoclose,overlayShouldClose:this.overlayShouldClose,contentShouldClose:this.contentShouldClose,escShouldClose:this.escShouldClose,right:this.closeButtonPositionRight,top:this.closeButtonPositionTop,bottom:this.closeButtonPositionBottom,left:this.closeButtonPositionLeft},openAnimation:{type:this.openAnimationEffect,speed:this.openAnimationSpeed,status:this.openAnimationStatus},closeAnimation:{type:this.closeAnimationEffect,speed:this.closeAnimationSpeed,status:this.closeAnimationStatus},closeButton:{data:this.buttonImage,width:this.closeButtonWidth,height:this.closeButtonHeight,widthType:this.closeButtonWidthType,heightType:this.closeButtonHeightType,type:this.closeButtonType,text:this.closeButtonText},overlay:{visible:this.overlayVisible,color:this.overlayColor,opacity:this.overlayOpacity,addClass:this.overlayAddClass},contentBox:{padding:this.contentPadding,zIndex:this.zIndex,showBackground:this.contentShowBackground,backgroundColor:this.contentBackgroundColor,backgroundImage:this.contentBackgroundImage,backgroundMode:this.contentBackgroundMode,backgroundPosition:this.contentBackgroundPosition,borderStyle:this.contentBorderStyle,borderRadius:this.contentBorderRadius,borderRadiusType:this.contentBorderRadiusType,borderColor:this.contentBorderColor,borderWidth:this.contentBorderWidth,boxBorderWidth:this.boxBorderWidth,shadowColor:this.contentShadowColor,shadowBlur:this.contentShadowBlur,scrollingEnabled:this.scrollingEnabled,shadowSpread:this.shadowSpread,addClass:this.contentAddClass},contents:this.contents,inline:this.srcElement,iframe:false,position:{right:this.positionRight,top:this.positionTop,bottom:this.positionBottom,left:this.positionLeft},sizingRanges:[{screenFrom:{width:0,height:0},screenTo:{width:300,height:3000},width:'100%',height:this.height,maxWidth:this.maxWidth,maxHeight:this.maxHeight,minWidth:this.minWidth,minHeight:this.minHeight},{screenFrom:{width:300,height:0},screenTo:{width:5000,height:3000},width:this.width,height:this.height,maxWidth:this.maxWidth,maxHeight:this.maxHeight,minWidth:this.minWidth,minHeight:this.minHeight}],shouldOpen:function(){return true;},willOpen:function(){that.addCustomEvent('sgpbWillOpen',eventSendArgs);},didOpen:function(args){if(that.isIE()){var finalArgs=[args,eventSendArgs],finalArgs=finalArgs.reduce(function(r,o){Object.keys(o).forEach(function(k){r[k]=o[k];});return r;},{});} else{var finalArgs=Object.assign(args,eventSendArgs);} that.addCustomEvent('sgpbDidOpen',finalArgs);},shouldClose:function(){return true;},willClose:function(){that.addCustomEvent('sgpbWillClose',eventSendArgs);},didClose:function(){that.addCustomEvent('sgpbDidClose',eventSendArgs);}};if(this.customShouldOpen){config.shouldOpen=this.customShouldOpen;} if(this.customShouldClose){config.shouldClose=this.customShouldClose;} return config;};var obj=new PopupConfig(); function sgAddEvent(element,eventName,fn) {if(element.addEventListener) element.addEventListener(eventName,fn,false);else if(element.attachEvent) element.attachEvent('on'+eventName,fn);} window.SGPB_ORDER=0;function SGPBPopup() {this.id=null;this.eventName='';this.popupData=null;this.additionalPopupData={};this.popupConfig={};this.popupObj=null;this.onceListener();this.initialsListeners();this.countPopupOpen=true;this.closeButtonDefaultPositions={};this.closeButtonDefaultPositions[1]={'left':9,'right':9,'bottom':9};this.closeButtonDefaultPositions[2]={'left':0,'right':0,'top':parseInt('-20'),'bottom':parseInt('-20')};this.closeButtonDefaultPositions[3]={'right':4,'bottom':4,'left':4,'top':4};this.closeButtonDefaultPositions[4]={'left':12,'right':12,'bottom':9};this.closeButtonDefaultPositions[5]={'left':8,'right':8,'bottom':8};this.closeButtonDefaultPositions[6]={'left':parseInt('-18.5'),'right':parseInt('-18.5'),'bottom':parseInt('-18.5'),'top':parseInt('-18.5')};} SGPBPopup.htmlCustomButton=function() {var buttons=jQuery('.sgpb-html-custom-button');var buttonActionBehaviors=function(button,settings) {button.bind('click',function(){var behavior=settings['sgpb-custom-button'];if(behavior==='redirectToURL'){if(settings['sgpb-custom-button-redirect-new-tab']){window.open(settings['sgpb-custom-button-redirect-URL']);} else{window.location.href=settings['sgpb-custom-button-redirect-URL'];}} if(behavior==='hidePopup'){SGPBPopup.closePopup();} if(behavior==='copyToClipBoard'){var tempInputId=1;var value=settings['sgpb-custom-button-copy-to-clipboard-text'];var tempInput=document.createElement("input");tempInput.id=tempInputId;tempInput.value=value;tempInput.style='position: absolute; right: -10000px';if(!document.getElementById(tempInputId)){document.body.appendChild(tempInput);} tempInput.select();document.execCommand("copy");if(settings['sgpb-copy-to-clipboard-close-popup']){SGPBPopup.closePopup();} if(settings['sgpb-custom-button-copy-to-clipboard-alert']){alert(settings['sgpb-custom-button-copy-to-clipboard-message']);}}});};buttons.each(function(){var settings=jQuery.parseJSON(decodeURIComponent(jQuery(this).attr('data-options')));buttonActionBehaviors(jQuery(this),settings);});};SGPBPopup.listeners=function(){var that=this;sgAddEvent(window,'sgpbPopupBuilderAdditionalDimensionSettings',function(e){SGPBPopup.mobileSafariAdditionalSettings(e);});sgAddEvent(window,'sgpbDidOpen',function(e){if(typeof(Event)==='function'){var event=new CustomEvent('resize',{bubbles:true,cancelable:true});} else{if(SGPBPopup.isIE()){var event=document.createEvent('Event');event.initEvent('resize',true,true);} else{var event=new CustomEvent('resize',{bubbles:true,cancelable:true});}} window.dispatchEvent(event);SGPBPopup.mobileSafariAdditionalSettings(e);var args=e.detail;var popupOptions=args.popupData;var obj=e.detail.currentObj.sgpbPopupObj;if(typeof SGPB_ANALYTICS_PARAMS==='undefined'){if(obj.getCountPopupOpen()){obj.addToCounter(popupOptions);}} if(popupOptions['sgpb-show-popup-same-user']){obj.setPopupLimitationCookie(popupOptions);} SGPBPopup.htmlCustomButton();});setInterval(function(){var openedPopups=window.sgpbOpenedPopup||{};if(!Object.keys(openedPopups).length){return false;} var params={};params.popupsIdCollection=window.sgpbOpenedPopup;var data={action:'sgpb_send_to_open_counter',nonce:SGPB_JS_PARAMS.nonce,params:params};window.sgpbOpenedPopup={};jQuery.post(SGPB_JS_PARAMS.ajaxUrl,data,function(res){});},600);};SGPBPopup.mobileSafariAdditionalSettings=function(e) {if(typeof e==='undefined'){var args=SGPBPopup.prototype.getAdditionalPopupData();if(typeof args==='undefined'){return false;} var popupOptions=args.popupData;var popupId=parseInt(args.popupId);} else{var args=e.detail;var alreadySavedArgs=SGPBPopup.prototype.getAdditionalPopupData();if(jQuery.isEmptyObject(alreadySavedArgs)){SGPBPopup.prototype.setAdditionalPopupData(args);} var popupOptions=args.popupData;var popupId=parseInt(args.popupId);} var userAgent=window.navigator.userAgent;if(userAgent.match(/iPad/i)||userAgent.match(/iPhone/i)){if(typeof popupOptions['sgpb-popup-dimension-mode']!=='undefined'&&popupOptions['sgpb-popup-dimension-mode']==='responsiveMode'){var openedPopupWidth=parseInt(window.innerHeight-100);if(e.detail.popupData['sgpb-type']==='iframe'||e.detail.popupData['sgpb-type']==='video'){if(jQuery('.sgpb-popup-builder-content-'+popupId+' iframe').length){jQuery('.sgpb-popup-builder-content-'+popupId).attr('style','height:'+openedPopupWidth+'px !important;');}}}}};SGPBPopup.prototype.setAdditionalPopupData=function(additionalPopupData) {this.additionalPopupData=additionalPopupData;};SGPBPopup.prototype.getAdditionalPopupData=function() {return this.additionalPopupData;};SGPBPopup.prototype.setCountPopupOpen=function(countPopupOpen) {this.countPopupOpen=countPopupOpen;};SGPBPopup.prototype.getCountPopupOpen=function() {return this.countPopupOpen;};SGPBPopup.playMusic=function(e){var args=e.detail;var popupId=parseInt(args.popupId);var options=SGPBPopup.getPopupOptionsById(popupId);var soundUrl=options['sgpb-sound-url'];var soundStatus=options['sgpb-open-sound'];if(soundStatus&&soundUrl&&!window.SGPB_SOUND[popupId]){var audio=new Audio(soundUrl);audio.play();window.SGPB_SOUND[popupId]=audio;}};SGPBPopup.floatingButton=function(e){SGPBPopup.showFloatingButton(e);jQuery(window).on('sgpbFormSuccess',function(e){SGPBPopup.hideFloatingButton();});};SGPBPopup.showFloatingButton=function(e){var popupObj=e||{};var popupId=0;var shouldShowFloatingButton=true;if(e.hasOwnProperty('sgpbPopupObj')){popupObj=e.detail.currentObj.sgpbPopupObj;} if(popupObj instanceof SGPBPopup){popupId=parseInt(popupObj.id);shouldShowFloatingButton=popupObj.forceCheckCurrentPopupType(popupObj);} if(shouldShowFloatingButton){if(popupId){jQuery('.sgpb-floating-button.sg-popup-id-'+popupId).show();}else{jQuery('.sgpb-floating-button').show();}}};SGPBPopup.hideFloatingButton=function(popupId){if(popupId){jQuery('.sgpb-floating-button.sg-popup-id-'+popupId).fadeOut();}else{jQuery('.sgpb-floating-button').fadeOut();}};SGPBPopup.prototype.initialsListeners=function() {var that=this;sgAddEvent(window,'sgpbDidOpen',function(e){jQuery('.sg-popup-close').unbind('click').bind('click',function(){var currentPopupId=jQuery(this).parents('.sg-popup-builder-content').attr('data-id');SGPBPopup.closePopupById(currentPopupId);});});sgAddEvent(window,'sgpbDidClose',function(e){var args=e.detail;var popupId=parseInt(args.popupId);that.htmlIframeFilterForOpen(popupId,'close');});};SGPBPopup.prototype.onceListener=function() {var that=this;sgAddEvent(window,'sgpbDidOpen',function(e){document.onkeydown=function(e){e=e||window.event;if(e.keyCode===27){var currentPopup=that.getPopupIdForNextEsc();if(!currentPopup){return false;} var lastPopupId=parseInt(currentPopup['popupId']);SGPBPopup.closePopupById(lastPopupId);}};});sgAddEvent(window,'sgpbDidClose',function(e){if(window.sgPopupBuilder.length!==0){var popups=[].concat(window.sgPopupBuilder).reverse();for(var i in popups){var nextIndex=++i;var nextObj=popups[nextIndex];if(typeof nextObj==='undefined'){jQuery('html').removeClass('sgpb-overflow-hidden');jQuery('body').removeClass('sgpb-overflow-hidden-body');break;} if(nextObj.isOpen===false){continue;} var options=SGPBPopup.getPopupOptionsById(nextObj.popupId);if(typeof options['sgpb-disable-page-scrolling']==='undefined'){jQuery('html').removeClass('sgpb-overflow-hidden');jQuery('body').removeClass('sgpb-overflow-hidden-body');} else{jQuery('html').addClass('sgpb-overflow-hidden');jQuery('body').addClass('sgpb-overflow-hidden-body');} break;}} else{jQuery('html').addClass('sgpb-overflow-hidden');jQuery('body').addClass('sgpb-overflow-hidden-body');}});};SGPBPopup.prototype.getPopupIdForNextEsc=function() {var popups=window.sgPopupBuilder;var popup=false;if(!popups.length){return popup;} var searchPopups=[].concat(popups).reverse();for(var i in searchPopups){var popupData=searchPopups[i];if(popupData.isOpen){var popupId=parseInt(popupData['popupId']);var popupOptions=SGPBPopup.getPopupOptionsById(popupId);if(!popupOptions['sgpb-disable-popup-closing']&&popupOptions['sgpb-esc-key']){popup=popupData;break;}}} return popup;};SGPBPopup.prototype.setPopupId=function(popupId) {this.id=parseInt(popupId);};SGPBPopup.prototype.getPopupId=function() {return this.id;};SGPBPopup.prototype.setPopupObj=function(popupObj) {this.popupObj=popupObj;};SGPBPopup.prototype.getPopupObj=function() {return this.popupObj;};SGPBPopup.prototype.setPopupData=function(popupData) {if(typeof popupData=='string'){var popupData=SGPBPopup.JSONParse(popupData);} this.popupData=popupData;};SGPBPopup.prototype.getPopupData=function() {return this.popupData;};SGPBPopup.prototype.setPopupConfig=function(config) {this.popupConfig=config;};SGPBPopup.prototype.getPopupConfig=function() {return this.popupConfig;};SGPBPopup.prototype.setUpPopupConfig=function() {var popupConfig=new PopupConfig();this.setPopupConfig(popupConfig);};SGPBPopup.createPopupObjById=function(popupId) {var options=SGPBPopup.getPopupOptionsById(popupId);if(!options){return false;} var popupObj=new SGPBPopup();popupObj.setPopupId(popupId);popupObj.setPopupData(options);return popupObj;};SGPBPopup.getPopupOptionsById=function(popupId) {var popupDataDiv=jQuery('#sg-popup-content-wrapper-'+popupId);if(!popupDataDiv.length){return false;} var options=popupDataDiv.attr('data-options');return SGPBPopup.JSONParse(options);};SGPBPopup.prototype.getCompatibleZiIndex=function(popupZIndex) {if(popupZIndex>2147483647){return 2147483627;} return popupZIndex;};SGPBPopup.prototype.prepareOpen=function() {var popupId=this.getPopupId();var popupData=this.getPopupData();var popupZIndex=this.getCompatibleZiIndex(popupData['sgpb-popup-z-index']);var popupType=this.popupData['sgpb-type'];this.setUpPopupConfig();var that=this;var popupConfig=this.getPopupConfig();function decodeEntities(encodedString) {if(typeof encodedString=='undefined'){return'';} var suspiciousStrings=['document.createElement','createElement','String.fromCharCode','fromCharCode'];for(var i in suspiciousStrings){if(encodedString.indexOf(suspiciousStrings[i])>0){return'';}} var textArea=document.createElement('textarea');textArea.innerHTML=encodedString;return textArea.value;} popupConfig.customShouldOpen=function() {var instructions=popupData['sgpb-ShouldOpen'];instructions=decodeEntities(instructions);var F=new Function(instructions);return(F());};popupConfig.customShouldClose=function() {var instructions=popupData['sgpb-ShouldClose'];instructions=decodeEntities(instructions);var F=new Function(instructions);return(F());};this.setPopupDimensions();if(popupData['sgpb-disable-popup-closing']=='on'){popupData['sgpb-enable-close-button']='';popupData['sgpb-esc-key']='';popupData['sgpb-overlay-click']='';} popupData['eventName']=this.eventName;if(SGPBPopup.varToBool(popupData['sgpb-enable-close-button'])){popupConfig.magicCall('setCloseButtonDelay',parseInt(popupData['sgpb-close-button-delay']));} popupConfig.magicCall('setShowButton',SGPBPopup.varToBool(popupData['sgpb-enable-close-button']));var openAnimationSpeed=parseFloat(popupData['sgpb-open-animation-speed'])*1000;var closeAnimationSpeed=parseFloat(popupData['sgpb-close-animation-speed'])*1000;popupConfig.magicCall('setOpenAnimationEffect',popupData['sgpb-open-animation-effect']);popupConfig.magicCall('setCloseAnimationEffect',popupData['sgpb-close-animation-effect']);popupConfig.magicCall('setOpenAnimationSpeed',openAnimationSpeed);popupConfig.magicCall('setCloseAnimationSpeed',closeAnimationSpeed);popupConfig.magicCall('setOpenAnimationStatus',popupData['sgpb-open-animation']);popupConfig.magicCall('setCloseAnimationStatus',popupData['sgpb-close-animation']);popupConfig.magicCall('setContentPadding',popupData['sgpb-content-padding']);if(typeof SgpbRecentSalesPopupType!='undefined'){if(popupType==SgpbRecentSalesPopupType){popupZIndex=2147483647;popupConfig.magicCall('setCloseAnimationEffect','fade');popupConfig.magicCall('setCloseAnimationSpeed',1000);popupConfig.magicCall('setCloseAnimationStatus','on');}} popupConfig.magicCall('setZIndex',popupZIndex);popupConfig.magicCall('setCloseButtonWidth',popupData['sgpb-button-image-width']);popupConfig.magicCall('setCloseButtonHeight',popupData['sgpb-button-image-height']);popupConfig.magicCall('setPopupId',popupId);popupConfig.magicCall('setPopupData',popupData);popupConfig.magicCall('setAllowed',!SGPBPopup.varToBool(popupData['sgpb-disable-popup-closing']));if(popupData['sgpb-type']==SGPB_POPUP_PARAMS.popupTypeAgeRestriction){popupConfig.magicCall('setAllowed',false);} popupConfig.magicCall('setEscShouldClose',SGPBPopup.varToBool(popupData['sgpb-esc-key']));popupConfig.magicCall('setOverlayShouldClose',SGPBPopup.varToBool(popupData['sgpb-overlay-click']));popupConfig.magicCall('setScrollingEnabled',SGPBPopup.varToBool(popupData['sgpb-enable-content-scrolling']));if(SGPBPopup.varToBool(popupData['sgpb-content-click'])){this.contentCloseBehavior();} sgAddEvent(window,'sgpbWillOpen',function(e){if(popupId!=e.detail.popupId||e.detail.popupData['sgpb-content-click']=='undefined'){return false;} that.popupContentClick(e);});if(SGPBPopup.varToBool(popupData['sgpb-popup-fixed'])){this.addFixedPosition();} this.themeCreator();this.themeCustomizations();popupConfig.magicCall('setContents',document.getElementById('sg-popup-content-wrapper-'+popupId));popupConfig.magicCall('setPopupType',popupType);this.setPopupConfig(popupConfig);this.popupTriggeringListeners();var allowToOpen=this.checkCurrentPopupType();if(allowToOpen){this.open();}};SGPBPopup.prototype.popupContentClick=function(e) {var args=e.detail;var popupId=parseInt(args['popupId']);jQuery('.sgpb-content-'+popupId).on('click',function(event){var settings={popupId:popupId,eventName:'sgpbPopupContentclick'};jQuery(window).trigger('sgpbPopupContentclick',settings);});};SGPBPopup.prototype.forceCheckCurrentPopupType=function(popupObj) {var allowToOpen=true;var popupConfig=new PopupConfig();var className=popupObj.popupData['sgpb-type'];if(typeof className=='undefined'||className=='undefined'){return false;} if(typeof SGPB_POPUP_PARAMS.conditionalJsClasses!='undefined'&&SGPB_POPUP_PARAMS.conditionalJsClasses.length){var isAllowConditions=this.forceIsAllowJsConditions(popupObj);if(!isAllowConditions){return false;}} var popupConfig=new PopupConfig();var className=this.popupData['sgpb-type'];className=popupConfig.prefix.toUpperCase()+PopupConfig.firstToUpperCase(className);if(window.hasOwnProperty(className)){className=eval(className);var obj=new className;if(typeof obj.allowToOpen==='function'){allowToOpen=obj.allowToOpen(this.id);if(!allowToOpen){isAllow=allowToOpen;}}} var allowToOpen=this.checkCurrentPopupType();if(!allowToOpen){return false;} return allowToOpen;};SGPBPopup.prototype.checkCurrentPopupType=function() {var allowToOpen=true;var popupConfig=new PopupConfig();var isPreview=parseInt(this.popupData['sgpb-is-preview']);if(!isNaN(isPreview)&&isPreview==1){return allowToOpen;} var popupHasLimit=this.isSatistfyForShowingLimitation(this.popupData);if(!popupHasLimit){return false;} var dontShowPopupCookieName='sgDontShowPopup'+this.popupData['sgpb-post-id'];var dontShowPopup=SGPopup.getCookie(dontShowPopupCookieName);if(dontShowPopup!=''){return false;} var className=this.popupData['sgpb-type'];if(typeof className=='undefined'||className=='undefined'){return false;} if(typeof SGPB_POPUP_PARAMS.conditionalJsClasses!='undefined'&&SGPB_POPUP_PARAMS.conditionalJsClasses.length){var isAllowConditions=this.isAllowJsConditions();if(!isAllowConditions){return false;}} className=popupConfig.prefix.toUpperCase()+PopupConfig.firstToUpperCase(className);if(window.hasOwnProperty(className)){className=eval(className);var obj=new className;if(typeof obj.allowToOpen==='function'){allowToOpen=obj.allowToOpen(this.id);}} return allowToOpen;};SGPBPopup.prototype.forceIsAllowJsConditions=function(popupObj){var conditions=SGPB_POPUP_PARAMS.conditionalJsClasses;var isAllow=true;for(var i in conditions){if(!conditions.hasOwnProperty(i)){break;} try{var className=eval(conditions[i]);} catch(e){continue;} var obj=new className;if(typeof obj.forceAllowToOpen==='function'){var popupData=this.getPopupData();var allowToOpen=obj.forceAllowToOpen(popupObj.id,popupObj);if(!allowToOpen){isAllow=allowToOpen;break;}}} return isAllow;};SGPBPopup.prototype.isAllowJsConditions=function(){var conditions=SGPB_POPUP_PARAMS.conditionalJsClasses;var isAllow=true;for(var i in conditions){if(!conditions.hasOwnProperty(i)){break;} try{var className=eval(conditions[i]);} catch(e){continue;} var obj=new className;if(typeof obj.allowToOpen==='function'){var allowToOpen=obj.allowToOpen(this.id,this);if(!allowToOpen){isAllow=allowToOpen;break;}}} return isAllow;};SGPBPopup.prototype.setPopupLimitationCookie=function(popupData) {var cookieData=this.getPopupShowLimitationCookie(popupData);var cookie=cookieData.cookie||{};var openingCount=cookie.openingCount||0;var currentUrl=window.location.href;if(!popupData['sgpb-show-popup-same-user-page-level']){currentUrl='';} cookie.openingCount=openingCount+1;cookie.openingPage=currentUrl;var popupShowingLimitExpiry=parseInt(popupData['sgpb-show-popup-same-user-expiry']);SGPBPopup.setCookie(cookieData.cookieName,JSON.stringify(cookie),popupShowingLimitExpiry,currentUrl);};SGPBPopup.prototype.isSatistfyForShowingLimitation=function(popupData) {var popupLimitation=popupData['sgpb-show-popup-same-user'];if(!popupLimitation){return true;} var cookieData=this.getPopupShowLimitationCookie(popupData);if(!cookieData.cookie){return true;} return popupData['sgpb-show-popup-same-user-count']>cookieData.cookie.openingCount;};SGPBPopup.prototype.getPopupShowLimitationCookie=function(popupData) {var savedCookie=this.getPopupShowLimitationCookieDetails(popupData);var savedCookie=this.filterPopupLimitationCookie(savedCookie);return savedCookie;};SGPBPopup.prototype.filterPopupLimitationCookie=function(cookie) {var result={};result.cookie='';if(cookie.isPageLevel){result.cookieName=cookie.pageLevelCookieName;if(cookie.pageLevelCookie){result.cookie=jQuery.parseJSON(cookie.pageLevelCookie);} SGPBPopup.deleteCookie(cookie.domainLevelCookieName);return result;} result.cookieName=cookie.domainLevelCookieName;if(cookie.domainLevelCookie){result.cookie=jQuery.parseJSON(cookie.domainLevelCookie);} var currentUrl=window.location.href;SGPBPopup.deleteCookie(cookie.pageLevelCookieName,currentUrl);return result;};SGPBPopup.prototype.getPopupShowLimitationCookieDetails=function(popupData) {var result=false;var currentUrl=window.location.href;var currentPopupId=popupData['sgpb-post-id'];var popupLimitationCookieHomePageLevelName='SGPBShowingLimitationHomePage'+currentPopupId;var popupLimitationCookiePageLevelName='SGPBShowingLimitationPage'+currentPopupId;var popupLimitationCookieDomainName='SGPBShowingLimitationDomain'+currentPopupId;var pageLevelCookie=popupData['sgpb-show-popup-same-user-page-level']||false;if(currentUrl==SGPB_POPUP_PARAMS.homePageUrl){popupLimitationCookiePageLevelName=popupLimitationCookieHomePageLevelName;} var popupLimitationPageLevelCookie=SGPopup.getCookie(popupLimitationCookiePageLevelName);var popupLimitationDomainCookie=SGPopup.getCookie(popupLimitationCookieDomainName);result={'pageLevelCookieName':popupLimitationCookiePageLevelName,'domainLevelCookieName':popupLimitationCookieDomainName,'pageLevelCookie':popupLimitationPageLevelCookie,'domainLevelCookie':popupLimitationDomainCookie,'isPageLevel':pageLevelCookie};return result;};SGPBPopup.prototype.themeCreator=function() {var noPositionSelected=false;var popupData=this.getPopupData();var popupId=this.getPopupId();var popupConfig=this.getPopupConfig();var forceRtlClass='';var forceRtl=SGPBPopup.varToBool(popupData['sgpb-force-rtl']);var popupTheme=popupData['sgpb-popup-themes'];var popupType=popupData['sgpb-type'];var closeButtonWidth=popupData['sgpb-button-image-width'];var closeButtonHeight=popupData['sgpb-button-image-height'];var contentPadding=parseInt(popupData['sgpb-content-padding']);var top=parseInt(popupData['sgpb-button-position-top']);var right=parseInt(popupData['sgpb-button-position-right']);var bottom=parseInt(popupData['sgpb-button-position-bottom']);var left=parseInt(popupData['sgpb-button-position-left']);var contentClass=popupData['sgpb-content-custom-class'];var popupBorder=SGPBPopup.varToBool(popupData['sgpb-disable-border']);var closeButtonImage=popupConfig.closeButtonImage;var themeNumber=1;var backgroundColor='black';var borderColor='inherit';var recentSalesPopup=false;if(typeof SgpbRecentSalesPopupType!='undefined'){if(popupType==SgpbRecentSalesPopupType){recentSalesPopup=true;popupTheme='sgpb-theme-2';closeButtonPosition='topRight';backgroundColor='white';borderColor='#ececec';top='-10';right='-10';popupConfig.magicCall('setShadowSpread',1);popupConfig.magicCall('setContentShadowBlur',5);popupConfig.magicCall('setOverlayVisible',false);popupConfig.magicCall('setContentShadowColor','#000000b3');popupConfig.magicCall('setContentBorderRadius','5px');}} var themeIndexNum=popupTheme[popupTheme.length-1];if(isNaN(top)){top=this.closeButtonDefaultPositions[themeIndexNum].top;} if(isNaN(right)){right=this.closeButtonDefaultPositions[themeIndexNum].right;} if(isNaN(bottom)){bottom=this.closeButtonDefaultPositions[themeIndexNum].bottom;} if(isNaN(left)){left=this.closeButtonDefaultPositions[themeIndexNum].left;} if(forceRtl){forceRtlClass=' sgpb-popup-content-direction-right';} if(popupData['sgpb-type']=='countdown'){popupConfig.magicCall('setMinWidth',300);} popupConfig.magicCall('setContentPadding',contentPadding);popupConfig.magicCall('setOverlayAddClass',popupTheme+'-overlay sgpb-popup-overlay-'+popupId);popupConfig.magicCall('setContentAddClass','sgpb-content sgpb-content-'+popupId+' '+popupTheme+'-content '+contentClass+forceRtlClass);if(typeof popupData['sgpb-close-button-position']=='undefined'||popupData['sgpb-close-button-position']==''){var noPositionSelected=true;} else{var closeButtonPosition=popupData['sgpb-close-button-position'];popupConfig.magicCall('setButtonPosition',closeButtonPosition);} if(popupTheme=='sgpb-theme-1'){themeNumber=1;popupConfig.magicCall('setShadowSpread',14);if(noPositionSelected||closeButtonPosition=='bottomRight'){popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');} else{popupConfig.magicCall('setCloseButtonPositionLeft',left+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');}} else if(popupTheme=='sgpb-theme-2'){themeNumber=2;popupConfig.magicCall('setButtonInside',false);popupConfig.magicCall('setContentBorderWidth',1);popupConfig.magicCall('setContentBackgroundColor',backgroundColor);popupConfig.magicCall('setContentBorderColor',borderColor);popupConfig.magicCall('setOverlayColor','white');var rightPosition='0';var topPosition='-'+closeButtonHeight+'px';if(recentSalesPopup){rightPosition='-'+(closeButtonWidth/2)+'px';topPosition='-'+(closeButtonHeight/2)+'px';themeNumber=6;} if(noPositionSelected||closeButtonPosition=='topRight'){popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionTop',top+'px');} else{if(closeButtonPosition=='topLeft'){popupConfig.magicCall('setCloseButtonPositionLeft',left+'px');popupConfig.magicCall('setCloseButtonPositionTop',top+'px');} else if(closeButtonPosition=='bottomRight'){popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');} else if(closeButtonPosition=='bottomLeft'){popupConfig.magicCall('setCloseButtonPositionLeft',left+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');}} if(popupBorder){popupConfig.magicCall('setContentBorderWidth',0);}} else if(popupTheme=='sgpb-theme-3'){themeNumber=3;popupConfig.magicCall('setContentBorderWidth',5);popupConfig.magicCall('setContentBorderRadius',popupData['sgpb-border-radius']);popupConfig.magicCall('setContentBorderRadiusType',popupData['sgpb-border-radius-type']);popupConfig.magicCall('setContentBorderColor',popupData['sgpb-border-color']);var closeButtonPositionPx='4px';if(popupBorder){popupConfig.magicCall('setContentBorderWidth',0);closeButtonPositionPx='0px';} if(noPositionSelected){popupConfig.magicCall('setCloseButtonWidth',38);popupConfig.magicCall('setCloseButtonHeight',19);popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionTop',top+'px');} else{if(closeButtonPosition=='topRight'){popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionTop',top+'px');} else if(closeButtonPosition=='topLeft'){popupConfig.magicCall('setCloseButtonPositionLeft',left+'px');popupConfig.magicCall('setCloseButtonPositionTop',top+'px');} else if(closeButtonPosition=='bottomRight'){popupConfig.magicCall('setCloseButtonPositionLeft',right+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');} else if(closeButtonPosition=='bottomLeft'){popupConfig.magicCall('setCloseButtonPositionLeft',left+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');}}} else if(popupTheme=='sgpb-theme-4'){themeNumber=4;popupConfig.magicCall('setButtonImage',popupData['sgpb-button-text']);popupConfig.magicCall('setCloseButtonType','button');popupConfig.magicCall('setCloseButtonText',popupData['sgpb-button-text']);popupConfig.magicCall('setContentBorderWidth',0);popupConfig.magicCall('setContentBackgroundColor','white');popupConfig.magicCall('setContentBorderColor','white');popupConfig.magicCall('setOverlayColor','white');popupConfig.magicCall('setShadowSpread',4);popupConfig.magicCall('setContentShadowBlur',8);if(noPositionSelected||closeButtonPosition=='bottomRight'){popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');} else{popupConfig.magicCall('setCloseButtonPositionLeft',left+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');}} else if(popupTheme=='sgpb-theme-5'){themeNumber=5;popupConfig.magicCall('setBoxBorderWidth',10);popupConfig.magicCall('setContentBorderColor','#4B4B4B');if(noPositionSelected||closeButtonPosition=='bottomRight'){popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');} else{popupConfig.magicCall('setCloseButtonPositionLeft',left+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');}} else if(popupTheme=='sgpb-theme-6'){themeNumber=6;popupConfig.magicCall('setButtonInside',false);popupConfig.magicCall('setContentBorderRadius',7);popupConfig.magicCall('setContentBorderRadiusType','px');if(noPositionSelected){popupConfig.magicCall('setCloseButtonWidth',37);popupConfig.magicCall('setCloseButtonHeight',37);popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionTop',top+'px');} else{if(typeof popupData['sgpb-button-position-right']=='undefined'){right='-'+(closeButtonWidth/2);top='-'+(closeButtonHeight/2);left='-'+(closeButtonWidth/2);bottom='-'+(closeButtonHeight/2);} if(closeButtonPosition=='topRight'){popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionTop',top+'px');} else if(closeButtonPosition=='topLeft'){popupConfig.magicCall('setCloseButtonPositionLeft',left+'px');popupConfig.magicCall('setCloseButtonPositionTop',top+'px');} else if(closeButtonPosition=='bottomRight'){popupConfig.magicCall('setCloseButtonPositionRight',right+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');} else if(closeButtonPosition=='bottomLeft'){popupConfig.magicCall('setCloseButtonPositionLeft',left+'px');popupConfig.magicCall('setCloseButtonPositionBottom',bottom+'px');}}} popupConfig.magicCall('setPopupTheme',themeNumber);if(!popupData['sgpb-button-image']){closeButtonImage=SGPB_POPUP_PARAMS.defaultThemeImages[themeNumber];if(typeof closeButtonImage!='undefined'){popupConfig.magicCall('setButtonImage',closeButtonImage);}} else{popupConfig.magicCall('setButtonImage','data:image/png;base64,'+popupData['sgpb-button-image-data']);if(popupData['sgpb-button-image-data']==''||popupData['sgpb-button-image-data'].indexOf('http')!=-1){popupConfig.magicCall('setButtonImage',popupData['sgpb-button-image']);}}};SGPBPopup.prototype.themeCustomizations=function() {var popupId=this.getPopupId();var popupData=this.getPopupData();var popupConfig=this.getPopupConfig();var contentOpacity=popupData['sgpb-content-opacity'];var contentBgColor=popupData['sgpb-background-color'];if(popupData['sgpb-background-image-data']){var contentBgImage='data:image/png;base64,'+popupData['sgpb-background-image-data'];} else{var contentBgImage=popupData['sgpb-background-image'];} var showContentBackground=popupData['sgpb-show-background'];var contentBgImageMode=popupData['sgpb-background-image-mode'];var overlayColor=popupData['sgpb-overlay-color'];var popupTheme=popupData['sgpb-popup-themes'];var popupType=popupData['sgpb-type'];if(typeof popupData['sgpb-overlay-custom-class']=='undefined'){popupData['sgpb-overlay-custom-class']='sgpb-popup-overlay';} if(typeof popupData['sgpb-popup-themes']=='undefined'){popupTheme='sgpb-theme-2';} if(typeof showContentBackground=='undefined'){contentBgColor='';contentBgImage='';contentBgImageMode='';} if(typeof SgpbRecentSalesPopupType!='undefined'){if(popupType==SgpbRecentSalesPopupType){showContentBackground='on';contentBgColor=popupData['sgpb-background-color'];contentOpacity=popupData['sgpb-content-opacity'];}} if(contentOpacity){popupConfig.magicCall('setContentBackgroundOpacity',contentOpacity);} if(contentBgImageMode){popupConfig.magicCall('setContentBackgroundMode',contentBgImageMode);} if(contentBgImage){popupConfig.magicCall('setContentBackgroundImage',contentBgImage);} if(contentBgColor){contentBgColor=SGPBPopup.hexToRgba(contentBgColor,contentOpacity);popupConfig.magicCall('setContentBackgroundColor',contentBgColor);} if(overlayColor){popupConfig.magicCall('setOverlayColor',overlayColor);} var overlayClasses=popupTheme+'-overlay sgpb-popup-overlay-'+popupId;if(SGPB_JS_PACKAGES.extensions['advanced-closing']){if(typeof popupData['sgpb-enable-popup-overlay']!='undefined'&&popupData['sgpb-enable-popup-overlay']=='on'){popupData['sgpb-enable-popup-overlay']=true;} else if(typeof popupData['sgpb-enable-popup-overlay']=='undefined'){popupData['sgpb-enable-popup-overlay']=false;}} else{popupData['sgpb-enable-popup-overlay']=true;} popupConfig.magicCall('setOverlayVisible',SGPBPopup.varToBool(popupData['sgpb-enable-popup-overlay']));if(typeof SgpbRecentSalesPopupType!='undefined'){popupConfig.magicCall('setOverlayVisible',false);} if(SGPBPopup.varToBool(popupData['sgpb-enable-popup-overlay'])){popupConfig.magicCall('setOverlayAddClass',overlayClasses+' '+popupData['sgpb-overlay-custom-class']);var overlayOpacity=popupData['sgpb-overlay-opacity']||0.8;popupConfig.magicCall('setOverlayOpacity',overlayOpacity*100);}};SGPBPopup.prototype.formSubmissionDetection=function(args) {if(args.length){return false;} var popupId=args.popupId;var options=SGPBPopup.getPopupOptionsById(popupId);if(!options['sgpb-reopen-after-form-submission']){return false;} jQuery('.sgpb-popup-builder-content-'+popupId+' form').submit(function(){SGPBPopup.setCookie('SGPBSubmissionReloadPopup',popupId);});};SGPBPopup.prototype.htmlIframeFilterForOpen=function(popupId,popupEventName) {var popupContent=jQuery('.sgpb-content-'+popupId);if(!popupContent.length){return false;} popupContent.find('iframe').each(function(){if(popupEventName!='open'){if(jQuery(this).closest('.fb_iframe_widget').length){return true;} if(typeof jQuery(this).attr('data-attr-src')=='undefined'){var src=jQuery(this).attr('src');if(src!=''){jQuery(this).attr('data-attr-src',src);jQuery(this).attr('src','');} return true;} else{var src=jQuery(this).attr('src');if(src!=''){jQuery(this).attr('data-attr-src',src);jQuery(this).attr('src','');} return true;}} else{if(typeof jQuery(this).attr('data-attr-src')=='undefined'){var src=jQuery(this).attr('src');if(src!=''){jQuery(this).attr('data-attr-src',src);} return true;} else{var src=jQuery(this).attr('data-attr-src');if(src!=''){jQuery(this).attr('src',src);jQuery(this).attr('data-attr-src',src);} return true;}}});};SGPBPopup.prototype.iframeSizesInHtml=function(args) {var popupId=args['popupId'];var popupOptions=args.popupData;var popupContent=jQuery('.sgpb-content-'+popupId);if(!popupContent.length){return false;} popupContent.find('iframe').each(function(){if(typeof jQuery(this)=='undefined'){return false;} if(popupOptions['sgpb-popup-dimension-mode']=='customMode'){if(typeof jQuery(this).attr('width')=='undefined'&&typeof popupContent.attr('height')=='undefined'){jQuery(this).css({'width':popupOptions['sgpb-width'],'height':popupOptions['sgpb-height']});}}});};SGPBPopup.prototype.getSearchDataFromContent=function(content) {var pattern=/\[(\[?)(pbvariable)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]\*+(?:\[(?!\/\2\])[^\[]\*+)\*+)\[\/\2\])?)(\]?)/gi;var match;var collectedData=[];while(match=pattern.exec(content)){var currentSearchData=[];var attributes;var attributesKeyValue=[];var parseAttributes=/\s(\w+?)="(.+?)"/g;currentSearchData['replaceString']=this.htmlDecode(match[0]);while(attributes=parseAttributes.exec(match[3])){attributesKeyValue[attributes[1]]=this.htmlDecode(attributes[2]);} currentSearchData['searchData']=attributesKeyValue;collectedData.push(currentSearchData);} return collectedData;};SGPBPopup.prototype.replaceWithCustomShortcode=function(popupId) {var currentHtmlContent=jQuery('.sgpb-content-'+popupId).html();var searchData=this.getSearchDataFromContent(currentHtmlContent);var that=this;if(!searchData.length){return false;} for(var index in searchData){var currentSearchData=searchData[index];var searchAttributes=currentSearchData['searchData'];if(typeof searchAttributes['selector']=='undefined'||typeof searchAttributes['attribute']=='undefined'){that.replaceShortCode(currentSearchData['replaceString'],'',popupId);continue;} try{if(!jQuery(searchAttributes['selector']).length){that.replaceShortCode(currentSearchData['replaceString'],'',popupId);continue;}} catch(e){that.replaceShortCode(currentSearchData['replaceString'],'',popupId);continue;} if(searchAttributes['attribute']=='text'){var replaceName=jQuery(searchAttributes['selector']).text();} else{var replaceName=jQuery(searchAttributes['selector']).attr(searchAttributes['attribute']);} if(typeof replaceName=='undefined'){that.replaceShortCode(currentSearchData['replaceString'],'',popupId);continue;} that.replaceShortCode(currentSearchData['replaceString'],replaceName,popupId);}};SGPBPopup.prototype.replaceShortCode=function(shortCode,replaceText,popupId) {var popupId=parseInt(popupId);if(!popupId){return false;} var popupContentWrapper=jQuery('.sgpb-content-'+popupId);if(!popupContentWrapper.length){return false;} popupContentWrapper.find('div').each(function(){var currentHtmlContent=jQuery(this).contents();if(!currentHtmlContent.length){return false;} currentHtmlContent.html(function(i,v){if(typeof v!='undefined'){return v.replace(shortCode,replaceText);}});});return true;};SGPBPopup.prototype.popupTriggeringListeners=function() {var that=this;var popupData=this.getPopupData();var popupConfig=this.getPopupConfig();sgAddEvent(window,'sgpbDidOpen',function(e){var args=e.detail;that.iframeSizesInHtml(args);that.formSubmissionDetection(args);var popupOptions=args.popupData;var closeButtonDelay=parseInt(popupOptions['sgpb-close-button-delay']);if(closeButtonDelay){that.closeButtonDisplay(popupOptions['sgpb-post-id'],'show',closeButtonDelay);} var disablePageScrolling=popupOptions['sgpb-disable-page-scrolling'];if(popupOptions['sgpb-overlay-color']){jQuery('.sgpb-theme-1-overlay').css({'background-image':'none'});} if(SGPBPopup.varToBool(disablePageScrolling)){jQuery('html').addClass('sgpb-overflow-hidden');jQuery('body').addClass('sgpb-overflow-hidden-body');}});sgAddEvent(window,'sgpbWillOpen',function(e){var args=e.detail;var popupId=parseInt(args['popupId']);that.htmlIframeFilterForOpen(args.popupId,'open');that.replaceWithCustomShortcode(popupId);that.sgpbDontShowPopup(popupId);var closeButtonDelay=parseInt(popupData['sgpb-close-button-delay']);if(closeButtonDelay){that.closeButtonDisplay(popupData['sgpb-post-id'],'hide');} var settings={popupId:popupData['sgpb-post-id'],disabledAnalytics:popupData['sgpb-popup-counting-disabled'],disabledInGeneral:SGPB_POPUP_PARAMS.disableAnalyticsGeneral};jQuery(window).trigger('sgpbDisableAnalytics',settings);});sgAddEvent(window,'sgpbShouldClose',function(e){});sgAddEvent(window,'sgpbWillClose',function(e){var args=e.detail;SGPBPopup.offPopup(e.detail.currentObj);});};SGPBPopup.prototype.sgpbDontShowPopup=function(popupId) {var dontShowPopup=jQuery('.sgpb-content-'+popupId).parent().find('[class*="sg-popup-dont-show"]');if(!dontShowPopup.length){return false;} dontShowPopup.each(function(){jQuery(this).bind('click',function(e){e.preventDefault();var expireTime=SGPB_POPUP_PARAMS.dontShowPopupExpireTime;var cookieName='sgDontShowPopup'+popupId;var classNameSearch=jQuery(this).attr('class').match(/sg-popup-dont-show/);var className=classNameSearch['input'];var customExpireTime=className.match(/sg-popup-dont-show-(\d+$)/);if(customExpireTime){expireTime=parseInt(customExpireTime[1]);} SGPBPopup.setCookie(cookieName,expireTime,expireTime);SGPBPopup.closePopupById(popupId);});});};SGPBPopup.prototype.addToCounter=function(popupOptions) {if(SGPB_POPUP_PARAMS.isPreview||(typeof popupOptions['sgpb-popup-counting-disabled']!='undefined')){return false;} var that=this;var openedPopups=window.sgpbOpenedPopup||{};var popupId=parseInt(popupOptions['sgpb-post-id']);if(typeof openedPopups[popupId]=='undefined'){openedPopups[popupId]=1;} else{openedPopups[popupId]+=1;} window.sgpbOpenedPopup=openedPopups;};SGPBPopup.prototype.closeButtonDisplay=function(popupId,display,delay) {if(display=='show'){setTimeout(function(){jQuery('.sgpb-content-'+popupId).prev().show();},delay*1000);} else if(display=='hide'){jQuery('.sgpb-content-'+popupId).prev().hide();}};SGPBPopup.prototype.open=function(args) {var customEvent=this.customEvent;var config=this.getPopupConfig();var popupId=this.getPopupId();var eventName=this.eventName;if(typeof window.sgPopupBuilder=='undefined'){window.sgPopupBuilder=[];} var popupData=SGPBPopup.getPopupWindowDataById(popupId);if(!popupData){window.SGPB_ORDER+=1;var currentObj={'eventName':eventName,'popupId':popupId,'order':window.SGPB_ORDER,'isOpen':true,'sgpbPopupObj':this};config.currentObj=currentObj;var popupConfig=config.combineConfigObj();var popup=new SGPopup(popupConfig);currentObj.popup=popup;window.sgPopupBuilder.push(currentObj);} else{popup=popupData['popup'];popupData['isOpen']=true;} if(typeof args!='undefined'&&!args['countPopupOpen']){this.setCountPopupOpen(false);} popup.customEvent=customEvent;popup.open();this.setPopupObj(popup);var options=SGPBPopup.getPopupOptionsById(popupId);SgpbEventListener.CF7EventListener(popupId,options);if(typeof options['sgpb-behavior-after-special-events']!='undefined'){if(options['sgpb-behavior-after-special-events'].length){options=options['sgpb-behavior-after-special-events'][0][0];if(options['param']=='contact-form-7'){SgpbEventListener.processCF7MailSent(popupId,options);}}}};SGPBPopup.varToBool=function(optionName) {var returnValue=optionName?true:false;return returnValue;};SGPBPopup.hexToRgba=function(hex,opacity) {var c;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){c=hex.substring(1).split('');if(c.length==3){c=[c[0],c[0],c[1],c[1],c[2],c[2]];} c='0x'+c.join('');return'rgba('+[(c>>16)&255,(c>>8)&255,c&255].join(',')+','+opacity+')';} throw new Error('Bad Hex');};SGPBPopup.prototype.contentCopyToClick=function() {var popupData=this.getPopupData();var popupId=this.getPopupId();var tempInputId='content-copy-to-click-'+popupId;var value=this.htmlDecode(popupData['sgpb-copy-to-clipboard-text']);var tempInput=document.createElement("input");tempInput.id=tempInputId;tempInput.value=value;tempInput.style='position: absolute; right: -10000px';if(!document.getElementById(tempInputId)){document.body.appendChild(tempInput);} tempInput.select();document.execCommand("copy");document.body.removeChild(tempInput);};SGPBPopup.prototype.htmlDecode=function(value) {return jQuery('