if((navigator.userAgent.indexOf("MSIE") != -1) || (navigator.userAgent.indexOf("Netscape")) != -1)
{
	if((navigator.userAgent.indexOf("Firefox") != -1) || (navigator.userAgent.indexOf("Safari") != -1) || (navigator.userAgent.indexOf("Netscape") == 73))
	{
	   donothing();
	}
	else
  {	
		//alert ("navigator.userAgent.indexOf("MSIE"));
		//alert ("navigator.userAgent.indexOf("Netscape"));

		//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 + ";"

		//to keep this invitation active(true) or inactive(false)
    var keepThisInvitationActive = "true";
    //var keepThisInvitationActive = "false";

    //Link to Global JS file
    var globalJSFile = "http://group01.iperceptions.com/Invitations/Javascripts/GlobalShutOff.js";
    loadScript(globalJSFile);

    // This function loads an external javascript file into this file when called
    // from this file
    function loadScript(file)
    {
      // Create script DOM(Document Object Model) element
	    var script = document.createElement('script');
	    script.type = 'text/javascript';
	    script.src = file;

      // Alert when the script is loaded
      if (typeof(script.onreadystatechange) == 'undefined') // W3C
        script.onload = function(){ this.onload = null;  };
      else // IE
        script.onreadystatechange = function(){ if (this.readyState != 'loaded' && this.readyState != 'complete') return; this.onreadystatechange = null;  }; // Unset onreadystatechange, leaks mem in IE

      // Add script DOM(Document Object Model) element to document tree
      document.getElementsByTagName('head')[0].appendChild(script);
    }
	}
} else {
	donothing();
}

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(){
	//alert ("AAA");
	var sValue = 1;
	var sName = "PNcookie322";
	var rndNum;
	rndNum=Math.floor ((Math.random()*100));
	
	//Dec. 15th 2009 - rate: 80%
	if (rndNum < 90 && 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) { 
		if (navigator.appName.indexOf("Microsoft")==-1) {	
			top.location="http://crm.bmw.ca/microsites/iperceptions/bmwcanada/bmwcanadainvitation_net.html";
		}	else {
			top.location="http://crm.bmw.ca/microsites/iperceptions/bmwcanada/bmwcanadainvitation.html";
		}	
	}
}

function donothing() { var a; }

//alert ("Iperceptions Test 2")