I'll let the video do all of the explaining here. Hopefully you've already seen my "Something You Should Eat" post from earlier today, in order for this to make sense and to fully appreciate it.
";
if (ad) {
splashAd(ad);
setInterval(timer, 1000);
// Change value of the cookie so script doesn't run next pageload.
setCookie('wbezSplash', 2, 1)
}
}
function splashAd() {
//build the display area
$('
')
.css({
'position' : 'fixed',
'top' : '100px',
'left' : '300px',
'height' : '500px',
'width' : '700px',
'padding' : '10px',
'background-color' : 'white'
})
.appendTo('#page');
// Add link to skip the ad.
$('
Skip This Ad 10
')
.css({
'text-align' : 'right',
'cursor' : 'pointer'
})
.appendTo('#placeholder');
$('#skip-ad').click(function() {
$('#splash-ad').hide();
});
$('
').html(ad).appendTo('#placeholder');
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1327426452883-0'); });
}
function timer(){
var time = $('#time').text();
time--;
if(time >= 0){
$('#time').text(time);
}
if(time == 0){
$('#splash-ad').hide();
}
}
}
//Cookie Handling Functions -- from http://www.w3schools.com/js/js_cookies.asp
// Date setting modified
function setCookie(c_name, value, exdays) {
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
exdate.setUTCHours('00');
exdate.setUTCMinutes('00');
exdate.setUTCSeconds('00');
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function getCookie(c_name) {
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i