I need a popunder for my site that opens every 20 min. I am using a code, but this only allows it to be opened 1 only once ...
var tags = document.getElementsByTagName("a");
for (i = 0; i < tags.length; i++ ) {
tags[i].onclick = function(){
if ( LerCookie('hellpop') != "1" ) {
abreJanela();
}
GerarCookie('hellpop', '1', 1);
};
}
function abreJanela() {
var l = screen.availWidth;
var t = screen.availHeight;
var p = height='+t+',width='+l+',menubar=yes,toolbar=yes,location=yes,scrollbars=yes,status=yes,resizable=yes,left=0,top=0';
nw = window.open("meu site","nt",p);
this.focus();
}
function GerarCookie(strCookie, strValor, lngDias){
var dtmData = new Date();
if(lngDias){
dtmData.setTime(dtmData.getTime() + (lngDias * 12 * 60 * 60 * 1000));
var strExpires = "; expires=" + dtmData.toGMTString();
}else{
var strExpires = "";
}
document.cookie = strCookie + "=" + strValor + strExpires + "; path=/";
}
function LerCookie(strCookie){
var strNomeIgual = strCookie + "=";
var arrCookies = document.cookie.split(';');
for(var i = 0; i < arrCookies.length; i++)
{
var strValorCookie = arrCookies[i];
while(strValorCookie.charAt(0) == ' ')
{
strValorCookie = strValorCookie.substring(1, strValorCookie.length);
}
if(strValorCookie.indexOf(strNomeIgual) == 0)
{
return strValorCookie.substring(strNomeIgual.length, strValorCookie.length);
}
}
return null;
}
function ExcluirCookie(strCookie){
GerarCookie(strCookie, '', -1);
}