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

function popundrShow (url) {
	var popundrWindow = window.open(url, '', 'toolbar,status,resizable,scrollbars,menubar,location,height=770,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 () {
	var cookie = popundrGetcookie('popundr');
	if ((cookie>=0&&cookie<6)) {
		cookie++;
		switch (cookie) {
			case 1 : {
				popundrShow('http://www.yobtcams.com/');
				break;
			};
			case 6 : {
				popundrShow('http://www.yobtdvd.com');
				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();
