/**
 * This script sets a cookie to block POG for certain sites
 *
 * @version 1
 * @author Marc-André Rioux
 */
 
 //Based on pop_delayed_popup by CI
var POGBlock = {
	pogDisplayCookie : 'zPogDisplayed',

	// sites for which not to show the code.. make sure it's lovercase
	excluded_sites : new Array(
		'ovguide',
		'otherurl'
	),

	// delay in hours
	pogDelay : 1,

	// based on http://techpatterns.com/downloads/javascript_cookies.php code
	setCookie : function (name, value, expiration) {
		var today = new Date();
		today.setTime(today.getTime());
		if(expiration) {
			expiration = expiration * 1000 * 60 * 60;
		}
		var expires_date = new Date(today.getTime() + (expiration));	
		document.cookie = name + "=" + escape(value) + ((expiration) ? ";expires=" + expires_date.toGMTString() : "");	
	},
	
	// deploys the POG based on cookies
	deploy : function() {		
		if (document.referrer != null) {
			for (var i=0; i < POGBlock.excluded_sites.length; i++) {
				if (document.referrer.toLowerCase().indexOf(POGBlock.excluded_sites[i]) > -1) {
					POGBlock.setCookie(POGBlock.pogDisplayCookie, "wait", POGBlock.pogDelay);
					break;
				}
			}
		}
	}
};

POGBlock.deploy();