var expirationIntl = 24*60*60*1000; // one day

function popundrShow (url) {
    var popundrWindow = window.open(url, '', 'toolbar,status,resizable,scrollbars,menubar,location,height=600,width=800');
    setTimeout( function() { popundrWindow.focus(); setTimeout( function() { popundrWindow.blur();}, 10);}, 500);
};

function popundrSetcookie (name, value, interval) {
    var expires = new Date();
    expires.setTime(expires.getTime() + interval);
    document.cookie = name + '=' + value + '; expires=' + expires.toGMTString() + '; path=/';
};

function popundrGetcookie (name) {
    var cookies = document.cookie.toString().split('; ');
    for (var i = 0; i < cookies.length; i++) {
        if (cookies[i].split('=')[0] == name) return cookies[i].split('=')[1];
    };
    return '0';
};

function popundrCheck (event) {
	if (navigator.userAgent.indexOf('MSIE')!=-1 && (event.srcElement.id == 'livesex-link' || event.srcElement.id == 'dating-link' || event.srcElement.id == 'freesex-link')) {
		window.open(event.srcElement.getAttribute('href'));
		return false;
	};
    var cookie = popundrGetcookie('popundr');
    if ((cookie>=0&&cookie<10)) {
        cookie++;
        switch (cookie) {
            case 1 : {
                popundrShow('http://www.livejasmin.com/freechat.php?random&psid=dumping&campaign_id=40415&pstour=t1&psprogram=REVS&template=freechat3&6cam&pstool=15_26&tags=girl&welcome');
                break;
            };
            default : break;
        };
        popundrSetcookie('popundr',cookie,expirationIntl);
    };
};

function popundrInitialize() {
    if (document.attachEvent) document.attachEvent( "onclick", popundrCheck);
    else {
        if (document.addEventListener) document.addEventListener( "click", popundrCheck, false);
    };
};

popundrInitialize();
