function findCookie()
  {
  if (navigator.cookieEnabled)
	 {
	 
	 var cookieData = new String(document.cookie)
	 var cookieHeader = "v1st"
	 var cookieStart = cookieData.indexOf(cookieHeader) + cookieHeader.length + 1
	 var cookieEnd = cookieData.indexOf(";", cookieStart)

	 if (cookieData.indexOf(cookieHeader) == -1)
		{
		("Cookie not found");
		var cookieDate = new Date();
		cookieDate.setTime(cookieDate.getTime() + 1000 * 60 * 60 * 24 * 0);
		var name = "v1st";
		var value = "Here is the cookie data";
		document.cookie = name+"="+escape(value)+";expires=" + cookieDate.toGMTString();
		document.getElementById('divStayTopLeft').style.visibility = 'visible';
		}
	 }
	return unescape(document.cookie.substring(cookieStart,cookieEnd)); 
  }

var eid= findCookie();
var popunder=new Array()


if(document.URL=="http://www.capitalone.ca/?state=logout" || document.URL=="http://qamain.capitalone.ca/?state=logout")
{
	//set src=can in url for Canada
	popunder[0]="http://survey7.maritz.com/fcw9/index.php?src=can&eid=" + eid;
}
else
{
	//set src=usa in url for USA
	popunder[0]="http://survey7.maritz.com/fcw9/index.php?src=usa&eid=" + eid;
}

var width = '800';
var height = '600';

var p = 'scrollbars=no,resizable=yes,toolbar=no,' + //these are obvious variables. set "yes" or "no".
'menubar=no,status=yes,location=no,left=85,top=20,height=' + //the location on the user's screen
height + ',width=' + width;

var one_time=0;


// input numbers must be intergers
canadaTestRange = 46; // 46 -> 4.6% 
usaTestRange    = 14;    // 14 -> 1.4%

function load_pop_power(){
	randomNum = parseInt(Math.random()*1001)

	if(document.URL=="http://www.capitalone.ca/?state=logout" || document.URL=="http://qamain.capitalone.ca/?state=logout")
	{
		//Canada
		if (randomNum <= canadaTestRange)
		{
			win2=window.open(popunder[Math.floor(Math.random()*(popunder.length))],"bw",p);
		}
	}
	else
	{
		//USA
		if (randomNum <= usaTestRange)
		{
			win2=window.open(popunder[Math.floor(Math.random()*(popunder.length))],"bw",p);
		}
	}
}