addition code in red
Code:
/////////////End of interstitialBox object declaration here ////////////////////////////////
function getCookie(Name){
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return null
}
function setCookie(name, value, days){
var expireDate = new Date()
//set "expstring" to either an explicit date (past or future)
if (typeof days!="undefined"){ //if set persistent cookie
var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days))
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; "+interstitialBox.cookiesetting[1]
}
else //else if this is a session only cookie setting
document.cookie = name+"="+value+"; "+interstitialBox.cookiesetting[1]
}
var stitialvars=new Object() //temporary object to reference/ shorthand certain interstitialBox properties
stitialvars.freqtype=interstitialBox.displayfrequency[0] //"chance" or "cookie"
stitialvars.cookieduration=interstitialBox.displayfrequency[1] //"session" or int (integer specifying number of days)
stitialvars.cookiename=interstitialBox.cookiesetting[0] //name of cookie to use
if (stitialvars.freqtype=="chance"){ //IF CHANCE MODE
if (Math.floor(Math.random()*interstitialBox.displayfrequency[1])==0)
interstitialBox.launch=true
}
else if (stitialvars.freqtype=="cookie" && stitialvars.cookieduration=="session"){ //IF "SESSION COOKIE" MODE
if (getCookie(stitialvars.cookiename+"_s")==null){ //if session cookie is empty
setCookie(stitialvars.cookiename+"_s", "loaded")
interstitialBox.launch=true
}
}
else if (stitialvars.freqtype=="cookie" && typeof parseInt(stitialvars.cookieduration)=="number"){ //IF "PERSISTENT COOKIE" MODE
if (getCookie(stitialvars.cookiename)==null || parseInt(getCookie(stitialvars.cookiename))!=parseInt(stitialvars.cookieduration)){ //if persistent cookie is empty or admin has changed number of days to persist from that of the stored value (meaning, reset it)
setCookie(stitialvars.cookiename, stitialvars.cookieduration, stitialvars.cookieduration)
interstitialBox.launch=true
}
}
if (getCookie(stitialvars.cookiename)=='never'){
setCookie(stitialvars.cookiename, "never",1000);
interstitialBox.launch=false;
}
if (interstitialBox.launch)
interstitialBox.initialize()
to control
Code:
<input type="button" name="" value="Never Show" onclick="setCookie(stitialvars.cookiename, 'never',1000);" />
<input type="button" name="" value="Cancel Never Show" onclick="setCookie(stitialvars.cookiename, 'never',-1);" />
or to change the interstitial box
Code:
//3) HTML for the header bar portion of the interstitial box
defineheader: '<div class="headerbar"><a href="#" onClick="javascript:interstitialBox.closeit(); return false"><img src="http://www.vicsjavascripts.org/StdImages/1.gif" style="border: 0;width:50px;" title="Close Box"/></a><input type="button" name="" value="Never Show" onclick="setCookie(stitialvars.cookiename, \'never\',1000);" /></div>',
Bookmarks