//
//Get The total number of completes from "Total" quota
var Quota_CurrentNumber=0;
var Quota_Limit=-1;
//Get imgage pixel tracking bit
var imgTrackExposed="";
//Get search string from script tag
window.searchString_sw = "vWebmd=1&art=78265&eaid=6221745837&ecid=138422699865&epid=25312154&esid=3312554&iaf=1&itype=22&pos=901&prg=%5BInsertProgramCode%5D&pt=1832&pvid=168045411924882915&uri=%2Fdepodur-drug.htm&hostName=survey.o.webmd.com";
window.qAsked=0;
window.qSize=0;
var medpermauth = getCookie_sw('medpermauth');
if (medpermauth==null) {medpermauth = "NA";}
if (medpermauth.length==0) {medpermauth = "NA";}
searchString_sw = searchString_sw + "&ivar=medpermauth~" + medpermauth;
try {
var visitor = window.top.Visitor.getInstance("16AD4362526701720A490D45@AdobeOrg");
var mcvID = visitor.getMarketingCloudVisitorID();
var OmnitureID = visitor.getAnalyticsVisitorID();
searchString_sw = searchString_sw + "&OmnitureID=" + OmnitureID;
searchString_sw = searchString_sw + "&mcvID=" + mcvID;
}
catch (e) {
// handle the unsavoriness if needed
}
var strReferrer=document.referrer;
strReferrer=strReferrer.replace("http://","");
strReferrer=strReferrer.replace("https://","");
var arrayReferrer=strReferrer.split("/");
var varReferrer=arrayReferrer[0];
var isTest_sw = query_sw('test');
var isExit_sw = query_sw('exit');
var itype_sw = query_sw('itype');
var nExposures_sw = [];
var iExposed_sw = [];
var TriggerLogic_sw="1==1";
var popupDelay_sw="0";
var popUpOdds_sw=0;
var testType_sw=0; //Control=0 ; Exposed=1
var popupDelayR_sw=0;
var PIN=0;
var tpix='';
var adViewsTotal_sw=0;
window.deviceType_sw=1;
var pimMode=0;
var deviceTypeTemp_sw=0;
var objJsonCookie_sw = "";
var objJsonCookiePN_sw = {};
var objJsonCookiePNvars_sw = {};
var iContent_sw="";
var adViews_sw=0;
var passSegFlag_sw=0
var segValue_sw="";
var memID_sw="";
var isPIM_sw=0;
var noGo_sw=0;
var expireDays_sw=180;
var popUpScale_sw = 100;
//Cookie records Intercept Served for this project
var cn="C5204_23";
var pn="23_IP_03C"
if(window.parent.jQuery == undefined){
var script = document.createElement('script');
parent.parent.document.head.appendChild(script);
script.type = 'text/javascript';
script.src = "//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js";
script.onload = function(){
window.parent.$.noConflict();
triggerInterceptProcess();
}
}
else
{
//window.parent.jQuery.noConflict();
triggerInterceptProcess();
}
function triggerInterceptProcess() {
startInterceptProcess();
}
function startInterceptProcess() {
deviceTypeTemp_sw=getDevice_sw(navigator.userAgent||navigator.vendor||window.opera);
//if (itype_sw=='1') {popUpOdds_sw = 20;TriggerLogic_sw="TrackingAdViews_sw < 1";popupDelay_sw=15;TriggerLogic_sw="adViews_sw > 1";isExit_sw=1;isExit_sw=2;popupDelayR_sw=10;pimMode=1;}
//TriggerLogic_sw="if (adViews_sw > 1) {popupDelay_sw=0;AdViewFlag_sw=1;}else{popupDelay_sw=10;AdViewFlag_sw=1;}";}
//Modify popup odds. A 1 means 1% of the hits, 10=10%, etc...
//Keep the 99 itype as is
if (itype_sw=='99') {popUpOdds_sw=0;TriggerLogic_sw="adViews_sw>0";testType_sw=1;}
if (itype_sw=='5') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='6') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='7') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='8') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='9') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='10') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='11') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='12') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='13') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='14') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='15') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='16') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='17') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='18') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='19') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='20') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='21') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='22') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='23') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
if (itype_sw=='24') {popUpOdds_sw=95;popupDelay_sw=0;testType_sw=1;deviceType_sw=0;TriggerLogic_sw="adViews_sw>0";pimMode=0;}
pimMode=1;
if (Quota_CurrentNumber==Quota_Limit) {popUpOdds_sw=0;}
if ((deviceType_sw==0) || (deviceType_sw.length==0) || (deviceType_sw != deviceTypeTemp_sw)) {
deviceType_sw=deviceTypeTemp_sw;
}
if (isExit_sw > '0') {
var winType=2;
}
else
{
var winType=1;
}
if (isExit_sw > 0) {window.onunload=dounload_23_IP_03C_sw;}
noGo_sw=0;
expireDays_sw=180;
expireDate_sw=getDate_sw(expireDays_sw);
//Set PIM
isPIM_sw=0;
//if (parent.parent.webmd && parent.parent.webmd.p && parent.parent.webmd.p.pim) {isPIM_sw=1;}
window.top.webmd.p=window.top.webmd.p || {};
window.top.webmd.p.pim=window.top.webmd.p.pim||window.top.webmd.pim;
if (window.top.webmd && window.top.webmd.p && window.top.webmd.p.pim) {isPIM_sw=1;}
if (isPIM_sw==1) {
noGo_sw=0;
window.JSON =window.top.JSON;
window.webmd = window.top.webmd;
//window.JSON = parent.parent.JSON;
//window.webmd = parent.parent.webmd;
if (!webmd.p.pim.isAllowed()) {
noGo_sw=1;
}
}
else
{
noGo_sw=1;
}
if (isTest_sw==2) {
noGo_sw=0;
} else if (pimMode==1) {
isTest_sw=1;
noGo_sw=0;
}
if ((location.href=="https://www.webmdxxx.com/") || (window.top.location.href=="https://www.webmdxxx.com/")) {
noGo_sw=1;
}
//Get JSON Cookie
//Place cookie values into objJsonCookie_sw
//setCookie_sw('jsonCookie_sw', JSON.stringify(objJsonCookie_sw), 180);
var strJsonCookie_sw=getCookie_sw('jsonCookie_sw');
if (strJsonCookie_sw==null) {strJsonCookie_sw = ' ';}
try {
objJsonCookie_sw = JSON.parse(strJsonCookie_sw);
} catch (e) {
objJsonCookie_sw = {};
}
objJsonCookiePN_sw = {};
objJsonCookiePNvars_sw = {};
if (objJsonCookie_sw[cn]==null) {
objJsonCookiePNvars_sw.e=0;
objJsonCookiePNvars_sw.p=0;
objJsonCookiePNvars_sw.x=expireDate_sw;
objJsonCookiePN_sw[pn]=objJsonCookiePNvars_sw;
objJsonCookie_sw[cn]=objJsonCookiePN_sw;
}
else if (objJsonCookie_sw[cn][pn]==null) {
objJsonCookiePNvars_sw.e=0;
objJsonCookiePNvars_sw.p=0;
objJsonCookiePNvars_sw.x=expireDate_sw;
objJsonCookie_sw[cn][pn]=objJsonCookiePNvars_sw;
}
//Delete cookie if expire date has been reached
destroyCookie();
//Write JSON Cookie back out immediately with testType_sw
if (testType_sw==1) {
objJsonCookie_sw[cn][pn].e = testType_sw;
setCookie_sw('jsonCookie_sw', JSON.stringify(objJsonCookie_sw), 180);
}
//Write JSON Cookie back out immediately with imgTrack
if (imgTrackExposed=="1") {
objJsonCookie_sw[cn][pn].e = 1;
setCookie_sw('jsonCookie_sw', JSON.stringify(objJsonCookie_sw), 180);
}
//Cookie records Intercept Served for this project
var surveyAsked_sw=objJsonCookie_sw[cn][pn].p;
if (popUpOdds_sw.length==0) {popUpOdds_sw = 0;}
//Set 5 second delay for control in case exposed is also on the page
if ((testType_sw==0) && (popupDelay_sw == 0)) {popupDelay_sw=5;}
//Cookie to read number of times page/ad viewed
var isStrType_sw='t';
if (testType_sw==0) {isStrType_sw='c';}
var adViewsCookieName_sw= "a" + isStrType_sw + itype_sw;
adViews_sw=objJsonCookie_sw[cn][pn][adViewsCookieName_sw];
if (adViews_sw==null) {adViews_sw=0;}
adViews_sw=parseFloat(adViews_sw) + 1;
objJsonCookie_sw[cn][pn][adViewsCookieName_sw] = adViews_sw;
//Popup Trigger Logic based on page/ad views
//var TriggerLogic_sw = query_sw('trLogic');
if (TriggerLogic_sw.length==0) {TriggerLogic_sw = "1==1";}
var AdViewFlag_sw=0;
if (eval(TriggerLogic_sw)) {AdViewFlag_sw=1;}
//Check for Test Type Cookie
var exposedCookieValue_sw=objJsonCookie_sw[cn][pn].e;
if (exposedCookieValue_sw==null) {exposedCookieValue_sw=0;}
if (testType_sw==1) {objJsonCookie_sw[cn][pn].e = testType_sw;}
if ((exposedCookieValue_sw==1) && (testType_sw==0)) {noGo_sw=1;}
//Set invite timer delay
//var popupDelay_sw = query_sw('delayTime');
if (popupDelay_sw.length==0) {popupDelay_sw = 0;}
//Sets the total percentage figure. Currently set to work on a 100 scale
popUpScale_sw = 100;
//Set default for passSegFlag for Health Check Trigger
passSegFlag_sw=0
segValue_sw="";
memID_sw="";
if (popupDelay_sw < 0) {
popupDelay_sw = 0;
passSegFlag_sw = 1;
}
//Popup Window Content
var iContentM_sw='\
\
';
var iContentD_sw='\
\
';
if (deviceType_sw==2) {
iContent_sw=iContentM_sw;
}
else
{
iContent_sw=iContentD_sw;
}
if ((isExit_sw != 1) && (noGo_sw==0)) {
//Check to see if Popup Window should trigger
checkTriggerPopup_23_IP_03C(AdViewFlag_sw,popUpOdds_sw,surveyAsked_sw,popupDelay_sw,iContent_sw);
//Write JSON Cookie back out
setCookie_sw('jsonCookie_sw', JSON.stringify(objJsonCookie_sw), 180);
}
} //Closed intercept in motion
//Being Function Calls
//--------------------
function checkTriggerPopup_23_IP_03C(AdViewFlag_sw,popUpOdds_sw,surveyAsked_sw,popupDelay_sw,iContent_sw) {
if (isTest_sw==2) {noGo_sw=0;surveyAsked_sw=0;popupDelay_sw=0;popUpOdds_sw=100;AdViewFlag_sw=1;}
if (noGo_sw==0) {
if (AdViewFlag_sw==1) {
var randomN_sw=randomRange_sw();
if (randomN_sw <= popUpOdds_sw) {
if (surveyAsked_sw==0) {
if (popupDelay_sw > 0) {
setTimeout("showPopup_sw(iContent_sw)",parseFloat(popupDelay_sw) * 1000);
}
else if (passSegFlag_sw==1)
{
//showPopup_sw(iContent_sw);
}
else if (isExit_sw > 0)
{dounload_23_IP_03C_sw();}
else
{
showPopup_sw(iContent_sw);
}
}
}
}
}
}
function writeIframe_sw_NEW(iframeSrc) {
var iDiv = document.createElement('DIV');
//document.getElementsByTagName('body')[0].appendChild(iDiv);
document.getElementsByTagName('body')[0].insertBefore(iDiv, document.getElementsByTagName('body')[0].firstChild);
var iframe = new IFrame_sw(iDiv);
iframe.src=iframeSrc;
iframe.style.height="1px";
iframe.style.width="1px";
iframe.style.position="absolute";
iframe.style.top="-1000px";
}
function writeIframe_sw(iframeSrc) {
var iDiv = document.createElement('DIV');
iDiv.id="diviPopFrame_sw";
document.getElementsByTagName('body')[0].appendChild(iDiv);
var iframe = new IFrame_sw(iDiv);
iframe.src=iframeSrc;
}
function showPopup_sw(iContent_sw) {
//Check to see if exposure has happened since intercept was triggered
//-------------------------------------------------------------------
var strJsonCookieTemp_sw=getCookie_sw('jsonCookie_sw');
var objJsonCookieTemp_sw = JSON.parse(strJsonCookieTemp_sw);
try {
var exposedCookieValueTemp_sw=objJsonCookieTemp_sw[cn][pn].e;
}
catch (e) {
var exposedCookieValueTemp_sw=0;
}
if ((exposedCookieValueTemp_sw==1) && (testType_sw==0)) {noGo_sw=1;}
if (noGo_sw==1) {return false;}
if (testType_sw==0) {
adViewsTotal_sw=0;
}
else
{
adViewsTotal_sw=getAdViewsTotal_sw(objJsonCookie_sw[cn][pn])
}
iContent_sw=iContent_sw.replace("&itype=","&adViewsTotal_sw=" + adViewsTotal_sw + "&adViews_sw=" + adViews_sw + "&itype=")
iContent_sw=iContent_sw.replace("&itype=","&ivar=iExposed~" + iExposed_sw + "~2&itype=")
searchString_sw=searchString_sw+"&adViewsTotal_sw=" + adViewsTotal_sw + "&adViews_sw=" + adViews_sw+"&ivar=iExposed~" + iExposed_sw ;
var iDiv = window.top.document.createElement('DIV');
window.top.document.getElementsByTagName('body')[0].appendChild(iDiv);
var iframe = new IFrame_sw(iDiv);
iDiv.id="diviPopFrame_sw";
if (deviceType_sw==2) {
writeIContentM_sw(iframe,iContent_sw);
}
else
{
writeIContent_sw(iframe,iContent_sw);
}
if ((isPIM_sw==1) && (passSegFlag_sw != 1)) {
webmd.p.pim.increment();
}
objJsonCookie_sw[cn][pn].p = 1;
//Write JSON Cookie back out
setCookie_sw('jsonCookie_sw', JSON.stringify(objJsonCookie_sw), 180);
}
function writeIContent_sw(iframe,iContent_sw) {
var iframeSrc="https://survey.o.webmd.com/in/survey/survey2187/23_IP_03C.asp?" + searchString_sw;
iframe.style.position="absolute";
//iframe.style.top="0px";
iframe.style.marginTop="0px";
iframe.src=iframeSrc;
//iframe.scrolling="no";
iframe.style.zIndex=4999999;
iframe.style.border="3px solid #2792B5";
iframe.style.visibility="hidden";
iframe.style.backgroundColor="#FFF";
iframe.style.overflow="scroll";
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'https://survey.o.webmd.com/in/survey/survey2187/iCloseFrame_inPageSurvey_C5204_23.js';
window.top.document.getElementById("diviPopFrame_sw").appendChild(script);
var imgTrack='
';
window.top.jQuery("#diviPopFrame_sw").append(imgTrack);
}
function writeIContentM_sw(iframe,iContent_sw) {
var iframeSrc="https://survey.o.webmd.com/in/survey/survey2187/23_IP_03C.asp?" + searchString_sw;
iframe.style.position="absolute";
//iframe.style.top="0px";
iframe.style.marginTop="0px";
iframe.src=iframeSrc;
//iframe.scrolling="no";
iframe.style.zIndex=4999999;
iframe.style.border="3px solid #2792B5";
iframe.style.visibility="hidden";
iframe.style.backgroundColor="#FFF";
iframe.style.overflow="scroll";
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'https://survey.o.webmd.com/in/survey/survey2187/iCloseFrame_inPageSurvey_C5204_23.js';
window.top.document.getElementById("diviPopFrame_sw").appendChild(script);
var imgTrack='
';
window.top.jQuery("#diviPopFrame_sw").append(imgTrack);
}
function IFrame_sw(parentElement)
{
// Create the iframe which will be returned
var iframe = document.createElement("iframe");
iframe.frameBorder="0";
iframe.id="iPopFrame_sw";
iframe.name="iPopFrame_sw";
// If no parent element is specified then use body as the parent element
if(parentElement == null)
parentElement = window.top.document.body;
// This is necessary in order to initialize the document inside the iframe
parentElement.appendChild(iframe);
// Initiate the iframe's document to null
iframe.doc = null;
// Depending on browser platform get the iframe's document, this is only
// available if the iframe has already been appended to an element which
// has been added to the document
if(iframe.contentDocument)
// Firefox, Opera
iframe.doc = iframe.contentDocument;
else if(iframe.contentWindow)
// Internet Explorer
iframe.doc = iframe.contentWindow.document;
else if(iframe.document)
// Others?
iframe.doc = iframe.document;
// If we did not succeed in finding the document then throw an exception
if(iframe.doc == null)
throw "Document not found, append the parent element to the DOM before creating the IFrame";
// Create the script inside the iframe's document which will call the
iframe.doc.open();
iframe.doc.close();
// Return the iframe, now with an extra property iframe.doc containing the
// iframe's document
return iframe;
}
//Cookie Functions
//----------------
function setCookie_sw_Old(name, value, expiresDays, path, domain, secure) {
path="/";
var CurrentDomain=document.domain;
var now = new Date();
fixDate_sw(now);
now.setTime(now.getTime() + expiresDays * 24 * 60 * 60 * 1000);
expires=now;
if (CurrentDomain.indexOf(".") > -1) {
var arCurrentDomain=CurrentDomain.split(".");
domain=arCurrentDomain[arCurrentDomain.length-2] + "." + arCurrentDomain[arCurrentDomain.length-1];
}
else
{
domain="";
}
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}
function setCookie_sw(name, value, expiresDays, path, domain, secure) {
path="/";
var CurrentDomain=document.domain;
var now = new Date();
fixDate_sw(now);
now.setTime(now.getTime() + expiresDays * 24 * 60 * 60 * 1000);
expires=now;
if (CurrentDomain.indexOf(".") > -1) {
var arCurrentDomain=CurrentDomain.split(".");
domain=arCurrentDomain[arCurrentDomain.length-2] + "." + arCurrentDomain[arCurrentDomain.length-1];
}
else
{
domain="";
}
var curCookie = name + "=" + encodeValue_sw(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}
function getCookie_sw_Old(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}
function getCookie_sw(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return decodeValue_sw(dc.substring(begin + prefix.length, end));
}
function fixDate_sw(date) {
var base = new Date(0);
var skew = base.getTime();
if (skew > 0)
date.setTime(date.getTime() - skew);
}
function query_sw(ji) {
hu = searchString_sw;
gy = hu.split("&");
for (i=0;i1) {
return arrayStr[1];
}
else
{
return "0";
}
}
function dounload_23_IP_03C_sw() {
//!!modified for exit early
//!!-----------------------
if (isExit_sw==2) {
iContent_sw=iContent_sw.replace(/iClose_sw\(1\)/g,"iClose_sw\(2\)");
winType=2;
}
//!!-----------------------
if (objJsonCookie_sw[cn][pn].p == 1) {return false;}
if (noGo_sw==0) {
if (AdViewFlag_sw==1) {
if (randomRange_sw() <= popUpOdds_sw) {
if (!surveyAsked_sw) {
if (deviceType_sw==2) {
var popUpWindowFormat = "toolbar=no,directories=no,location=no,status=yes,menubar=no,resizable=yes,height=200,width=270,screenY=300,left=300,top=100";
}
else
{
var popUpWindowFormat = "toolbar=no,directories=no,location=no,status=yes,menubar=no,resizable=yes,height=512,width=438,screenY=300,left=300,top=100";
}
if (isPIM_sw==1) {
webmd.p.pim.increment();
}
var popwin = window.open("", "popwin", popUpWindowFormat);
iContent_sw=iContent_sw + '<' + 'script type=text/javascript src="https://survey.o.webmd.com/in/survey/survey2187/iCloseFrame.js">' + 'script>';
var popwinText="" + iContent_sw + ""
popwin.document.write(popwinText);
//Write JSON Cookie back out
objJsonCookie_sw[cn][pn].p = 1;
setCookie_sw('jsonCookie_sw', JSON.stringify(objJsonCookie_sw), 180);
}
}
}
}
}
function triggerSW(theSeg) {
if (typeof(theSeg) != 'undefined') {
segValue_sw = theSeg;
} else {
segValue_sw = -1;
}
var randomN_sw=randomRange_sw();
if (randomN_sw > popUpOdds_sw) {noGo_sw=1;}
if (surveyAsked_sw==1) {noGo_sw=1;}
if (noGo_sw==1) {return false;}
if (popupDelayR_sw > 0) {
setTimeout("triggerSW(" + segValue_sw + ")",parseFloat(popupDelayR_sw) * 1000);
popupDelayR_sw=0;
popUpOdds_sw=100;
return;
}
showPopup_sw(iContent_sw);
if (window.top.document.getElementById('iPopFrame_sw') == null) {return false;}
window.top.document.getElementById('iPopFrame_sw').style.visibility="visible";
objJsonCookie_sw[cn][pn].p = 1;
setCookie_sw('jsonCookie_sw', JSON.stringify(objJsonCookie_sw), 180);
if (isPIM_sw==1) {
webmd.p.pim.increment();
}
}
function getDate_sw(expireDays) {
var atDate=new Date();
atDate.setDate(atDate.getDate()+expireDays)
var vDate=atDate.valueOf();
vDate=Math.round(vDate/1000/60/60/24)
return vDate;
}
//Destroy cookie values for this project if past expire date
function destroyCookie() {
var atDate_sw=new Date();
var vDate_sw=atDate_sw.valueOf();
vDate_sw=Math.round(vDate_sw/1000/60/60/24)
var expireDate_sw=objJsonCookie_sw[cn][pn].x;
if (vDate_sw > expireDate_sw) {
noGo_sw=1;
delete objJsonCookie_sw[cn][pn];
setCookie_sw('jsonCookie_sw', JSON.stringify(objJsonCookie_sw), 180);
}
}
function encodeValue_sw(value) {
return encodeURIComponent(value).replace(
// { {
// } }
// : :
// [ [
// ] ]
// " "
// , ,
/%7B|%7D|%3A|%5B|%5D|%22|%2C/g,
// Replacement function for any match of the regular expression
function(s){ return decodeURIComponent(s) }
);
}
function decodeValue_sw(value) {
return decodeURIComponent(value);
}
function getAdViewsTotal_sw(obj) {
var adViewsTotal_sw=0;
var itypeNumber_sw="";
var cnt=-1;
iExposed_sw = [];
for (var name in obj) {
if (name.substr(0,2)=='at') {
cnt=cnt+1
adViewsTotal_sw=adViewsTotal_sw + obj[name];
itypeNumber_sw=name.replace("at","")
nExposures_sw[itypeNumber_sw]=obj[name];
iExposed_sw[cnt]=itypeNumber_sw;
}
}
iExposed_sw=iExposed_sw.join(",");
return adViewsTotal_sw;
}
//!!!***Contains Temporary Fix for Health Check
//!!!***_______________________________________
function writeInterceptScriptParent() {
var div = window.top.document.createElement("div");
div.id="iDiv_sw";
window.top.document.getElementsByTagName('body')[0].appendChild(div);
var script= document.createElement('script');
script.type= 'text/javascript';
for (var i = 0; i < document.getElementsByTagName('script').length; i++) {
var sSrc=document.getElementsByTagName('script')[i].src;
if (sSrc.indexOf("surveywriter") > -1) {
script.src= sSrc;
break;
}
}
div.appendChild(script);
}
function resizeFrame() {
var fixedSize=200;
if (qSize>fixedSize) {fixedSize=qSize;}
//parent.jQuery("#iPopFrame_sw").css({"position":"fixed","top":"50%","left":"50%","transform":"translate(-50%, -50%)","height":fixedSize+"px"}).css("visibility","visible");
if (deviceType_sw==1) {
window.top.jQuery("#iPopFrame_sw").css({"position":"fixed","bottom":"10px","right":"10px","height":fixedSize+"px"}).css("visibility","visible");
}else{
window.top.jQuery("#iPopFrame_sw").css({"position":"fixed","top":"50%","left":"50%","transform":"translate(-50%, -50%)","height":fixedSize+"px"}).css("visibility","visible");
}
}
function getDevice_sw(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) {return 2} else {return 1}}