function VoviciWebInterceptSurvey(){
this.utils=new VoviciSurveyUtils();
this.SurveyUrl="";
this.ExitSurveyUrl="";
this.ShoppingCartAbandonmentSurveyUrl="";
this.ShoppingCartCompletedSurveyUrl="";
this.FailoverToLayerWhenPopupsBlocked=false;
this.ShoppingCartCookieName="";
this.ShoppingCartRegex="";
this.PurchaseMadeCookieName="";
this.PurchaseMadeRegex="";
this.WatcherJavascriptUrl="https://clarahost.clara.net/websurvey.spa-mr.com/CZ/VoviciSurveyInvite.js";
this.NthVisitorToInvite=1;
this.SurveyInNewWindow=false;
this.SurveyWindowWidth=625;
this.SurveyWindowHeight=400;
this.SurveyWindowLeftOffset=200;
this.SurveyWindowTopOffset=100;
this.SurveyWindowDecorationOptions="scrollbars=yes, resizable=true, location=no, toolbar=no, menubar=no";
this.SurveyWindowName="VoviciSurvey";
this.CookieDomain="";
this.CookieValue="1";
this.CookieDuration="";
this.CookiePath="/";
this.CookieName="VOVICI_SURVEY_INVITE";
this.LaunchExitSurveyCookieValue="2";
this.InviteStyle="popup";
this.SurveyPrompt="We'd like your input! Please take a few moments to complete a brief survey.";
this.SurveyPromptDivInnerHtml="<map name=\"VoviciSurveyPromptMap\">"+"<area id=\"VoviciSurveyPromptYesButton\" shape=\"rect\" coords=\"65,125,225,175\" >"+"<area id=\"VoviciSurveyPromptNoButton\" shape=\"rect\" coords=\"340,125,500,175\" >"+"<area shape=\"default\" nohref>"+"</map><img src=\"surveyinvite1.gif\" border=\"0\" usemap=\"#VoviciSurveyPromptMap\">";
this.SurveyPromptDivYesButtonId="VoviciSurveyPromptYesButton";
this.SurveyPromptDivNoButtonId="VoviciSurveyPromptNoButton";
this.SurveyPromptDivWidth=575;
this.SurveyPromptDivHeight=179;
this.SurveyPromptDivLeftOffset=200;
this.SurveyPromptDivTopOffset=100;
this.SurveyFrameName="VoviciSurveyFrameOuterDiv";
this.SurveyInnerFrameName="VoviciSurveyFrameInnerDiv";
this.SurveyDisplayFrameInnerHtml="<div id=\""+this.SurveyFrameName+"\" style=\"background-color:#FFFFFF;border: 1px solid #E2E5E7;\">"+"  <div id=\""+this.SurveyPromptDivNoButtonId+"\" style=\"text-align:right; color: red\">[x]</div>"+"<div id=\""+this.SurveyInnerFrameName+"\" ></div>"+"</div>";
this.URLParameters=new Array();
this.SurveyPromptDivName="VoviciSurveyInvite_Prompt";
this.div;
this.toString=function(){
return "VoviciWebInterceptSurvey internal state:"+"\n\tDebuggingEnabled: "+this.utils.DebuggingEnabled+"\n\tSurveyUrl: "+this.GetSurveyUrl()+"\n\tNthVisitorToInvite: "+this.NthVisitorToInvite+"\n\tInviteStyle: "+survey.InviteStyle+"\n"+"\n\tSurveyPrompt: "+this.SurveyPrompt+"\n\tSurveyPromptDivName: "+this.SurveyPromptDivName+"\n\tSurveyPromptDivInnerHtml: "+this.SurveyPromptDivInnerHtml+"\n\tSurveyPromptDivYesButtonId: "+this.SurveyPromptDivYesButtonId+"\n\tSurveyPromptDivNoButtonId: "+this.SurveyPromptDivNoButtonId+"\n\tSurveyPromptDivWidth: "+this.SurveyPromptDivWidth+"\n\tSurveyPromptDivHeight: "+this.SurveyPromptDivHeight+"\n\tSurveyPromptDivLeftOffset: "+this.SurveyPromptDivLeftOffset+"\n\tSurveyPromptDivTopOffset: "+this.SurveyPromptDivTopOffset+"\n"+"\n\tSurveyInNewWindow: "+this.SurveyInNewWindow+"\n\tSurveyWindowWidth: "+this.SurveyWindowWidth+"\n\tSurveyWindowHeight: "+this.SurveyWindowHeight+"\n\tSurveyWindowLeftOffset: "+this.SurveyWindowLeftOffset+"\n\tSurveyWindowTopOffset: "+this.SurveyWindowTopOffset+"\n\tSurveyWindowDecorationOptions: "+this.SurveyWindowDecorationOptions+"\n\tSurveyWindowName: "+this.SurveyWindowName+"\n"+"\n\tSurveyFrameName: "+this.SurveyFrameName+"\n\tSurveyInnerFrameName: "+this.SurveyInnerFrameName+"\n\tSurveyDisplayFrameInnerHtml : "+this.SurveyDisplayFrameInnerHtml+"\n"+"\n\tCookieDomain: "+this.CookieDomain+"\n\tCookieName: "+this.CookieName+"\n\tCookieValue: "+this.CookieValue+"\n\tCookiePath: "+this.CookiePath+"\n\tCookieDuration: "+this.CookieDuration+"\n\nCookies:\n\n"+"\n\t"+this.CookieName+": "+this.utils.GetCookie(this.CookieName)+"\n"+"\n\tLaunchExitSurvey: "+this.LaunchExitSurvey()+"\n\tFailoverToLayerWhenPopupsBlocked: "+this.FailoverToLayerWhenPopupsBlocked+"\n\tExitSurveyUrl: "+this.GetExitSurveyUrl()+"\n\tShoppingCartAbandonmentSurveyUrl: "+this.GetShoppingCartAbandonmentSurveyUrl()+"\n\tShoppingCartCompletedSurveyUrl: "+this.GetShoppingCartCompletedSurveyUrl()+"\n\tShoppingCartCookieName: "+this.ShoppingCartCookieName+"\n\tShoppingCartRegex: "+this.ShoppingCartRegex+"\n\tPurchaseMadeCookieName: "+this.PurchaseMadeCookieName+"\n\tPurchaseMadeRegex: "+this.PurchaseMadeRegex+"\n\tWatcherJavascriptUrl: "+this.WatcherJavascriptUrl;
};
this.DebuggingEnabled=function(_1){
this.utils.DebuggingEnabled=_1;
};
this.Load=function(){
var _2=this;
this.utils.DebugLog("Adding window.onload handler for Web Intercept Survey Load");
this.utils.AddEvent(window,"load",function(){
_2.CheckForInvite();
});
};
this.TestLoad=function(){
var _3=this;
this.utils.AddEvent(window,"load",function(){
_3.YesButtonClicked();
});
};
this.CheckForInvite=function(){
if(this.utils.GetCookie(this.CookieName)==this.LaunchExitSurveyCookieValue){
if(this.LaunchExitSurvey()){
this.ExitSurvey();
}
}else{
if(this.utils.GetCookie(this.CookieName)!=this.CookieValue){
this.utils.SetCookie(this.CookieName,this.CookieValue,this.CookieDomain,this.CookieDuration,this.CookiePath);
if(this.utils.GetRandom(this.NthVisitorToInvite)==this.NthVisitorToInvite){
this.Invite();
}
}
}
};
this.Invite=function(){
if(this.InviteStyle=="popup"){
if(confirm(this.SurveyPrompt)){
this.YesButtonClicked();
}
}else{
this.Create(this.SurveyPromptDivName,this.SurveyPromptDivInnerHtml,this.SurveyPromptDivYesButtonId,this.SurveyPromptDivNoButtonId,this.SurveyPromptDivWidth,this.SurveyPromptDivHeight,this.SurveyPromptDivLeftOffset,this.SurveyPromptDivTopOffset);
}
};
this.Create=function(id,_4,_5,_6,_7,_8,_9,_a){
this.utils.DebugLog("VoviciWebInterceptSurvey.Create");
var _b="VoviciSurveyPromptContainer_"+id;
this.SurveyPromptDivName=id;
var _c=document.createElement("div");
_c.style.display="none";
_c.setAttribute("id",_b);
_c.setAttribute("name",_b);
_c.innerHTML=_4;
document.body.appendChild(_c);
this.div=document.getElementById(this.SurveyPromptDivName);
this.div.style.width=_7?_7:575;
this.div.style.height=_8?_8:179;
if((_9||_a)||(_9&&_a)){
this.div.style.position="absolute";
this.div.style.left=_9?_9:200;
this.div.style.top=_a?_a:200;
}
var _d=this;
if(_5){
var _e=document.getElementById(_5);
if(_e){
this.utils.AddEvent(_e,"click",function(){
_d.YesButtonClicked();
});
}
}
if(_6){
var no=document.getElementById(_6);
if(no){
this.utils.AddEvent(no,"click",function(){
_d.NoButtonClicked();
});
}
}
_c.style.display="block";
};
this.YesButtonClicked=function(){
this.Hide();
if(this.LaunchExitSurvey()){
this.utils.SetCookie(this.CookieName,this.CookieValue,this.CookieDomain,this.CookieDuration,this.CookiePath);
this.ExitSurvey();
}else{
if(this.SurveyInNewWindow){
var _f="width="+this.SurveyWindowWidth+",height="+this.SurveyWindowHeight+","+"top="+this.SurveyWindowTopOffset+",left="+this.SurveyWindowLeftOffset+","+this.SurveyWindowDecorationOptions;
var _10=window.open(this.GetSurveyUrl(),this.SurveyWindowName,_f);
_10.focus();
}else{
window.location=this.GetSurveyUrl();
}
}
return false;
};
this.ExitSurvey=function(){
var _11=new VoviciExitSurvey();
_11.CookieDomain=this.CookieDomain;
_11.CookieValue=this.CookieValue;
_11.CookieDuration=this.CookieDuration;
_11.CookiePath=this.CookiePath;
_11.ShoppingCartCookieName=this.ShoppingCartCookieName;
_11.ShoppingCartRegex=this.ShoppingCartRegex;
_11.PurchaseMadeCookieName=this.PurchaseMadeCookieName;
_11.PurchaseMadeRegex=this.PurchaseMadeRegex;
_11.PromptToTakeTheSurvey=false;
_11.WatcherJavascriptUrl=this.WatcherJavascriptUrl;
_11.ExitSurveyUrl=this.ExitSurveyUrl;
_11.ShoppingCartAbandonmentSurveyUrl=this.ShoppingCartAbandonmentSurveyUrl;
_11.ShoppingCartCompletedSurveyUrl=this.ShoppingCartCompletedSurveyUrl;
_11.FailoverToLayerWhenPopupsBlocked=this.FailoverToLayerWhenPopupsBlocked;
_11.URLParameters=this.URLParameters;
_11.SurveyWindowWidth=this.SurveyWindowWidth;
_11.SurveyWindowHeight=this.SurveyWindowHeight;
_11.SurveyWindowLeftOffset=this.SurveyWindowLeftOffset;
_11.SurveyWindowTopOffset=this.SurveyWindowTopOffset;
_11.SurveyWindowDecorationOptions=this.SurveyWindowDecorationOptions;
_11.SurveyFrameName=this.SurveyFrameName;
_11.SurveyInnerFrameName=this.SurveyInnerFrameName;
_11.SurveyDisplayFrameInnerHtml=this.SurveyDisplayFrameInnerHtml;
_11.DebuggingEnabled(this.utils.DebuggingEnabled);
_11.SetupWatcher();
return false;
};
this.NoButtonClicked=function(){
this.utils.SetCookie(this.CookieName,this.CookieValue,this.CookieDomain,this.CookieDuration,this.CookiePath);
this.Hide();
return false;
};
this.Hide=function(){
if(this.div){
this.div.style.display="none";
}
};
this.Show=function(){
if(this.div){
this.div.style.display="block";
}
};
this.GetSurveyUrl=function(){
return this.SurveyUrl;
};
this.GetExitSurveyUrl=function(){
return this.utils.AddUrlParameters(this.ExitSurveyUrl,this.URLParameters);
};
this.GetShoppingCartAbandonmentSurveyUrl=function(){
return this.utils.AddUrlParameters(this.ShoppingCartAbandonmentSurveyUrl,this.URLParameters);
};
this.GetShoppingCartCompletedSurveyUrl=function(){
return this.utils.AddUrlParameters(this.ShoppingCartCompletedSurveyUrl,this.URLParameters);
};
this.AddUrlParameter=function(_12,val){
this.URLParameters[_12]=val;
};
this.LaunchExitSurvey=function(){
return this.ExitSurveyUrl!=""||this.ShoppingCartAbandonmentSurveyUrl!=""||this.ShoppingCartCompletedSurveyUrl!="";
};
};
function VoviciExitSurvey(){
this.utils=new VoviciSurveyUtils();
this.WatcherJavascriptUrl="https://clarahost.clara.net/websurvey.spa-mr.com/CZ/VoviciSurveyInvite.js";
this.ExitSurveyUrl="";
this.ShoppingCartAbandonmentSurveyUrl="";
this.ShoppingCartCompletedSurveyUrl="";
this.FailoverToLayerWhenPopupsBlocked=false;
this.NthVisitorToInvite=1;
this.SurveyInNewWindow=false;
this.SurveyWindowWidth=625;
this.SurveyWindowHeight=400;
this.SurveyWindowLeftOffset=200;
this.SurveyWindowTopOffset=100;
this.SurveyWindowDecorationOptions="scrollbars=yes, resizable=true, location=no, toolbar=no, menubar=no";
this.SurveyWindowName="VoviciExitSurvey";
this.CookieDomain="";
this.CookieValue="1";
this.CookieDuration="1440";
this.CookiePath="/";
this.CookieName="VOVICI_EXIT_SURVEY_INVITE";
this.ShoppingCartCookieName="";
this.ShoppingCartRegex="";
this.PurchaseMadeCookieName="";
this.PurchaseMadeRegex="";
this.PromptToTakeTheSurvey=true;
this.InviteStyle="popup";
this.SurveyPrompt="We'd like your input! Please take a few moments to complete a brief survey.";
this.SurveyPromptDivInnerHtml="<map name=\"VoviciSurveyPromptMap\">"+"<area id=\"VoviciSurveyPromptYesButton\" shape=\"rect\" coords=\"65,125,225,175\" >"+"<area id=\"VoviciSurveyPromptNoButton\" shape=\"rect\" coords=\"340,125,500,175\" >"+"<area shape=\"default\" nohref>"+"</map><img src=\"surveyinvite1.gif\" border=\"0\" usemap=\"#VoviciSurveyPromptMap\">";
this.SurveyPromptDivYesButtonId="VoviciSurveyPromptYesButton";
this.SurveyPromptDivNoButtonId="VoviciSurveyPromptNoButton";
this.SurveyPromptDivWidth=575;
this.SurveyPromptDivHeight=179;
this.SurveyPromptDivLeftOffset=200;
this.SurveyPromptDivTopOffset=100;
this.WatcherMessageDivName="VoviciWatcherMessage";
this.WatcherMessage="<div style=\"height:100px;text-align:left;padding-left:3px; font: bold 14px arial, helvetica, sans-serif; color:E20074;\">Anketa n&aacute;v&#353;t&#283;vn&iacute;k&#367; T-Mobile se objev&iacute; v tomto okn&#283;, jakmile webovou str&aacute;nku opust&iacute;te. Nezav&iacute;rejte pros&iacute;m toto okno, chcete-li se ankety z&uacute;&#269;astnit.</div>";
this.SurveyFrameName="VoviciSurveyFrameOuterDiv";
this.SurveyInnerFrameName="VoviciSurveyFrameInnerDiv";
this.SurveyDisplayFrameInnerHtml="<div id=\""+this.SurveyFrameName+"\" style=\"background-color:#FFFFFF;border: 1px solid #E2E5E7;\">"+"  <div id=\""+this.SurveyPromptDivNoButtonId+"\" style=\"text-align:right; color: red\">[x]</div>"+"<div id=\""+this.SurveyInnerFrameName+"\" ></div>"+"</div>";
this.SurveyPromptDivName="VoviciExitSurveyInvite_Prompt";
this.TimerInterval=new Number(1000);
this.TimerId;
this.Watcher;
this.WatcherWindowName="VoviciExitSurveyWatcher";
this.WatcherWindowDecorationOptions="scrollbars=no, resizable=true, location=no, toolbar=no, menubar=no";
this.URLParameters=new Array();
};
VoviciExitSurvey.prototype.DebuggingEnabled=function(_13){
this.utils.DebuggingEnabled=_13;
};
VoviciExitSurvey.prototype.toString=function(){
return "VoviciExitSurvey internal state:"+"\n\tDebuggingEnabled: "+this.utils.DebuggingEnabled+"\n\tFailoverToLayerWhenPopupsBlocked: "+this.FailoverToLayerWhenPopupsBlocked+"\n\tExitSurveyUrl: "+this.GetExitSurveyUrl()+"\n\tShoppingCartAbandonmentSurveyUrl: "+this.GetShoppingCartAbandonmentSurveyUrl()+"\n\tShoppingCartCompletedSurveyUrl: "+this.GetShoppingCartCompletedSurveyUrl()+"\n\tNthVisitorToInvite: "+this.NthVisitorToInvite+"\n"+"\n\tInviteStyle: "+this.InviteStyle+"\n\tPromptToTakeTheSurvey: "+this.PromptToTakeTheSurvey+"\n\tSurveyPrompt: "+this.SurveyPrompt+"\n\tSurveyPromptDivName: "+this.SurveyPromptDivName+"\n\tSurveyPromptDivInnerHtml: "+this.SurveyPromptDivInnerHtml+"\n\tSurveyPromptDivYesButtonId: "+this.SurveyPromptDivYesButtonId+"\n\tSurveyPromptDivNoButtonId: "+this.SurveyPromptDivNoButtonId+"\n\tSurveyPromptDivWidth: "+this.SurveyPromptDivWidth+"\n\tSurveyPromptDivHeight: "+this.SurveyPromptDivHeight+"\n\tSurveyPromptDivLeftOffset: "+this.SurveyPromptDivLeftOffset+"\n\tSurveyPromptDivTopOffset: "+this.SurveyPromptDivTopOffset+"\n"+"\n\tSurveyInNewWindow: "+this.SurveyInNewWindow+"\n\tSurveyWindowWidth: "+this.SurveyWindowWidth+"\n\tSurveyWindowHeight: "+this.SurveyWindowHeight+"\n\tSurveyWindowLeftOffset: "+this.SurveyWindowLeftOffset+"\n\tSurveyWindowTopOffset: "+this.SurveyWindowTopOffset+"\n\tSurveyWindowDecorationOptions: "+this.SurveyWindowDecorationOptions+"\n\tSurveyWindowName: "+this.SurveyWindowName+"\n"+"\n\tSurveyFrameName: "+this.SurveyFrameName+"\n\tSurveyInnerFrameName: "+this.SurveyInnerFrameName+"\n\tSurveyDisplayFrameInnerHtml : "+this.SurveyDisplayFrameInnerHtml+"\n"+"\n\tTimerInterval: "+this.TimerInterval+"\n"+"\n\tCookieDomain: "+this.CookieDomain+"\n\tCookieName: "+this.CookieName+"\n\tCookieValue: "+this.CookieValue+"\n\tCookiePath: "+this.CookiePath+"\n\tCookieDuration: "+this.CookieDuration+"\n\nCookies:\n\n"+"\n\t"+this.CookieName+": "+this.utils.GetCookie(this.CookieName);
};
VoviciExitSurvey.prototype.GetExitSurveyUrl=function(){
return this.utils.AddUrlParameters(this.ExitSurveyUrl,this.URLParameters);
};
VoviciExitSurvey.prototype.GetShoppingCartAbandonmentSurveyUrl=function(){
return this.utils.AddUrlParameters(this.ShoppingCartAbandonmentSurveyUrl,this.URLParameters);
};
VoviciExitSurvey.prototype.GetShoppingCartCompletedSurveyUrl=function(){
return this.utils.AddUrlParameters(this.ShoppingCartCompletedSurveyUrl,this.URLParameters);
};
VoviciExitSurvey.prototype.AddUrlParameter=function(_14,val){
this.URLParameters[_14]=val;
};
VoviciExitSurvey.prototype.Load=function(){
var _15=this;
this.utils.DebugLog("Adding window.onload handler for SetupWatcher");
this.utils.AddEvent(window,"load",function(){
_15.SetupWatcher();
});
};
VoviciExitSurvey.prototype.SetupWatcher=function(){
this.utils.DebugLog("SetupWatcher starting..");
var _16=new Boolean(false);
var _17=new Boolean(false);
this.WatcherLaunch();
this.Check(_16,_17);
var _18=this;
this.utils.DebugLog("Setting timer for Check at interval "+this.TimerInterval);
this.TimerId=setInterval(function(){
_18.Check(_16,_17);
},this.TimerInterval);
};
VoviciExitSurvey.prototype.WatcherLaunch=function(){
var _19=this.utils.GetCookie(this.CookieName);
this.utils.DebugLog("WatcherLaunch: "+_19);
var _1a=new Boolean(true);
var _1b=new Boolean(true);
if(!_19||_19==""){
this.Check(_1a,_1b);
this.utils.DebugLog("Opening watcher window");
var _1c=(document.all)?window.screenLeft:window.screenX;
var top=(document.all)?window.screenTop:window.screenY;
var _1d=300;
var _1e=50;
var _1f="width="+_1d+",height="+_1e+","+"top="+top+",left="+_1c+","+this.WatcherWindowDecorationOptions;
var _20=window.open("",this.WatcherWindowName,_1f);
if(_20){
this.Watcher=_20;
var _21="";
for(var key in this.URLParameters){
_21+="  \twatcher.AddUrlParameter('"+key+"', '"+this.URLParameters[key]+"');\n";
}
this.Watcher.document.write("<html><head><title>Vovici Exit Survey Watcher</title>\n"+"<script type='text/javascript' language='javascript' src='"+this.WatcherJavascriptUrl+"'></script>\n"+"<script type='text/javascript' language='javascript'>\n"+"<!--\n"+"function LoadWatcher() {\n"+"  var watcher = new VoviciSurveyWatcher();\n"+"  watcher.DebuggingEnabled('"+this.utils.DebuggingEnabled+"');\n"+"  watcher.ExitSurveyUrl ='"+this.ExitSurveyUrl+"';\n"+"  watcher.ShoppingCartAbandonmentSurveyUrl ='"+this.ShoppingCartAbandonmentSurveyUrl+"';\n"+"  watcher.ShoppingCartCompletedSurveyUrl ='"+this.ShoppingCartCompletedSurveyUrl+"';\n"+_21+"  watcher.ShoppingCartCookieName ='"+this.ShoppingCartCookieName+"';\n"+"  watcher.ShoppingCartRegex ='"+this.ShoppingCartRegex+"';\n"+"  watcher.PurchaseMadeCookieName ='"+this.PurchaseMadeCookieName+"';\n"+"  watcher.PurchaseMadeRegex ='"+this.PurchaseMadeRegex+"';\n"+"  watcher.PromptToTakeTheSurvey = "+this.PromptToTakeTheSurvey+";\n"+"  watcher.WatcherMessageDivName='"+this.WatcherMessageDivName+"';\n"+"  watcher.SurveyPromptDivName='"+this.SurveyPromptDivName+"';\n"+"  watcher.SurveyPromptDivYesButtonId='"+this.SurveyPromptDivYesButtonId+"';\n"+"  watcher.SurveyPromptDivNoButtonId='"+this.SurveyPromptDivNoButtonId+"';\n"+"  watcher.SurveyPromptDivWidth= "+this.SurveyPromptDivWidth+";\n"+"  watcher.SurveyPromptDivHeight= "+this.SurveyPromptDivHeight+";\n"+"  watcher.SurveyPromptDivLeftOffset= "+this.SurveyPromptDivLeftOffset+";\n"+"  watcher.SurveyPromptDivTopOffset= "+this.SurveyPromptDivTopOffset+";\n"+"  watcher.SurveyWindowWidth= "+this.SurveyWindowWidth+";\n"+"  watcher.SurveyWindowHeight= "+this.SurveyWindowHeight+";\n"+"  watcher.SurveyWindowLeftOffset= "+this.SurveyWindowLeftOffset+";\n"+"  watcher.SurveyWindowTopOffset= "+this.SurveyWindowTopOffset+";\n"+"  watcher.WatcherLoad();\n"+"}\n"+"// -->\n"+"</script>\n</head>\n<body onload='LoadWatcher()'>\n"+"<div id='"+this.SurveyPromptDivName+"' style='display:none'>"+this.SurveyPromptDivInnerHtml+"</div>\n<div id='"+this.WatcherMessageDivName+"'>"+this.WatcherMessage+"</div>\n"+"</body>\n</html>");
this.Watcher.document.close();
if(!this.Watcher.opener){
this.Watcher.opener=self;
}
if(!this.TimerId){
var _22=this;
this.TimerId=setInterval(function(){
_22.Check(_1a,_1b);
},this.TimerInterval);
}
}else{
if(this.FailoverToLayerWhenPopupsBlocked){
var _23=new VoviciSurveyWatcher();
_23.IsAPopup=false;
_23.DebuggingEnabled(this.utils.DebuggingEnabled);
_23.ExitSurveyUrl=this.ExitSurveyUrl;
_23.ShoppingCartAbandonmentSurveyUrl=this.ShoppingCartAbandonmentSurveyUrl;
_23.ShoppingCartCompletedSurveyUrl=this.ShoppingCartCompletedSurveyUrl;
_23.URLParameters=this.URLParameters;
_23.ShoppingCartCookieName=this.ShoppingCartCookieName;
_23.ShoppingCartRegex=this.ShoppingCartRegex;
_23.PurchaseMadeCookieName=this.PurchaseMadeCookieName;
_23.PurchaseMadeRegex=this.PurchaseMadeRegex;
_23.PromptToTakeTheSurvey=this.PromptToTakeTheSurvey;
_23.WatcherMessageDivName=this.WatcherMessageDivName;
_23.SurveyPromptDivName=this.SurveyPromptDivName;
_23.SurveyPromptDivYesButtonId=this.SurveyPromptDivYesButtonId;
_23.SurveyPromptDivNoButtonId=this.SurveyPromptDivNoButtonId;
_23.SurveyPromptDivWidth=this.SurveyPromptDivWidth;
_23.SurveyPromptDivHeight=this.SurveyPromptDivHeight;
_23.SurveyPromptDivLeftOffset=this.SurveyPromptDivLeftOffset;
_23.SurveyPromptDivTopOffset=this.SurveyPromptDivTopOffset;
_23.SurveyWindowWidth=this.SurveyWindowWidth;
_23.SurveyWindowHeight=this.SurveyWindowHeight;
_23.SurveyWindowLeftOffset=this.SurveyWindowLeftOffset;
_23.SurveyWindowTopOffset=this.SurveyWindowTopOffset;
_23.SurveyFrameName=this.SurveyFrameName;
_23.SurveyInnerFrameName=this.SurveyInnerFrameName;
_23.SurveyDisplayFrameInnerHtml=this.SurveyDisplayFrameInnerHtml;
_23.Activate();
}
}
}else{
this.Test(true);
}
};
VoviciExitSurvey.prototype.ChangeLinks=function(){
this.utils.DebugLog("ExitSurveyChangeLinks..");
var _24=document.getElementsByTagName("a");
var _25=this;
for(var i=0;i<_24.length;i++){
if(_24[i].href!=""){
this.utils.DebugLog("Adding ExitSurveyWatcherLaunch to link to "+_24[i].href);
var obj=_24[i];
_24[i].onclick=function(){
_25.ExitSurveyWatcherLaunch();
};
}
}
};
VoviciExitSurvey.prototype.Check=function(_26,_27){
if(_26==false){
if(this.utils.GetCookie(this.CookieName)!=""){
this.Update();
return null;
}
}else{
if(_27==true){
this.Update();
return null;
}else{
if(this.utils.GetCookie(this.CookieName)!=""){
this.Update();
return null;
}else{
this.Clear();
return null;
}
}
}
};
VoviciExitSurvey.prototype.Update=function(){
this.utils.SetCookie(this.CookieName,Date(),this.CookieDomain,this.CookieDuration,this.CookiePath);
};
VoviciExitSurvey.prototype.CheckCookie=function(_28){
strDate=this.utils.GetCookie(_28);
if(strDate!=null&&strDate!=""){
return true;
}else{
return false;
}
};
VoviciExitSurvey.prototype.Clear=function(){
if(this.TimerId){
clearTimeout(this.TimerId);
}
if(this.utils.GetCookie(this.CookieName)!=""){
this.utils.DeleteCookie(this.CookieName);
}
return null;
};
VoviciExitSurvey.prototype.Test=function(_29){
var _2a=this.utils.GetCookie(this.CookieName);
if(_29==false){
if(_2a!=""){
this.utils.DebugLog("ExitSurveyTest: "+_2a);
}
}else{
this.utils.DebugLog("Watcher Window already launched! Close the watcher window and try again!");
}
};
function VoviciSurveyWatcher(){
this.utils=new VoviciSurveyUtils();
this.CookieName="VOVICI_EXIT_SURVEY_INVITE";
this.PromptToTakeTheSurvey=true;
this.ExitSurveyUrl="";
this.ShoppingCartAbandonmentSurveyUrl="";
this.ShoppingCartCompletedSurveyUrl="";
this.ShoppingCartCookieName="";
this.ShoppingCartRegex="";
this.PurchaseMadeCookieName="";
this.PurchaseMadeRegex="";
this.SurveyUrl="";
this.SurveyPromptDivName="VoviciSurveyInvite_Prompt";
this.SurveyPromptDivYesButtonId="VoviciSurveyPromptYesButton";
this.SurveyPromptDivNoButtonId="VoviciSurveyPromptNoButton";
this.WatcherMessageDivName="VoviciWatcherMessage";
this.SurveyPromptDivWidth=575;
this.SurveyPromptDivHeight=179;
this.SurveyPromptDivLeftOffset=200;
this.SurveyPromptDivTopOffset=100;
this.SurveyWindowWidth=400;
this.SurveyWindowHeight=600;
this.SurveyWindowLeftOffset=100;
this.SurveyWindowTopOffset=100;
this.SurveyFrameName="VoviciSurveyFrameOuterDiv";
this.SurveyInnerFrameName="VoviciSurveyFrameInnerDiv";
this.SurveyDisplayFrameInnerHtml="<div id=\""+this.SurveyFrameName+"\" style=\"background-color:#FFFFFF;border: 1px solid #E2E5E7;\">"+"  <div id=\""+this.SurveyPromptDivNoButtonId+"\" style=\"text-align:right; color: red\">[x]</div>"+"<div id=\""+this.SurveyInnerFrameName+"\" ></div>"+"</div>";
this.TimerId;
this.TimerInterval=new Number(8000);
this.IsAPopup=true;
this.IFrameObj;
this.URLParameters=new Array();
};
VoviciSurveyWatcher.prototype.DebuggingEnabled=function(_2b){
this.utils.DebuggingEnabled=_2b;
};
VoviciSurveyWatcher.prototype.Load=function(){
this.utils.AddEvent(window,"load",function(){
watcher.WatcherLoad();
});
};
VoviciSurveyWatcher.prototype.WatcherLoad=function(){
this.utils.DebugLog("Load");
self.blur();
var _2c=this;
this.utils.AddEvent(window,"unload",function(){
_2c.Unload();
});
_2c.StartChecking();
};
VoviciSurveyWatcher.prototype.StartChecking=function(){
this.utils.DebugLog("StartChecking");
this.Blur();
this.Clear();
this.CheckCondition();
var _2d=this;
this.TimerId=setInterval(function(){
_2d.CheckCondition();
},this.TimerInterval);
};
VoviciSurveyWatcher.prototype.Unload=function(){
this.utils.DebugLog("Unload");
this.Clear();
window.self.focus();
this.utils.DeleteCookie(this.CookieName);
};
VoviciSurveyWatcher.prototype.Blur=function(){
this.utils.DebugLog("Blur");
if(!this.utils.DebuggingEnabled){
window.self.blur();
}
};
VoviciSurveyWatcher.prototype.CheckCondition=function(){
this.utils.DebugLog("CheckCondition");
var _2e=new Date();
var _2f;
var _30;
var _31=this.utils.GetCookie(this.CookieName);
var _32=new Number(-1);
if(_31!=""){
_2f=new Date(_31);
_30=new Date();
_30.setDate(_2e.getDate());
_30=new Date(_30.toGMTString());
_32=_30-_2f;
this.Hide();
this.Test();
}else{
this.Clear();
this.Activate();
return null;
}
if((_32==-1)||(_32>=this.TimerInterval)){
this.Clear();
this.Activate();
return null;
}
};
VoviciSurveyWatcher.prototype.Clear=function(){
if(this.TimerId){
clearTimeout(this.TimerId);
}
return null;
};
VoviciSurveyWatcher.prototype.Hide=function(){
this.Blur();
};
VoviciSurveyWatcher.prototype.GetExitSurveyUrl=function(){
return this.utils.AddUrlParameters(this.ExitSurveyUrl,this.URLParameters);
};
VoviciSurveyWatcher.prototype.GetShoppingCartAbandonmentSurveyUrl=function(){
return this.utils.AddUrlParameters(this.ShoppingCartAbandonmentSurveyUrl,this.URLParameters);
};
VoviciSurveyWatcher.prototype.GetShoppingCartCompletedSurveyUrl=function(){
return this.utils.AddUrlParameters(this.ShoppingCartCompletedSurveyUrl,this.URLParameters);
};
VoviciSurveyWatcher.prototype.AddUrlParameter=function(_33,val){
this.URLParameters[_33]=val;
};
VoviciSurveyWatcher.prototype.Activate=function(){
this.utils.DeleteCookie(this.CookieName);
if(!this.IsAPopup){
window.focus();
}
var _34=document.getElementById(this.WatcherMessageDivName);
if(_34){
_34.style.display="none";
}
if(this.PromptToTakeTheSurvey){
try{
window.resizeTo(this.SurveyPromptDivWidth,this.SurveyPromptDivHeight);
window.moveTo(this.SurveyPromptDivLeftOffset,this.SurveyPromptDivTopOffset);
}
catch(error){
}
var _35=document.getElementById(this.SurveyPromptDivName);
if(_35){
_35.style.display="block";
}
var _36=this;
if(this.SurveyPromptDivYesButtonId){
var yes=document.getElementById(this.SurveyPromptDivYesButtonId);
if(yes){
this.utils.AddEvent(yes,"click",function(){
_36.YesButtonClicked();
});
}
}
if(this.SurveyPromptDivNoButtonId){
var no=document.getElementById(this.SurveyPromptDivNoButtonId);
if(no){
this.utils.AddEvent(no,"click",function(){
_36.NoButtonClicked();
});
}
}
}else{
this.YesButtonClicked();
}
};
VoviciSurveyWatcher.prototype.HidePrompt=function(){
var _37=document.getElementById(this.SurveyPromptDivName);
if(_37){
_37.style.display="none";
}
var _38=document.getElementById(this.SurveyFrameName);
if(_38){
_38.style.display="none";
}
};
VoviciSurveyWatcher.prototype.YesButtonClicked=function(){
if(this.IsAPopup){
try{
window.resizeTo(this.SurveyWindowWidth,this.SurveyWindowHeight);
window.moveTo(this.SurveyWindowLeftOffset,this.SurveyWindowTopOffset);
}
catch(error){
}
window.location=this.GetExitSurveyUrl();
return false;
}else{
this.HidePrompt();
var _39=document.getElementById(this.SurveyFrameName);
if(_39&&_39.parentNode&&_39.parentNode.removeChild){
_39.parentNode.removeChild(_39);
}
var _3a=document.getElementById(this.SurveyPromptDivNoButtonId);
if(_3a&&_3a.parentNode&&_3a.parentNode.removeChild){
_3a.parentNode.removeChild(_3a);
}
var obj=this;
this.SurveyLayer=this.utils.CreateLayer(this.SurveyFrameName,this.SurveyDisplayFrameInnerHtml,obj,"",this.SurveyPromptDivNoButtonId,this.SurveyWindowWidth,this.SurveyWindowHeight,this.SurveyWindowLeftOffset,this.SurveyWindowTopOffset);
this.LoadSurveyInIFrame();
}
};
VoviciSurveyWatcher.prototype.NoButtonClicked=function(){
if(this.IsAPopup){
window.close();
}else{
this.HidePrompt();
}
return false;
};
VoviciSurveyWatcher.prototype.LoadSurveyInIFrame=function(){
if(!document.createElement){
return true;
}
" + this.SurveyInnerFrameName + ";
var _3b=document.getElementById(this.SurveyInnerFrameName);
if(!_3b){
return true;
}
var _3c;
if(!this.IFrameObj&&document.createElement){
try{
var _3d=document.createElement("iframe");
_3d.setAttribute("id","VoviciSurveyIFrame");
_3d.style.position="relative";
_3d.style.border="0px";
_3d.style.width="100%";
_3d.style.height="100%";
this.IFrameObj=_3b.appendChild(_3d);
if(document.frames){
this.IFrameObj=document.frames["VoviciSurveyIFrame"];
}
}
catch(exception){
iframeHTML="<iframe id=\"VoviciSurveyIFrame\" style=\"";
iframeHTML+="position:relative;";
iframeHTML+="border:0px;";
iframeHTML+="width:100%;";
iframeHTML+="height:100;";
iframeHTML+="\"></iframe>";
_3b.innerHTML+=iframeHTML;
this.IFrameObj=new Object();
this.IFrameObj.document=new Object();
this.IFrameObj.document.location=new Object();
this.IFrameObj.document.location.iframe=document.getElementById("VoviciSurveyIFrame");
this.IFrameObj.document.location.replace=function(_3e){
this.iframe.src=_3e;
};
}
}
if(navigator.userAgent.indexOf("Gecko")!=-1&&!this.IFrameObj.contentDocument){
setTimeout(this.LoadSurveyInIFrame,10);
return false;
}
if(this.IFrameObj.contentDocument){
_3c=this.IFrameObj.contentDocument;
}else{
if(this.IFrameObj.contentWindow){
_3c=this.IFrameObj.contentWindow.document;
}else{
if(this.IFrameObj.document){
_3c=this.IFrameObj.document;
}else{
return true;
}
}
}
_3c.location.replace(this.GetExitSurveyUrl());
return false;
};
VoviciSurveyWatcher.prototype.Test=function(){
this.utils.DebugLog("cookie: "+this.utils.GetCookie(this.CookieName));
};
function VoviciSurveyUtils(){
this.DebuggingEnabled=false;
this.DebugDivName="VoviciSurveyInvite_DebugOutput";
this.DebugDiv;
this.DebugLog=function(_3f){
if(this.DebuggingEnabled){
this.CreateDebugDiv();
if(this.DebugDiv){
this.DebugDiv.appendChild(document.createTextNode(_3f));
this.DebugDiv.appendChild(document.createElement("br"));
}else{
}
}
};
this.CreateDebugDiv=function(){
if(!this.DebugDiv){
var div=document.getElementById(this.DebugDivName);
if(div){
this.DebugDiv=div;
}else{
if(document.body){
this.DebugDiv=document.createElement("div");
this.DebugDiv.id=this.DebugDivName;
document.body.appendChild(this.DebugDiv);
}
}
}
};
this.AddEvent=function(obj,_40,fn){
if(obj.addEventListener){
obj.addEventListener(_40,fn,false);
return true;
}else{
if(obj.attachEvent){
var r=obj.attachEvent("on"+_40,fn);
return r;
}else{
return false;
}
}
};
this.RemoveEvent=function(obj,_41,fn){
if(obj.removeEventListener){
obj.removeEventListener(_41,fn,false);
return true;
}else{
if(obj.detachEvent){
var r=obj.detachEvent("on"+_41,fn);
return r;
}else{
return false;
}
}
};
this.SetCookie=function(_42,_43,_44,_45,_46){
var _47=_42+"="+_43+";";
if(_44){
_47+=" domain="+_44+";";
}
if(_46){
_47+=" path="+_46+";";
}
var _48=this.GetCookieExpireDate(_45);
if(_48){
_47+=" expires="+_48.toGMTString()+";";
}
document.cookie=_47;
};
this.GetCookie=function(_49){
arg=_49+"=";
alen=arg.length;
clen=document.cookie.length;
i=0;
while(i<clen){
j=i+alen;
if(document.cookie.substring(i,j)==arg){
return this.GetCookieValue(j);
}
i=document.cookie.indexOf(" ",i)+1;
if(i===0){
break;
}
}
};
this.GetCookieValue=function(_4a){
endstr=document.cookie.indexOf(";",_4a);
if(endstr==-1){
endstr=document.cookie.length;
}
return unescape(document.cookie.substring(_4a,endstr));
};
this.GetCookieExpireDate=function(_4b){
if(_4b==""||_4b==0){
return "";
}
if(_4b=="today"){
var _4c=new Date();
_4c.setDate(_4c.getDate()+1);
_4c.setHours(0);
_4c.setMinutes(1);
_4c.setSeconds(0);
_4c.setMilliseconds(0);
return _4c;
}else{
var _4d=new Date();
_4d.setTime(_4d.getTime()+_4b*60*1000);
return _4d;
}
};
this.DeleteCookie=function(_4e){
var _4f=new Date();
_4f.setTime(_4f.getTime()-1);
document.cookie=_4e+="=; expires="+_4f.toGMTString();
};
this.GetRandom=function(max){
if(max==1){
return 1;
}else{
return (Math.floor(Math.random()*max))+1;
}
};
this.CookieMatchesRegex=function(_50,_51){
var _52=this.GetCookie(_50);
if(_52){
return _52.match(new RegExp(_51));
}
return false;
};
this.AddUrlParameters=function(_53,_54){
if(_54){
var out=_53;
if(!/\?/.test(out)){
out+="?";
}
var _55=0;
for(var key in _54){
out+=(_55>0?"&":"")+key+"="+escape(_54[key]);
}
return out;
}else{
return _53;
}
};
this.GetLayerWidth=function(_56){
var _57=0;
if(typeof (window.innerWidth)=="number"){
_57=window.innerWidth;
}else{
if(document.documentElement&&document.documentElement.clientWidth){
_57=document.documentElement.clientWidth;
}else{
if(document.body&&document.body.clientWidth){
_57=document.body.clientWidth;
}
}
}
if(_56){
return Math.min(_56,_57);
}else{
return _57;
}
};
this.GetLayerHeight=function(_58){
var _59=0;
if(typeof (window.innerHeight)=="number"){
_59=window.innerHeight;
}else{
if(document.documentElement&&document.documentElement.clientHeight){
_59=document.documentElement.clientHeight;
}else{
if(document.body&&document.body.clientHeight){
_59=document.body.clientHeight;
}
}
}
if(_58){
return Math.min(_58,_59);
}else{
return _59;
}
};
this.CreateLayer=function(id,_5a,obj,_5b,_5c,_5d,_5e,_5f,_60){
var _61="VoviciSurveyPromptContainer_"+id;
var _62=document.createElement("div");
_62.style.display="none";
_62.setAttribute("id",_61);
_62.setAttribute("name",_61);
_62.innerHTML=_5a;
document.body.appendChild(_62);
var div=document.getElementById(id);
var _63=this.GetLayerWidth();
var _64=this.GetLayerHeight();
var _65=_5d?this.GetLayerWidth(_5d):(_63*0.9);
var _66=_5e?this.GetLayerHeight(_5e):(_64*0.9);
div.style.width=_65;
div.style.height=_66;
div.style.position="absolute";
div.style.left=_5f?_5f:Math.abs(_63-_65)/2;
div.style.top=_60?_60:Math.abs(_64-_66)/2;
if(_5b){
var yes=document.getElementById(_5b);
if(yes){
this.AddEvent(yes,"click",function(){
obj.YesButtonClicked();
});
}
}
if(_5c){
var no=document.getElementById(_5c);
if(no){
this.AddEvent(no,"click",function(){
obj.NoButtonClicked();
});
}
}
_62.style.display="block";
return _62;
};
};

