var VizuryNotificationObject=VizuryNotificationObject||{NotificationOpen:"true",IframeEle:null,IframeBottom:null,ContainerHtmlId:"vizury-notification-container",cookie:null,advid:null,ImpressionLogUrl:"://www.vizury.com/Impression?",TemplateId:null,flag:true,OnsiteBlurHtmlId:"vizury-notification-blur",OnsiteBlurEnabled:false,reset:function(){VizuryNotificationObject.NotificationOpen="true"},createDivElementLocal:function(a){VizuryNotificationObject.reset();VizuryNotificationObject.SetDivContent(a)},createDivElement:function(){var a=document.createElement("div");a.id=VizuryNotificationObject.ContainerHtmlId;document.body.appendChild(a);VizuryNotificationObject.makeAjaxCallStyle()},openTargetLink:function(c){var a=VizuryNotificationObject.ImpressionLogUrl+"click";VizuryNotificationObject.makeAjaxCall(a,"false");var b=window.open(c,"_blank");b.focus()},makeAjaxCallIE:function(b,a){xdr=new XDomainRequest();xdr.onload=function(){var c=xdr.responseText;if(c.length>0&&a==="true"){VizuryNotificationObject.SetDivContent(c)}};xdr.open("GET",b,true);xdr.send()},makeAjaxCall:function(b,a){var c;var d=window.XDomainRequest?true:false;if(d==true){VizuryNotificationObject.makeAjaxCallIE(b,a)}else{try{c=new XMLHttpRequest()}catch(f){try{c=new ActiveXObject("Msxml2.XMLHTTP")}catch(f){try{c=new ActiveXObject("Microsoft.XMLHTTP")}catch(f){return false}}}c.onreadystatechange=function(){if(c.readyState==4){var e=c.responseText;if(e.length>0&&a==="true"){VizuryNotificationObject.SetDivContent(e)}}};c.open("GET",b,true);c.withCredentials=true;c.send()}},getAdvid:function(){var a=pixel.detectCampaign();var b=a.substring(6,a.length);return b},getImpressionId:function(){var b=new Date().getUTCMilliseconds();var a=Math.floor(100000000+Math.random()*900000000);var c=VizuryNotificationObject.cookie+b.toString()+a.toString();return c},DetectUserAgent:function(){var c=navigator.userAgent,a;var b=c.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(b[1])){a=/\brv[ :]+(\d+)/g.exec(c)||[];return"IE"+(a[1]||"")}if(b[1]==="Chrome"){a=c.match(/\bOPR\/(\d+)/);if(a!=null){return"Opera"+a[1]}}b=b[2]?[b[1],b[2]]:[navigator.appName,navigator.appVersion,"-?"];if((a=c.match(/version\/(\d+)/i))!=null){b.splice(1,1,a[1])}return b[0]+b[1]},DetectMobileOrDesktop:function(){if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){return"Mobile"}else{return"Desktop"}},CreateLogUrl:function(){var b=encodeURIComponent(window.location.href);var a=("https:"==document.location.protocol?"https":"http");var c=VizuryNotificationObject.IframeEle.contentWindow.requestId;var d="DmpId="+c+"&Id="+VizuryNotificationObject.IframeEle.contentWindow.id+"&vizid="+VizuryNotificationObject.cookie+"&force_adv_id=VIZVRM"+VizuryNotificationObject.advid+"&segid="+VizuryNotificationObject.IframeEle.contentWindow.segid+"&channelid="+VizuryNotificationObject.IframeEle.contentWindow.channelid+"&url="+b+"&pos="+VizuryNotificationObject.IframeEle.contentWindow.position+"&UserAgent="+VizuryNotificationObject.DetectUserAgent()+"&action=";VizuryNotificationObject.ImpressionLogUrl=a+VizuryNotificationObject.ImpressionLogUrl+d},fetchAnalyzeParameters:function(){var b=["page","user","fp2","prod","pname","online","appno","leadid","subprod","src","dest","doj","rd","ad","ch","inf","PageName","FlightCabin","FlightType"];var a={};for(i in b){if(pixel.paramArray[b[i]]){a[b[i]]=pixel.paramArray[b[i]]}}a.deviceType=VizuryNotificationObject.DetectMobileOrDesktop();return encodeURIComponent(JSON.stringify(a))},makeAjaxCallStyle:function(){var a=encodeURIComponent(window.location.href);VizuryNotificationObject.cookie=pixel.getCookie("_vz");VizuryNotificationObject.advid=VizuryNotificationObject.getAdvid();var c=VizuryNotificationObject.fetchAnalyzeParameters();var b=("https:"==document.location.protocol?"https://www.vizury.com/":"http://www.vizury.com/")+"GetContent?vizid="+VizuryNotificationObject.cookie+"&force_adv_id=VIZVRM"+VizuryNotificationObject.advid+"&url="+a+"&analyze_params="+c;VizuryNotificationObject.makeAjaxCall(b,"true")},SetDivContent:function(b){var a=b.split("<delimiter>");var c=document.getElementById(VizuryNotificationObject.ContainerHtmlId);c.innerHTML=a[0];VizuryNotificationObject.SetIframeContent(a[1]);document.getElementById("vizury-notification-template").style.visibility="hidden";VizuryNotificationObject.CheckDeliveryWindow()},AdjustImageSize:function(){var a,b,e,d;if(VizuryNotificationObject.IframeEle.contentWindow.window.hasOwnProperty("BannerJson")){var f=VizuryNotificationObject.IframeEle.contentWindow.position;VizuryNotificationObject.IframeEle.contentDocument.getElementById("container-div").style.border="none";if(f===0||f===1){VizuryNotificationObject.IframeEle.style.bottom="0px"}else{if(f===2||f===3){VizuryNotificationObject.IframeEle.style.top="0px"}}var c=setInterval(function(){var h=null;var g=VizuryNotificationObject.IframeEle.contentDocument.getElementById("container-div");if(g&&g.innerHTML!==""){var k=VizuryNotificationObject.IframeEle.contentDocument.getElementsByClassName("product");k=k.length?k[0]:undefined;if(k){h=k.getElementsByTagName("img").length?k.getElementsByTagName("img")[0]:undefined}if(h){var j=new Image();j.onload=function(){VizuryNotificationObject.IframeEle.style.display="block";g.style.height=parseInt(k.offsetHeight).toString()+"px";g.style.width=parseInt(k.offsetWidth).toString()+"px";VizuryNotificationObject.IframeEle.style.height=(parseInt(k.offsetHeight)+26).toString()+"px";VizuryNotificationObject.IframeEle.style.width=(parseInt(k.offsetWidth)+21).toString()+"px";VizuryNotificationObject.IframeBottom="-"+(parseInt(k.offsetHeight)+26).toString()+"px";VizuryNotificationObject.IframeEle.contentDocument.getElementById("container-div").style.border="";document.getElementById("vizury-notification-template").style.visibility="visible"};j.src=h.src;clearInterval(c)}}},200)}else{var a=VizuryNotificationObject.IframeEle.contentWindow.height;var b=VizuryNotificationObject.IframeEle.contentWindow.width;var e=parseInt(a)+26;var d=parseInt(b)+21;VizuryNotificationObject.IframeEle.style.height=e.toString()+"px";VizuryNotificationObject.IframeEle.style.width=d.toString()+"px";VizuryNotificationObject.IframeBottom="-"+e.toString()+"px";var f=VizuryNotificationObject.IframeEle.contentWindow.position;if(f===0||f===1){VizuryNotificationObject.IframeEle.style.bottom=VizuryNotificationObject.IframeBottom}else{if(f===2||f===3){VizuryNotificationObject.IframeEle.style.top=VizuryNotificationObject.IframeBottom}}}},InitialPosition:function(){var a=VizuryNotificationObject.IframeEle.contentWindow.position;if(a===0||a===1){VizuryNotificationObject.IframeEle.style.bottom=VizuryNotificationObject.IframeBottom}else{if(a===2||a===3){VizuryNotificationObject.IframeEle.style.top=VizuryNotificationObject.IframeBottom}}},CloseOrMinimize:function(){var b=VizuryNotificationObject.IframeEle;var a=a||b.contentWindow.CloseOrMinimize;if(VizuryNotificationObject.IframeEle.contentWindow.position===4){b.contentDocument.getElementById("div-minimise").style.display="none";b.contentDocument.getElementById("div-close").style.display="block"}else{if(a===0){b.contentDocument.getElementById("div-minimise").style.display="none";b.contentDocument.getElementById("div-close").style.display="block"}else{if(a===1){b.contentDocument.getElementById("div-minimise").style.display="block";b.contentDocument.getElementById("div-close").style.display="none"}else{b.contentDocument.getElementById("div-minimise").style.right="30px"}}}},ShowMinimizeImageIcon:function(){var b=b||VizuryNotificationObject.IframeEle.contentWindow.position;var a=VizuryNotificationObject.GetAnchorText(b);parent.document.getElementById(a).style.visibility="visible"},transAnimationTopAndBottom:function(c,a,e,d){var b=setInterval(function(){c.style[a]=e+"px";if(d<0){e-=2;if(e<d){c.style[a]=d+"px";VizuryNotificationObject.ShowMinimizeImageIcon();clearInterval(b)}}else{e+=2;if(e>d){c.style[a]=d+"px";clearInterval(b)}}},1)},triggerNotiBottom:function(b,a){VizuryNotificationObject.transAnimationTopAndBottom(b,"bottom",a,0)},triggerNotiTop:function(b,a){VizuryNotificationObject.transAnimationTopAndBottom(b,"top",a,0)},AnimateDirectionHide:function(b,c,a){switch(c){case 0:case 1:VizuryNotificationObject.transAnimationTopAndBottom(b,"bottom",0,a);break;case 2:case 3:VizuryNotificationObject.transAnimationTopAndBottom(b,"top",0,a);break}},AnimateDirectionShow:function(b,c,a){switch(c){case 0:case 1:VizuryNotificationObject.transAnimationTopAndBottom(b,"bottom",a,0);break;case 2:case 3:VizuryNotificationObject.transAnimationTopAndBottom(b,"top",a,0);break}},GetAnchorText:function(b){var a;if(b==0||b==1){a="AnchorText-01"}else{a="AnchorText-23"}return a},Toggle:function(){var c=c||VizuryNotificationObject.IframeEle.contentWindow.position;var a=VizuryNotificationObject.GetAnchorText(c);if(VizuryNotificationObject.NotificationOpen=="true"){if(VizuryNotificationObject.TemplateId==2){if(c==0){VizuryNotificationObject.AnimateDirectionHide(document.getElementById("vizury-wrapper-div-element"),2,-50);document.getElementById("vizury-pulldown-div").style.height="0px";setTimeout(function(){VizuryNotificationObject.AnimateDirectionShow(document.getElementById("vizury-maximize-div"),2,-50)},1000)}else{VizuryNotificationObject.AnimateDirectionHide(document.getElementById("vizury-wrapper-div-element"),1,-50);document.getElementById("vizury-pullup-div").style.height="0px";setTimeout(function(){VizuryNotificationObject.AnimateDirectionShow(document.getElementById("vizury-maximize-div"),1,-50)},1000)}}else{VizuryNotificationObject.AnimateDirectionHide(VizuryNotificationObject.IframeEle,c,parseInt(VizuryNotificationObject.IframeBottom))}VizuryNotificationObject.NotificationOpen="false";var b="";if(VizuryNotificationObject.TemplateId==1){b=VizuryNotificationObject.ImpressionLogUrl+"minimize"}else{b=VizuryNotificationObject.IframeEle.contentWindow.window.config.impressionLogUrl+"minimize"}VizuryNotificationObject.makeAjaxCall(b,"false");VizuryNotificationObject.ToggleOnsiteBlur(false)}else{if(VizuryNotificationObject.TemplateId==2){if(c==0){VizuryNotificationObject.AnimateDirectionHide(document.getElementById("vizury-maximize-div"),2,-50);setTimeout(function(){VizuryNotificationObject.AnimateDirectionShow(document.getElementById("vizury-wrapper-div-element"),2,-50);document.getElementById("vizury-pulldown-div").style.height="50px"},1000)}else{VizuryNotificationObject.AnimateDirectionHide(document.getElementById("vizury-maximize-div"),1,-50);setTimeout(function(){VizuryNotificationObject.AnimateDirectionShow(document.getElementById("vizury-wrapper-div-element"),1,-50);document.getElementById("vizury-pullup-div").style.height="50px"},1000)}}else{VizuryNotificationObject.AnimateDirectionShow(VizuryNotificationObject.IframeEle,c,parseInt(VizuryNotificationObject.IframeBottom));document.getElementById(a).style.visibility="hidden"}VizuryNotificationObject.NotificationOpen="true";var b="";if(VizuryNotificationObject.TemplateId==1){b=VizuryNotificationObject.ImpressionLogUrl+"maximize"}else{b=VizuryNotificationObject.IframeEle.contentWindow.window.config.impressionLogUrl+"maximize"}VizuryNotificationObject.makeAjaxCall(b,"false");VizuryNotificationObject.ToggleOnsiteBlur(true)}},SetIframeContent:function(a){var b=document.getElementById("vizury-notification-template").contentWindow.document;b.open();b.write("<!DOCTYPE html>");b.write(a);b.close();VizuryNotificationObject.IframeEle=parent.document.getElementById("vizury-notification-template");VizuryNotificationObject.CreateLogUrl()},close:function(){document.getElementById("vizury-notification-template").style.display="none";var a="";if(VizuryNotificationObject.TemplateId==1){a=VizuryNotificationObject.ImpressionLogUrl+"close"}else{a=VizuryNotificationObject.IframeEle.contentWindow.window.config.impressionLogUrl+"close"}VizuryNotificationObject.makeAjaxCall(a,"false");VizuryNotificationObject.ToggleOnsiteBlur(false)},CheckDeliveryWindow:function(){var h=VizuryNotificationObject.IframeEle.contentWindow.From;var g=VizuryNotificationObject.IframeEle.contentWindow.To;var f=new Date();var a=f.getHours();var b=f.getMinutes();var e=h.split(":");var c=g.split(":");VizuryNotificationObject.IdentifyEvent()},CallImpressionLogger:function(){var a="";if(VizuryNotificationObject.TemplateId==1){a=VizuryNotificationObject.ImpressionLogUrl+"impression"}else{a=VizuryNotificationObject.IframeEle.contentWindow.window.config.impressionLogUrl+"impression"}VizuryNotificationObject.makeAjaxCall(a,"false")},CreateOnsiteBlurDiv:function(){if(VizuryNotificationObject.IframeEle.contentWindow.notificationBlur&&VizuryNotificationObject.IframeEle.contentWindow.notificationBlur.enabled==1&&VizuryNotificationObject.IframeEle.contentWindow.notificationBlur.color){VizuryNotificationObject.OnsiteBlurEnabled=true;var a=document.createElement("div");a.id=VizuryNotificationObject.OnsiteBlurHtmlId;document.getElementById("vizury-notification-container").appendChild(a);a.style="width: 100%; height: 100%; z-index: 199999970; position: fixed; top: 0; left: 0; opacity: 0.5";a.style.visibility="hidden";a.style.backgroundColor=VizuryNotificationObject.IframeEle.contentWindow.notificationBlur.color}},ToggleOnsiteBlur:function(b){if(VizuryNotificationObject.OnsiteBlurEnabled){var a=document.getElementById(VizuryNotificationObject.OnsiteBlurHtmlId);a.style.visibility=(b)?"visible":"hidden"}},IdentifyEvent:function(){VizuryNotificationObject.TemplateId=VizuryNotificationObject.IframeEle.contentWindow.Tid;var b=(VizuryNotificationObject.IframeEle.contentWindow.eventId)?VizuryNotificationObject.IframeEle.contentWindow.eventId:0;var a=VizuryNotificationObject.IframeEle.contentWindow.notifyTrigger;if(a){b=a.id;value=a.value}VizuryNotificationObject.CreateOnsiteBlurDiv();switch(b){case 0:VizuryNotificationObject.ExecuteEvent();break;case 1:VizuryNotificationObject.ExitEvent();break;case 2:VizuryNotificationObject.ExecuteEvent(value);break;case 3:VizuryNotificationObject.ScrollEvent(value);break;default:VizuryNotificationObject.ExecuteEvent();break}},PullPageDown:function(){var b=document.createElement("div");b.setAttribute("id","vizury-pulldown-div");b.style.height="50px";b.style.overflow="hidden";var a=document.getElementsByTagName("body")[0];a.insertBefore(b,a.firstChild)},PullPageUp:function(){var b=document.createElement("div");b.setAttribute("id","vizury-pullup-div");b.style.height="50px";b.style.overflow="hidden";var a=document.getElementsByTagName("body")[0];a.appendChild(b)},RenderStaticOnsiteNotification:function(a){VizuryNotificationObject.CloseOrMinimize();VizuryNotificationObject.AdjustImageSize();VizuryNotificationObject.InitialPosition();if(a===0||a===1){VizuryNotificationObject.triggerNotiBottom(VizuryNotificationObject.IframeEle,parseInt(VizuryNotificationObject.IframeBottom))}else{if(a===2||a===3){VizuryNotificationObject.triggerNotiTop(VizuryNotificationObject.IframeEle,parseInt(VizuryNotificationObject.IframeBottom))}}document.getElementById("vizury-notification-template").style.visibility="visible";VizuryNotificationObject.CallImpressionLogger()},ExecuteEvent:function(b){var a=b?b*1000:1;var d=d||VizuryNotificationObject.IframeEle.contentWindow.position;var c=VizuryNotificationObject.IframeEle.contentWindow.eventId;switch(VizuryNotificationObject.TemplateId){case 1:case 3:if(VizuryNotificationObject.IframeEle.contentWindow.isActive){setTimeout(function(){VizuryNotificationObject.RenderStaticOnsiteNotification(d);VizuryNotificationObject.ToggleOnsiteBlur(true)},a)}break;case 6:setTimeout(function(){VizuryNotificationObject.CloseOrMinimize();VizuryNotificationObject.AdjustImageSize();VizuryNotificationObject.ToggleOnsiteBlur(true);VizuryNotificationObject.CallImpressionLogger()},a);break;default:setTimeout(function(){VizuryNotificationObject.CloseOrMinimize();VizuryNotificationObject.AdjustImageSize();VizuryNotificationObject.ToggleOnsiteBlur(true);VizuryNotificationObject.CallImpressionLogger()},a);break}},ExitEvent:function(){var e=document.documentElement;e.addEventListener("mouseleave",b);e.addEventListener("keydown",c);function b(f){if(f.clientY>20){return}a()}var d=false;function c(f){if(d){return}else{if(!f.metaKey||f.keyCode!==76){return}}d=true;a()}function a(){if(VizuryNotificationObject.flag==true){VizuryNotificationObject.ExecuteEvent();VizuryNotificationObject.flag=false}}},ScrollEvent:function(c){function b(h,f,g){if(h.addEventListener){h.addEventListener(f,g,false)}else{if(h.attachEvent){h.attachEvent("on"+f,g)}}}function e(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0}function a(){return window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop||0}function d(){return Math.max(document.body.scrollHeight||0,document.documentElement.scrollHeight||0,document.body.offsetHeight||0,document.documentElement.offsetHeight||0,document.body.clientHeight||0,document.documentElement.clientHeight||0)}b(window,"scroll",function(g){var f=((a()+e())/d())*100;if(f>c&&VizuryNotificationObject.flag==true){VizuryNotificationObject.ExecuteEvent();VizuryNotificationObject.flag=false}})}};


