//alert ("Iperception Test")
var date = new Date();
date.setTime(date.getTime()+(90*24*60*60*1000));
var cookExpire = date.toUTCString();

var sValue1 = 1;
var sName1 = "PNcookieTEST";

 document.cookie = sName1 + "=" + escape(sValue1) + ";path=\; expires=" + cookExpire + ";"
 
//alert (document.cookie)

Hitit(); // Check to see if they've been here before if not then do Hit() 


function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
		return unescape(aCrumb[1]);
    else
		return false;

  }
}

function SetCookie(sName, sValue)
{
  
  document.cookie = sName + "=" + escape(sValue) + ";path=\; expires=" + cookExpire + ";"
}
	
function Hitit(){
	var sValue = 1;
	var sName = "PNcookie314";
	var rndNum;
	rndNum=Math.floor ((Math.random()*300));
    //Oct. 23rd 2009: 4/300	
		if (rndNum < 5 && document.cookie.indexOf(sName) == -1) //if cookie has not been set
		{
			//alert (document.cookie.indexOf(sName1))
			
			if( GetCookie('PNcookieTEST') == null || document.cookie==null ||document.cookie.indexOf(sName1)==-1)
			//if (document.cookie)
			{
				//alert ("donothing")
				donothing();
			}
			else
			{
				//alert ("SET COOKIE")
			SetCookie(sName, sValue);
			if (navigator.appName.indexOf("Microsoft")==-1)
				//alert("other")
				setTimeout('OpenPopup()',1); 
			else
				//alert("ie")
				OpenPopup() 	
			}    
		}
		else
		{
			donothing();
		}
	/*}
	else
	{
		
	alert ("donothing")
		donothing();
	}*/
	
}


function OpenPopup() {

	
	var a
	a = 1
	if (a==1){ 
		top.location="https://www.gm.ca/invitations/gmcanada/gmcanadainvitation_fr.html";
	}
	
}

function donothing() {
	var a;
	
}

//alert ("Iperceptions Test 2")






