 <!--
	function recenter_popup() {
		
		screeny=document.body.clientHeight;
		screenx=document.body.clientWidth;
	
		leny=200;   // height of popup
		lenx=400;  // width of popup
	
	
		posy=(screeny/2) - (leny/2); // position from top
		posx=(screenx/2) - (lenx/2); // position from left
	
	
		document.getElementById("nop").style.position='absolute';
		document.getElementById("nop").style.left=posx + 'px';
		document.getElementById("nop").style.top=posy + 'px';
		document.getElementById("nop").style.zIndex='1000'; // high z-Index to make sure it's on top of anything else
					
	}
	
	// DHTML POPUP ON ENTRY
	// By Jason Knight
	// http://www.gfknop.co.uk

	var OFF_BUTTON=0; // set this to 1 to deactivate code
	
	if (OFF_BUTTON==0) { 
	
	var do_alert=0; // CHANGE THIS TO do_alert=0 to remove all debug messages

	
		
	var Site=new Array(); 		// Array that holds the different site endings (add extras in here)
	
	// Define sites below
	// IMPORTANT: If a site will match MORE THAN ONE URL (eg news.bbc.co.uk and news.bbc.co.uk/sport)
	// put the more specific one lower in the list

	// ALSO IMPORTANT: If a site does not exist in the Site array, the popup will not be presented ever
	
//	SITE NAME                               :    POP RATE   ,
	Site={
	"www.bbc.co.uk/arts"			:	100.00	,
	"www.bbc.co.uk/history"			:	36.43	,
	"www.bbc.co.uk/bbcfour"			:	100.00	,
	"www.bbc.co.uk/digital"			:	14.17	,
	"www.bbc.co.uk/bbcone"			:	15.97	,
	"www.bbc.co.uk/bbctwo"			:	57.75	,
	"www.bbc.co.uk/bbcthree"		:	10.00	,
	"www.bbc.co.uk/tv"			:	10.00	,
	"www.bbc.co.uk/drama/neighbours"	:	0.00	,
	"www.bbc.co.uk/eastenders"		:	1.36	,
	"www.bbc.co.uk/drama/casualty"		:	0.00	,
	"www.bbc.co.uk/drama/wakingthedead"	:	100.00	,
	"www.bbc.co.uk/drama/spooks"		:	26.45	,
	"www.bbc.co.uk/drama/shakespeare"	:	100.00	,
	"www.bbc.co.uk/comedy"			:	13.83	,
	"www.bbc.co.uk/movies"			:	10.00	,	
	"www.bbc.co.uk/totp"			:	0.00	,
	"www.bbc.co.uk/teens"			:	40.00	,
	"www.bbc.co.uk/celebdaq"		:	0.17	,
	"www.bbc.co.uk/sportdaq"		:	1.64	,
	"www.bbc.co.uk/doctorwho"		:	99.11	,
	"www.bbc.co.uk/filmnetwork"		:	100.00	,
	"www.bbc.co.uk/cbbc"			:	10.00	,
	"www.bbc.co.uk/cbeebies"		:	10.00	,
	"www.bbc.co.uk/webwise"			:	100.00	,
	"www.bbc.co.uk/skillswise"		:	15.88	,
	"www.bbc.co.uk/learning"		:	9.03	,
	"www.bbc.co.uk/languages"		:	10.00	,
	"www.bbc.co.uk/food"			:	0.56	,
	"www.bbc.co.uk/gardening"		:	36.77	,
	"www.bbc.co.uk/health"			:	8.23	,
	"www.bbc.co.uk/holiday"			:	74.55	,
	"www.bbc.co.uk/homes"			:	63.89	,
	"www.bbc.co.uk/parenting"		:	84.81	,
	"www.bbc.co.uk/sn"			:	8.09	,
	"www.bbc.co.uk/religion"		:	100.00	,
	"www.bbc.co.uk/schools/gcsebitesize"	:	5.00	,
	"www.bbc.co.uk/bristol"			:	4.05	,
	"www.bbc.co.uk/threecounties"		:	7.17	,
	"www.bbc.co.uk/southyorkshire"		:	17.04	,
	"www.bbc.co.uk/somerset"		:	32.51	,
	"www.bbc.co.uk/tees"			:	44.83	,
	"www.bbc.co.uk/manchester"		:	3.82	,
	"www.bbc.co.uk/cornwall"		:	3.94	,
	"www.bbc.co.uk/nottingham"		:	3.98	,
	"www.bbc.co.uk/london"			:	0.51	,
	"www.bbc.co.uk/berkshire"		:	36.59	,
	"www.bbc.co.uk/northernireland"		:	48.17	,	
	"www.bbc.co.uk/scotland"		:	2.49	,
	"www.bbc.co.uk/wales"			:	11.45	,
	"www.bbc.co.uk/cymru"			:	30.00	,
	"www.bbc.co.uk/1xtra"			:	9.11	,
	"www.bbc.co.uk/6music"			:	10.00	,
	"www.bbc.co.uk/asiannetwork"		:	44.08	,
	"www.bbc.co.uk/radio1"			:	0.00	,
	"www.bbc.co.uk/radio2"			:	0.53	,
	"www.bbc.co.uk/radio3"			:	10.00	,
	"www.bbc.co.uk/radio4"			:	0.08	,
	"www.bbc.co.uk/radio/aod"		:	36.17	,	
	"www.bbc.co.uk/fivelive"		:	2.59	,
	"www.bbc.co.uk/bbc7"			:	10.00	,	
	"www.bbc.co.uk/music"			:	12.10	,
	"www.bbc.co.uk/weather"			:	0.00	,
	"news.bbc.co.uk"			:	0.00	,
	"news.bbc.co.uk/1/hi/wales"		:	0.15	,
	"news.bbc.co.uk/welsh"			:	6.27	,
	"news.bbc.co.uk/sport"			:	0.00	,
	"news.bbc.co.uk/cbbcnews"		:	0.45	,
	"www.bbc.co.uk/dna/actionnetwork"	:	25.00	,
	"www.bbc.co.uk/dna/h2g2"		:	100.00	,
	"www.bbc.co.uk/dna/collective"		:	100.00	,
	"www.bbc.co.uk/cgi-bin/search"		:	0.00	,
	"mrinterview.nopworld.com/arts" 	:	50	
	};
	
	var myNum=0 ;				// The number of the site we're on
	var mySite="";				// The short name of the site we're on
	
	var thissite=document.location.href; // Get the URL of the current page (to specify which page we're coming in from to the 
						// survey. It is possible to block HTTP_REFERRER so we use this instead)
	
	
	for (var oursite in Site) { 
	
		var reg = new RegExp(oursite, "i");
		
		
		if (thissite.match(reg)) { 
		
				
			myNum=Site[oursite]; // Incidence
			mySite=oursite; // Site name
			
			
		}
	}

	
	
	// alert(mySite + " (incidence " + myNum +  ")");
	
		

	// Other variables
					
	var INTERVIEW_IF_NO_COOKIES=0;	// How to treat a user that doesn't accept cookies.
					// Theoretically they could get popped up more than once, which we might not want
					// 0=no interview if no cookies, 1=interview anyway
					
	
	var SURVEY_URL="http://surveys.surveys.com/projects/j660072m/start.asp";	// The location of the survey / landing page
	var SURVEY_HEIGHT=600		// height of popup window
	var SURVEY_WIDTH=500;		// width of popup window
					// for the survey popup, we suggest use of the following
					// SURVEY_HEIGHT=screen.height; (subtract 25 to stop the 
					// questionnaire obscuring the start bar)
					// SURVEY_WIDTH=screen.width
					// this ensures the most possible space for the survey itself
					
	var PROJECT_NAME='j660072m'; 	// Project name (cookie name too)

	
	// the contents of this variable are what gets put into the DHTML popup

	// Standard pop up
	
	popupHTML='<table border="0" width="400" height="200" bgcolor="#FFFFFF" cellspacing="0" cellpadding="5" style="border:solid black 2px"><tr><td style="border-bottom: solid black 2px; background: #ffffff" width="100%" align="right"><img src="http://surveys.surveys.com/projects/j660072m/x.gif" onclick="close_popup();" style="cursor:hand;"></td></tr><tr><td><font color="#000000" face="Verdana" size="2"><b><center><p>We want to know what you think of our website!</p></center></b></font><font color="#000000" face="Verdana" size="0"><p>Can you spare 5 minutes to answer some questions for us?</p><p>Please click <a style="color:blue" href="http://surveys.surveys.com/projects/j660072/start.asp?fromsrc=' + mySite + '" onclick="close_popup(); return true;" target="_new">here</a> to take part.</p><p>If you do not want to answer these questions, just close the window and enjoy the BBC website.</b></p></font></td></tr><tr><td align="center"><img src="http://surveys.surveys.com/projects/j660072/icon_bbc_mmi.gif"><tr></td></table>';


	if (mySite=="www.bbc.co.uk/cbeebies") { 

		// CBEEBIES pop up

		popupHTML='<table border="0" width="400" height="200" bgcolor="#FFFFFF" cellspacing="0" cellpadding="5" style="border:solid black 2px"><tr><td style="border-bottom: solid black 2px; background: #ffffff" width="100%" align="right"><img src="http://surveys.surveys.com/projects/j660072m/x.gif" onclick="close_popup();" style="cursor:hand;"></td></tr><tr><td><font color="#000000" face="Verdana" size="2"><b><center><p>We want to know what you think of our website!</p></center></b></font><font color="#000000" face="Verdana" size="0"><p>Can you spare 5 minutes to answer some questions for us?</p><p><u>This survey is for adults only</u></p><p>Please click <a style="color:blue" href="http://surveys.surveys.com/projects/j660072/start.asp?fromsrc=' + mySite + '" onclick="close_popup(); return true;" target="_new">here</a> to take part.</p><p>If you do not want to answer these questions, just close the window and enjoy the BBC website.</b></p></font></td></tr><tr><td align="center"><img src="http://surveys.surveys.com/projects/j660072/icon_bbc_mmi.gif"><tr></td></table>';
	
	}

	if (mySite=="www.bbc.co.uk/cymru" || mySite=="news.bbc.co.uk/welsh" ) { 
	
	// WELSH  pop up  for www.bbc.co.uk/cymru and news.bbc.co.uk/welsh
	
		popupHTML='<table border="0" width="400" height="200" bgcolor="#FFFFFF" cellspacing="0" cellpadding="5" style="border:solid black 2px"><tr><td style="border-bottom: solid black 2px; background: #ffffff" width="100%" align="right"><img src="http://surveys.surveys.com/projects/j660072m/x.gif" onclick="close_popup();" style="cursor:hand;"></td></tr><tr><td><font color="#000000" face="Verdana" size="2"><b><center><p>Rydym am wybod beth ydych chi\'n feddwl o\'n gwefan!</p></center></b></font><font color="#000000" face="Verdana" size="0"><p>A allwch chi roi 5 munud i ateb rhai cwestiynau?</p><p><a style="color:blue" href="http://surveys.surveys.com/projects/j660072/start.asp?fromsrc=' + mySite + '" onclick="close_popup(); return true;" target="_new">Os yr hoffech ateb yr holiadur, a wnewch chi ddilyn y cyswllt hwn os gwelwch yn dda</a>.</p><p>Os nad ydych am ateb y cwestiynau hyn, caewch y ffenestr hon a mwynhewch wefan y BBC.</b></p></font></td></tr><tr><td align="center"><img src="http://surveys.surveys.com/projects/j660072/icon_bbc_mmi.gif"><tr></td></table>'; 


	}


	if (mySite=="www.bbc.co.uk/shakespeare" ) { 
	
	// Shakespeare pop up to get around Flash
	
	popupHTML='<table border="0" width="600" height="30" bgcolor="#FFFFFF" cellspacing="0" cellpadding="5" style="border:solid black 2px"><tr><td style="border-bottom: solid black 2px; background: #ffffff" width="100%" align="right"><img src="http://surveys.surveys.com/projects/j660072m/x.gif" onclick="close_popup();" style="cursor:hand;"></td></tr><tr><td><font color="#000000" face="Verdana" size="1"><b><center>We want to know what you think of our website!</b></font><font color="#000000" face="Verdana" size="0"><br>Can you spare 5 minutes to answer some questions for us?<br>Please click <a style="color:blue" href="http://surveys.surveys.com/projects/j660072/start.asp?fromsrc=' + mySite + '" onclick="close_popup(); return true;" target="_new">here</a> to take part.<br>If you do not want to answer these questions, just close the window and enjoy the BBC website.</center></b></font></td></tr><tr><td align="center"><img src="http://surveys.surveys.com/projects/j660072/icon_bbc_mmi.gif"><tr></td></table>';


	}




	if (mySite=="mrinterview.nopworld.com/arts") { 
//		popupHTML="TEST";
	}

	//--------------------------------------- DON'T CHANGE ANYTHING BELOW HERE --------------------------//

	
	
	
	
	
	
	
	
	
	// Functions to set, get and delete cookies
	// First, to set a cookie - set a 3 month expiry date. Year is handled automatically if the month spills over
	
	var theDate=new Date();
	month=theDate.getMonth();
	month=month+3; 
	theDate.setMonth(month);
	
	
	
	function set_cookie(cookiename,value) { 
		document.cookie = cookiename + "=" + value +";expires=" + theDate +";path=/";
		//alert("Cookie set");
	}
	
	function get_cookie(cookiename) {
	
		// document.cookie gives us a list of all the cookies from this domain
		// we need to find just the cookie we are interested in
		// take a substring between "cookiename=" and ";" - this is the value of the cookie
		// this function will return either the value of the cookie, or a null value if it's not there
		
  		var nameStr = cookiename + "=";
  		var maxLen = document.cookie.length
  		var i = 0
  		while (i < maxLen) {
    			var j = i + nameStr.length
    			if (document.cookie.substring(i,j) == nameStr) {
       				var cookieEnd = document.cookie.indexOf(";",j);
			
       				if (cookieEnd == -1) {
	          				cookieEnd = document.cookie.length;
       				}

				       return unescape(document.cookie.substring(j,cookieEnd));
    			}
    		i++
  		}
  		return "";
	}
	
	// simply erase the cookie by making it expire before now
	
	function erase_cookie(cookiename) { 
		document.cookie = cookiename + "=0;expires=Sun, 26 Mar-2000 12:00:00 GMT;path=/";
		//alert("Cookie erased");
	}
	
	// do they accept cookies?
	// simply drop a test cookie and try to retrieve it. if it's not there, they don't take cookies
	
	function check_cookie_accept() { 
		set_cookie('testaccept','1'); 
		var ck=get_cookie('testaccept');
		if (ck==1) { 
			//alert('This browser accepts cookies');
			return 1;
		}
		else { 
			//alert('This browser is not cookie capable');
			return 0;
		}
		// erase it for good measure
		
		erase_cookie('testaccept');
	
	}
		


// 	function to test whether someone should get our popup
// 	jknight@nopworld.com
	
	function incidence_rate(incidence) { 
	
		var percentage=incidence; 
		var randNum = Math.round(Math.random() * 100);
				
		if (randNum<=percentage) { 
			return 1; // success
		}
		else { 
			return 0; // failed
		
		}
	}



//	popup testing

// 	First we check to see if the user accepts cookies - if they don't, we don't pop them at all



	var ok_to_continue=check_cookie_accept();	

	if (INTERVIEW_IF_NO_COOKIES==1) { ok_to_continue=1 } 	// if we want them to get it even if they don't accept cookies, 
							// pretend they passed
							

	var done_already=get_cookie(PROJECT_NAME);		// have they got our cookie already?
		
	if (done_already) {
		
		// Comment out this code if we're going LIVE
		
		if (do_alert==1) { 
			delete_this_cookie=confirm("This person has already been presented the pop-up in the past 3 months. Do you want to delete the cookie now?"); 
		
				if (delete_this_cookie==true) { 
					erase_cookie(PROJECT_NAME);
					alert("The cookie has been deleted. Please refresh. You may need to close down and reopen your browser if you still get cookie messages.");
				
				}

		}		
		
	}
		
	if (mySite=="") { ok_to_continue = 0; } 
	
	if (ok_to_continue && !done_already) { 
		
			
		var check_popup=incidence_rate(myNum);

					
		if (check_popup) { 
	
			set_cookie(PROJECT_NAME,"1");
				

			
			document.getElementById("nop").innerHTML=popupHTML;
			document.getElementById("nop").style.visibility="visible";
		

			
				if (mySite!="www.bbc.co.uk/shakespeare" ) { 
			recenter_popup(); // function to work out position for popup
				}
		
		}
		else { 
			if (do_alert==1) { 
				alert("We would have popped this person, but they fell outside of our percentage (" + 	myNum + "%)");
					
			}
		}
	}
		
	
	//document.write("OK TO CONTINUE " + ok_to_continue  + "<br>");
	//document.write(" <span onclick=\"erase_cookie('j243614_survey')\">DONE ALREADY</span> " + done_already);
		
	
		
	// Function to close the DHTML popup (or, in real times, make it invisible)
	
	function close_popup() { 
	
		document.getElementById("nop").style.visibility="hidden";
				
	}
	
	// Close the DHTML popup and start the survey in a new window
	function start_survey() { 
		
		close_popup(); 
	
		window.open(SURVEY_URL + "?id=random&fromsrc=" + mySite ,"win");
				
	}
	
	// Function to center the popup on the screen
	

	window.onresize=recenter_popup; // If they resize the window, we recenter, to keep everything neat
	

	}
	
// // bbc http://www.bbc.co.uk//survey/insight05/live/popup_handler2.js	
//-->



