//GRIDCLUB
//JAVACRIPT CODE TO OPEN ACTIVITY POPUP WINDOW
//Author: Simon Buckingham 26th August 2009

var newWindow;
var newWindowTitle;
var intervalID;

var max_popup_width, max_popup_height;
max_popup_width = 1024.0;
//max_popup_width = screen.availWidth;
//if (document.documentElement && document.documentElement.clientWidth)
//{
	//ie
	max_popup_width = max_popup_width - 8;  //allows for extra side GUI pixels in IE
//}
//max_popup_height = screen.availHeight;
max_popup_height = Math.min(screen.availHeight, 768);

var popup_width, popup_height;

//detect platform
var myPlatform;
//alert(navigator.platform);
if (navigator.platform.toLowerCase().indexOf("mac") != -1)
{
	myPlatform = "mac";
}
else
{
	myPlatform = "win";
}

//open picture popup window
function openActivity(activityCode)
{
	var top, left;//top and left coord of window - should be centred in screen
	var urlPath, url;//relative path to games folder
	var displayPath;
	var activityData, dims;  //objects
	var scrollbarsCondition, resizeableCondition;
	
	urlPath = '/subscribers/';
	//urlPath = 'http://www.gridclub.com/subscribers/';
	//urlPath = '../original/httpdocs/games/';
	displayPath = 'www.gridclub.com/subscribers/';
	
	dims = getNewWindowDims(activityCode);
	popup_width = dims.width;
	popup_height = dims.height;
	
	activityData = getActivityData(activityCode);
	title = activityData.title;
	url = urlPath + activityData.url;
	
	//calculate centred window coords
	left = (screen.availWidth - popup_width)/2;
	//offset slightly to centre on steel window of main site if in full browser window
	left = left - 15;
	top = (screen.availHeight - popup_height)/2;
	if (left < 0) left = 0;
	if (left < 10) left = 0;
	if (top < 0) top = 0;
	if (top < 10) top = 0;
	
	//if a window is already open close it so we never get 2 open windows
	if (newWindow != null)
	{
		if (newWindow.open)
		{
			newWindow.close();
		}
	}
	if (activityData.scrollbars)
		scrollbarsCondition = 'yes';
	else
		scrollbarsCondition = 'no';
	//if (activityData.resize)
//		resizeableCondition = 'yes';
//	else
//		resizeableCondition = 'no';
	//force resizeability
	resizeableCondition = 'yes';
	newWindow = window.open(url,'newWin','width=' + popup_width + ',height=' + popup_height + ',toolbar=no,directories=no,status=no,location=yes,menubar=no,scrollbars=' + scrollbarsCondition + ',resizable=' + resizeableCondition + ',top=' + top + ',left=' + left);
	
	if (!newWindow)
	{
		alert("I am sorry, but we are unable to open this activity. Activities open in a popup window. Please configure your software to allow popups from www.gridclub.com to work. This may be, for example, a browser, anti-virus or system setting.");
		return false;
	}
	
	newWindow.focus();
	newWindowTitle = title + ' (' + displayPath + url + ')';
	
	//change the window title to show the activity URL for the user to link to without going through gridclub.com
	//NB they will have to be logged in to access the activity and if not, they will be redirected to a login page
	//setTimeout('setWindowTitle()', 3000);
	//following works in FF not in IE6
	//newWindow.onload = setWindowTitle;
	
	//delay a bit until window is open before starting poll to check if window is open
	setTimeout('startCheckIfWindowClosed()', 3000);
	
	dimPage();
	
	//disable clicking main window!!??
	//alert("window opener is " + newWindow.opener);
//	if (newWindow.opener != null)
//	{
//		newWindow.opener.onfocus = refocusWindow;
//	}

	return true;
	
}

function refocusWindow()
{
	newWindow.focus();
}

function tabbedPopupOpened()
{
	dimPage();
}

function tabbedPopupClosed()
{
	undimPage();
}

function dimPage()
{
	//darken background
	
	//set z-index for different platforms as on Mac Flash doesn't respect div layer z index
	//alert("in dim page");
	//alert("myPlatform is " + myPlatform);
  //alert(navigator.platform);
	if (myPlatform == "mac")
	{
		document.getElementById("dimlayer").style.zIndex = -1;
	}
		
	//show layer
	document.getElementById("dimlayer").style.display = "block";
}

function undimPage()
{
	//remove darkened background
	document.getElementById("dimlayer").style.display = "none";
}
		 
function setWindowTitle(title)
{
	//alert("setting title");
	newWindow.document.title = title;
}

function startCheckIfWindowClosed()
{
	//set interval  to poll whether window is open. Simple way to detect when user closes window or even if window has been closed with code.
	intervalID = setInterval('checkIfWindowClosed()', 1000);
}

function checkIfWindowClosed()
{
	if (newWindow.closed && intervalID != null)
	{
		clearInterval(intervalID);
		windowClosed();
	}
}

function windowClosed()
{
	//alert("window closed");
	
	swfobject.getObjectById("gridclubFlash").onActivityClosed();
	
	//remove darkened background
	undimPage();
}

// close window from Flash running in browser
function closeWindowFromFlash()
{
	//alert("Closing window from Flash and newWindow.open is " + newWindow.open);
	if (newWindow != null)
	{
		newWindow.close();
	}
	//remove darkened background
	undimPage();
}

// close window
function closeWindow()
{
	self.close();
}

function getNewWindowDims(activityCode)
{
	var activityData;
	var width, height;
	var titleBarHeight;
	var newDims;
	
	activityData = getActivityData(activityCode);
	width = activityData.width;
	height = activityData.height;
	
	if (width == 0 && height == 0)
	{
		width = 1016;
		height = 740;
	}
	
	//resize to maximum size that fits max size of window maintaining aspect ratio
	if (activityData.resize)
	{
		titleBarHeight = 0;
		//height = Math.floor((max_popup_width*height)/width) + titleBarHeight;
		//width = Math.floor(max_popup_width);
		newDims = getNormalisedDims(max_popup_width, max_popup_height, width, height);
		width = newDims.width;
		height = newDims.height;
	}
	
	//adjust for Firefox on Windows
	//if ((navigator.userAgent.toLowerCase().indexOf("firefox") != -1) && myPlatform == "win")
	//{
		//height = height - 23;
	//}
	
	return {width:width, height:height};
}

function getFlashDims(activityCode)
{
	var innerWindowDims, activityData;
	var newFlashDims;
	
	innerWindowDims = getInnerWindowDims();
	activityData = getActivityData(activityCode);
	
	innerWindowDims.width = innerWindowDims.width - 2*activityData.border;
	innerWindowDims.height = innerWindowDims.height - 2*activityData.border;
	
	newFlashDims = getNormalisedDims(innerWindowDims.width, innerWindowDims.height, activityData.width, activityData.height);
	return newFlashDims;
}

function getNormalisedDims(windowWidth, windowHeight, flashWidth, flashHeight)
{
	var windowAspect, flashAspect;
	var newFlashWidth, newFlashHeight;
	
	windowAspect = windowWidth/windowHeight;
	flashAspect = flashWidth/flashHeight;
	if (flashAspect > windowAspect)
	{
		//if an external link to a browser window that is smaller than default activity width then use default activity width rather than window width
		//newWidth = Math.max(innerWindowDims.width, originalWidth);
		newFlashWidth = windowWidth;
		newFlashHeight = Math.floor((newFlashWidth*flashHeight)/flashWidth);
	}
	else
	{
		newFlashHeight = windowHeight;
		newFlashWidth = Math.floor((newFlashHeight*flashWidth)/flashHeight);
	}
	return {width: newFlashWidth, height: newFlashHeight};
}

function getInnerWindowDims() {
  var innerWidth = 0, innerHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    innerWidth = window.innerWidth;
    innerHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    innerWidth = document.documentElement.clientWidth;
    innerHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    innerWidth = document.body.clientWidth;
    innerHeight = document.body.clientHeight;
  }
	return {width: innerWidth, height: innerHeight};
}

var _activityCode;
var _flashID;

function setFlash(activityCode, flashID, flashDivName, flashFileName, newFlashVars)
{
	_activityCode = activityCode;
	_flashID = flashID;
	
	var activityData;    //activityData is an object
	activityData = getActivityData(activityCode);  

	var dims;   ///dims is an object
	dims = getFlashDims(activityCode);

	var flashvars = {};
	//if (newFlashVars != null)
		//flashVars = newFlashVars;
	//else
		//flashVars = {};
		
	var params = {};
	params.scale = "noborder";
	params.salign = "lt";
	var attributes = {};
	attributes.id = flashID;
	attributes.align = "top";
	//attributes.salign = "lt";
	//attributes.scale = "noborder";
	
	//bug in Chrome because it loads JavaScript asynchronously means swfobject may not be defined yet... hence this fix??
	//while (swfobject == null) {}
	if (swfobject == null) alert("Error: swfobject is null.");
	
	swfobject.embedSWF(flashFileName, flashDivName, dims.width, dims.height, "9.0.16", "/subscribers/site2009/scripts/expressInstall.swf", flashvars, params, attributes);
	//swfobject.embedSWF(flashFileName, flashDivName, 100%, 100%, "9.0.16", "/subscribers/site2009/scripts/expressInstall.swf", flashvars, params, attributes);
	
	document.title = activityData.title;
}

//window.onresize = function ()
//{
//	resizeFlash(_activityCode, _flashID);
//};	

function resizeFlash(activityCode, flashID)
{
	var dims;
	dims = getFlashDims(activityCode);
	
	//document.getElementById("flash_div").style.width = dims.width;
	//document.getElementById("flash_div").style.height = dims.height;
	swfobject.getObjectById(flashID).width = dims.width;
	swfobject.getObjectById(flashID).height = dims.height;
}
		
function getActivityData(activityCode)
{
	var url, title, width, height, resize, border;
	var absoluteURL;
	var scrollbars;//if true show scrollbars in popup window
	var resizeable;//if true allow popup window resizing - browser may not support disabling this!
	
	resize = false;
	scrollbars = false;
	resizeable = true;
	border = 0;
	switch (activityCode)
	{
		// ART -->
		case 'art_factory': url = 'games/art/art/start_2009.html'; title = 'Art Factory'; width = 770; height = 325; resize = true; break;
		case 'make_a_portrait': url = 'games/general/games/make_portrait/start_2009.html'; title = 'Make a Portrait'; width = 770; height = 350; resize = true; break;
		
		// DESIGN & TECHNOLOGY -->
		case 'brunels_britain': url = 'games/dt/brunels_britain_wai/start_2009.html'; title = 'Brunel\'s Britain'; width = 770; height = 540; resize = true; break;
		case 'cyberpets': url = 'extras/cyberpets/default.php'; title = 'Cyberpets'; width = 800; height = 620; resize = false; scrollbars=true; break;
		case 'design_a_sweet_wrapper': url = 'games/general/games/design_chocolate/start_2009.html'; title = 'Design a Sweet Wrapper'; width = 900; height = 409; resize = true; break;
		case 'design_studio': url = 'games/dt/designstudio_2009/index.shtml'; title = 'Design Studio'; width = 0; height = 0; resize = false; break;
		case 'make_an_aeroplane': url = 'games/general/games/homework_fly/start_2009.html'; title = 'Make an Aeroplane'; width = 900; height = 409; resize = true; break;
		case 'print_and_go': url = 'games/dt/printandgo/start_2009.html'; title = 'Print and Go'; width = 900; height = 372; resize = true; break;
		
		// ENGLISH -->
		case 'a_christmas_carol': url = 'games/english/classics/dickens/animation.html'; title = 'A Christmas Carol'; width = 750; height = 570; break;
		case 'a_midsummer_nights_dream': url = 'games/english/classics/shakespeare/animation.html'; title = 'A Midsummer Night\'s Dream'; width = 750; height = 570; break;
		case 'comma_castle': url = 'games/english/comma_castle/site/start_2009.html'; title = 'Comma Castle'; width = 770; height = 350; resize = true; break;
		case 'do_the_right_thing': url = 'games/english/right_thing_2009/index.shtml'; title = 'Do the Right Thing'; width = 770; height = 350; resize = false; break;
		case 'george_and_mabel': url = 'games/english/george_and_mabel/index.html'; title = 'George and Mabel'; width = 800; height = 570; resize = true; break;//just ratio!
		case 'gullivers_travels': url = 'games/english/classics3/gulliver/swift/animation.html'; title = 'Gulliver\'s Travels'; width = 750; height = 570; break;
		case 'jabberwocky': url = 'games/english/classics2/carroll/animation.html'; title = 'Jabberwocky'; width = 750; height = 570; break;
		case 'little_bug': url = 'games/english/little_bug/index.html'; title = 'Little Bug'; resize = true; width = 900; height = 680; break;
		case 'spellbound': url = 'games/english/spellbound/www/start_2009.html'; title = 'Spellbound'; resize = true; width = 770; height = 490; break;
		case 'tell_a_story_in_60_seconds': url = 'games/general/games/tell_story/start_2009.html'; title = 'Tell a Story in 60 Seconds'; width = 770; height = 350; resize = true; break;
		case 'the_imaginator': url = 'games/english/imaginator_2009/index.html'; title = 'The Imaginator'; width = 0; height = 0; scrollbars=true; break;
		case 'the_siege_of_troy': url = 'games/english/classics/homer/animation.html'; title = 'The Siege of Troy'; width = 750; height = 570; break;
		case 'verbassic_island': url = 'games/english/verbassic_island/start_2009.html'; title = 'Verbassic Island'; width = 750; height = 520; resize = true; break;
		case 'word_know_how': url = 'games/english/wordknowhow/start_2009.html'; title = 'Word Know How'; width = 770; height = 318; resize = true; break;
		case 'write_a_news_item': url = 'games/general/games/planet_warming/start_2009.html'; title = 'Write a News Item'; width = 770; height = 350; resize = true; break;
		case 'write_now': url = 'games/english/write_now/start_2009.html'; title = 'Write Now'; width = 770; height = 318; resize = true; break;
		case 'zoogleburst': url = 'games/english/zoogleburst/start_2009.html'; title = 'Zoogleburst'; width = 770; height = 350; resize = true; break;
		
		// GEOGRAPHY -->
		case 'eet': url = 'games/geography/eet/start_2009.html'; title = 'Eet'; width = 720; height = 540; resize = true; break;
		case 'finding_zeebo': url = 'games/geography/zeebo/start_2009.html'; title = 'Finding Zeebo'; width = 770; height = 445; resize = true; break;
		case 'my_world': url = 'games/geography/myworld/start_2009.html'; title = 'My World'; width = 770; height = 318; resize = true; break;
		case 'scottish_geography': url = 'games/geography/gridplayer_geog/playerframe2.htm'; title = 'Video Clips (Scotland)'; width = 800; height = 700; scrollbars = true; break;
		case 'uk_quest': url = 'info/quest/start_2009.html'; title = 'UK Quest'; width = 788; height = 540; resize = true; break;
		
		// HEALTH -->
		case 'cybercafe': url = 'games/citizenship/cybercafe/start_2009.html'; title = 'Cybercafe'; width = 770; height = 370; resize = true; break;
		case 'dance_in_time': url = 'games/general/games/dance/start_2009.html'; title = 'Dance in Time'; width = 770; height = 350; resize = true; break;
		case 'mission_inedible': url = 'games/citizenship/mission_inedible/start_2009.html'; title = 'Mission Inedible'; width = 770; height = 318; resize = true; break;
		case 'sportastic': url = 'games/pe/sportastic_2009/sportastic_info/index.shtml'; title = 'Sportastic'; width = 1000; height = 550; scrollbars=true; break;
		case 'streetwise': url = 'games/citizenship/streetwise/start_2009.html'; title = 'Streetwise'; width = 770; height = 350; resize = true; break;
		case 'you_are_what_you_eat': url = 'games/citizenship/what_you_eat/interactive.shtml'; title = 'You Are What You Eat'; width = 770; height = 350; resize = true; break;
		
		// HISTORY -->
		//timeline
		case 'ancient_egypt': url = 'games/history/timetunnel_2009/period/egy/environ/egyenv/egyenv.shtml'; title = 'Time Tunnel - Egyptian Pyramids'; width = 770; height = 350; resize = true; break;
		case 'ancient_greece': url = 'games/history/timetunnel_2009/period/gre/environ/greenv/greenv.shtml'; title = 'Time Tunnel - Greek City'; width = 770; height = 350; resize = true; break;
		case 'anglo_saxons': url = 'games/history/timetunnel_2009/period/ang/environ/angenv/angenv.shtml'; title = 'Time Tunnel - Anglo-Saxon Village'; width = 770; height = 350; resize = true; break;
		case 'aztecs': url = 'games/history/timetunnel_2009/period/azt/environ/aztenv/aztenv.shtml'; title = 'Time Tunnel - Aztec Great Temple'; width = 770; height = 350; resize = true; break;
		case 'britain_since_1930': url = 'games/history/timetunnel_2009/period/bri/environ/brienv/brienv.shtml'; title = 'Time Tunnel - Modern British Town'; width = 770; height = 350; resize = true; break;
		case 'romans': url = 'games/history/timetunnel_2009/period/rom/environ/romenv/romenv.shtml'; title = 'Time Tunnel - Roman Settlement'; width = 770; height = 350; resize = true; break;
		case 'tudors': url = 'games/history/timetunnel_2009/period/tud/environ/tudenv/tudenv.shtml'; title = 'Time Tunnel - Tudor Great Hall'; width = 770; height = 350; resize = true; break;
		case 'victorians': url = 'games/history/timetunnel_2009/period/vic/environ/vicenv/vicenv.shtml'; title = 'Time Tunnel - Victorian Parlour'; width = 770; height = 350; resize = true; break;
		case 'vikings': url = 'games/history/timetunnel_2009/period/vik/environ/vikenv/vikenv.shtml'; title = 'Time Tunnel - Viking Port'; width = 770; height = 350; resize = true; break;
		//timeline games
		case 'ancient_egypt_draa': url = 'games/history/timetunnel_2009/period/egy/games/draa/'; title = 'Time Tunnel - Egyptian Gods'; width = 770; height = 350; resize = true; break;
		case 'ancient_egypt_quia': url = 'games/history/timetunnel_2009/period/egy/games/quia/'; title = 'Time Tunnel - Mummy Making Quiz'; width = 770; height = 350; resize = true; break;
		case 'ancient_egypt_tsla': url = 'games/history/timetunnel_2009/period/egy/games/tsla/'; title = 'Time Tunnel - Terrific Hieroglyphics'; width = 770; height = 350; resize = true; break;
		case 'ancient_greece_draa': url = 'games/history/timetunnel_2009/period/gre/games/draa/'; title = 'Time Tunnel - Great Greek Gods'; width = 770; height = 350; resize = true; break;
		case 'ancient_greece_quia': url = 'games/history/timetunnel_2009/period/gre/games/quia/'; title = 'Time Tunnel - Olympic Games'; width = 770; height = 350; resize = true; break;
		case 'ancient_greece_tsla': url = 'games/history/timetunnel_2009/period/gre/games/tsla/'; title = 'Time Tunnel - Alphabet Challenge'; width = 770; height = 350; resize = true; break;
		case 'anglo_saxons_buia': url = 'games/history/timetunnel_2009/period/ang/games/buia/'; title = 'Time Tunnel - Bayeux Builder'; width = 770; height = 350; resize = true; break;
		case 'anglo_saxons_quia': url = 'games/history/timetunnel_2009/period/ang/games/quia/'; title = 'Time Tunnel - You Be The Judge'; width = 770; height = 350; resize = true; break;
		case 'anglo_saxons_tsla': url = 'games/history/timetunnel_2009/period/ang/games/tsla/'; title = 'Time Tunnel - Anglo Saxon Translation Game'; width = 770; height = 350; resize = true; break;
		case 'aztecs_buia': url = 'games/history/timetunnel_2009/period/azt/games/buia/'; title = 'Time Tunnel - Scary Sacrifice'; width = 770; height = 350; resize = true; break;
		case 'aztecs_quia': url = 'games/history/timetunnel_2009/period/azt/games/quia/'; title = 'Time Tunnel - Feast or Fiction?'; width = 770; height = 350; resize = true; break;
		case 'aztecs_quib': url = 'games/history/timetunnel_2009/period/azt/games/quib/'; title = 'Time Tunnel - Conquering Conquistadors Quiz'; width = 770; height = 350; resize = true; break;
		case 'britain_since_1930_draa': url = 'games/history/timetunnel_2009/period/bri/games/draa/'; title = 'Time Tunnel - Space Race'; width = 770; height = 350; resize = true; break;
		case 'britain_since_1930_loca': url = 'games/history/timetunnel_2009/period/bri/games/loca/'; title = 'Time Tunnel - Home Front'; width = 770; height = 350; resize = true; break;
		case 'britain_since_1930_quia': url = 'games/history/timetunnel_2009/period/bri/games/quia/'; title = 'Time Tunnel - TV Times'; width = 770; height = 350; resize = true; break;
		case 'romans_loca': url = 'games/history/timetunnel_2009/period/rom/games/loca/'; title = 'Time Tunnel - Roman Baths Game'; width = 770; height = 350; resize = true; break;
		case 'romans_quia': url = 'games/history/timetunnel_2009/period/rom/games/quia/'; title = 'Time Tunnel - Mosaic Mayhem'; width = 770; height = 350; resize = true; break;
		case 'romans_quib': url = 'games/history/timetunnel_2009/period/rom/games/quib/'; title = 'Time Tunnel - Roman Remains'; width = 770; height = 350; resize = true; break;
		case 'tudors_draa': url = 'games/history/timetunnel_2009/period/tud/games/draa/'; title = 'Time Tunnel - Tricky Tudor Trading'; width = 770; height = 350; resize = true; break;
		case 'tudors_drac': url = 'games/history/timetunnel_2009/period/tud/games/drac/'; title = 'Time Tunnel - Hooray Henry VIII'; width = 770; height = 350; resize = true; break;
		case 'tudors_drad': url = 'games/history/timetunnel_2009/period/tud/games/drad/'; title = 'Time Tunnel - Rags to Riches'; width = 770; height = 350; resize = true; break;
		case 'tudors_loca': url = 'games/history/timetunnel_2009/period/tud/games/loca/'; title = 'Time Tunnel - Tudor Town & Country'; width = 770; height = 350; resize = true; break;
		case 'tudors_quia': url = 'games/history/timetunnel_2009/period/tud/games/quia/'; title = 'Time Tunnel - Spanish Armada Game'; width = 770; height = 350; resize = true; break;
		case 'victorians_draa': url = 'games/history/timetunnel_2009/period/vic/games/draa/'; title = 'Time Tunnel - Vile Victorian Work'; width = 770; height = 350; resize = true; break;
		case 'victorians_loca': url = 'games/history/timetunnel_2009/period/vic/games/loca/'; title = 'Time Tunnel - Back to School'; width = 770; height = 350; resize = true; break;
		case 'victorians_quia': url = 'games/history/timetunnel_2009/period/vic/games/quia/'; title = 'Time Tunnel - Brave Balloonists'; width = 770; height = 350; resize = true; break;
		case 'victorians_quib': url = 'games/history/timetunnel_2009/period/vic/games/quib/'; title = 'Time Tunnel - Victorious Vehicles'; width = 770; height = 350; resize = true; break;
		case 'vikings_buia': url = 'games/history/timetunnel_2009/period/vik/games/buia/'; title = 'Time Tunnel - Viking Vessel Game'; width = 770; height = 350; resize = true; break;
		case 'vikings_mata': url = 'games/history/timetunnel_2009/period/vik/games/mata/'; title = 'Time Tunnel - Dangerous Dane Dress'; width = 770; height = 350; resize = true; break;
		case 'vikings_quia': url = 'games/history/timetunnel_2009/period/vik/games/quia/'; title = 'Time Tunnel - Vicious Vikings'; width = 770; height = 350; resize = true; break;
		
		//timeline main base
		case 'history_time_tunnel': url='games/history/timetunnel_2009/mainmenu/1/2/3/mainmenu.shtml'; title = 'Time Tunnel Main menu'; width = 770; height = 350; resize = true; break;
		case 'history_time_tunnel_intro': url='games/history/timetunnel_2009/intro.shtml'; title = 'Time Tunnel - intro movie'; width = 770; height = 350; resize = true; break;
		//scots history
		case 'castle_siege': url = 'games/history/scotshistory_2009/castles/'; title = 'Castle Siege'; width = 776; height = 425; resize = true; break;
		case 'jacobite_escape': url = 'games/history/scotshistory_2009/jacobites/'; title = 'Jacobite Escape'; width = 776; height = 425; resize = true; break;
		case 'roman_retreat': url = 'games/history/scotshistory_2009/romans/'; title = 'Roman Retreat'; width = 776; height = 425; resize = true; break;
		case 'stone_age_survival': url = 'games/history/scotshistory_2009/stoneage/'; title = 'Stone Age Survival'; width = 776; height = 425; resize = true; break;
		case 'suffragette_city': url = 'games/history/scotshistory_2009/suffragettes/'; title = 'Suffragette City'; width = 776; height = 425; resize = true; break;
		case 'vikings_trade_or_raid': url = 'games/history/scotshistory_2009/vikings/'; title = 'Vikings: trade or raid?'; width = 776; height = 425; resize = true; break;
		//scots history home
		case 'scots_history_home': url = 'games/history/scotshistory_2009/'; title = 'Scottish History Home'; width = 776; height = 425; resize = true; break;
		//video HTML activity
		case 'scottish_history': url = 'games/history/gridplayer_history/playerframe2.htm'; title = 'Video Clips (Scotland)'; width = 800; height = 700; scrollbars=true; break;
		//nelson
		case 'nelson': url = 'games/history/nelson200/start_2009.html'; title = 'Nelson'; width = 770; height = 540; resize = true; break;
		
		// ICT -->
		case 'build_a_computer_game': url = 'games/general/games/computer_game/index_2009.shtml'; title = 'Build a Computer Game'; width = 770; height = 350; break;
		case 'build_a_website': url = 'games/general/games/own_website/start_2009.html'; title = 'Build a Website'; width = 770; height = 350; resize = true; break;
		case 'computer_know_how': url = 'games/ict/computerknowhow_2009/interface.html'; title = 'Computer Know How'; width = 770; height = 420; scrollbars=true; break;
		case 'game_box': url = 'games/ict/gamebox/start_2009.html'; title = 'Game Box'; width = 770; height = 325; resize = true; break;
		case 'robot_artist': url = 'games/ict/robotartists/index_2009.html'; title = 'Robot Artist'; width = 725; height = 330; break;
		
		// LANGUAGES -->
		case 'klik_english': url = 'games/modern_languages/newklik/index_2009.php?lang=en'; title = 'KLIK English'; width = 790; height = 450; resize = true; break;
		case 'klik_french': url = 'games/modern_languages/newklik/index_2009.php?lang=fr'; title = 'KLIK French'; width = 790; height = 450; resize = true; break;
		case 'klik_spanish': url = 'games/modern_languages/newklik/index_2009.php?lang=es'; title = 'KLIK Spanish'; width = 790; height = 450; resize = true; break;
		
		// MATHS -->
		case 'alien_alice': url = 'games/maths/alien_alice/index.html'; title = 'Alien Alice'; width = 900; height = 680; resize = true; break;
		case 'alien_tables': url = 'games/maths/alien_tables/start_2009.html'; title = 'Alien Tables'; width = 550; height = 400; resize = true; break;
		case 'battlestar_mathematica': url = 'games/maths/archipelago/battlestar/site/start_2009.html'; title = 'Battlestar Mathematica'; width = 770; height = 350; resize = true; break;
		case 'coordinate_cops': url = 'games/maths/coordinate_cops/start_2009.html'; title = 'Coordinate Cops'; width = 530; height = 500; resize = true; break;
		case 'decimal_dominoes': url = 'games/maths/decimaldominoes/start_2009.html'; title = 'Decimal Dominoes'; width = 770; height = 318; resize = true; break;
		case 'dessima_point': url = 'games/maths/archipelago/dessimapoint/site/start_2009.html'; title = 'Dessima Point'; width = 770; height = 350; resize = true; break;
		case 'dosh': url = 'games/maths/dosh/start_2009.html'; title = 'Dosh'; width = 770; height = 318; resize = true; break;
		case 'fraction_stations': url = 'games/maths/fraction_stations/start_2009.html'; title = 'Fraction Stations'; width = 820; height = 620; resize = true; break;
		case 'make_a_million': url = 'games/maths/makeamillion2/start_2009.html'; title = 'Make a Million'; width = 770; height = 318; resize = true; break;
		case 'mathmobile_mayhem': url = 'games/maths/mathmobile/start_2009.html'; title = 'Mathmobile Mayhem'; width = 770; height = 318; resize = false; resizeable=false; break;
		case 'number_cruncher': url = 'games/maths/numbercruncher/start_2009.html'; title = 'Number Cruncher'; width = 770; height = 350; resize = true; break;
		case 'number_know_how': url = 'games/maths/archipelago/help/start_2009.html'; title = 'Number Know How'; width = 550; height = 400; resize = true; resizeable=true; break;
		case 'oscars_deep_sea_numbers': url = 'games/maths/oscars_deep_sea_numbers/index.html'; title = 'Oscar\'s Deep Sea Numbers'; width = 900; height = 680; resize = true; break;
		case 'penalty_shoot_out': url = 'games/maths/archipelago/penaltyshootout/site/start_2009.html'; title = 'Penalty Shoot Out'; width = 770; height = 350; resize = true; break;
		case 'radius_of_the_lost_arc': url = 'games/maths/archipelago/radius/site/start_2009.html'; title = 'Radius of the Lost Arc'; width = 770; height = 350; resize = true; break;
		case 'robot_chef': url = 'games/maths/robot_chef/start_2009.html'; title = 'Robot Chef'; width = 770; height = 350; resize = true; break;
		case 'secret_agent': url = 'games/maths/secret_agent/start_2009.html'; title = 'Secret Agent'; width = 775; height = 440; resize = true; border = 20; break;
		case 'worm_bingo': url = 'games/maths/worm_bingo/start_2009.html'; title = 'Worm Bingo'; width = 770; height = 350; resize = true; break;
		case 'working_on_a_market_stall': url = 'games/general/games/market_stall/index_2009.shtml'; title = 'Working on a Market Stall'; width = 770; height = 350; break;
		
		// MUSIC -->
		case 'music_maker': url = 'games/general/games/make_instrument/start_2009.html'; title = 'Music Maker'; width = 770; height = 350; resize = true; break;
		case 'music_studio': url = 'games/music/music_studio_final_2009/musicmatch.shtml'; title = 'Music Studio'; width = 900; height = 500; break;
		case 'spin_n_groove': url = 'games/music/spinngroove/start_2009.html'; title = 'Spin \'n Groove'; width = 870; height = 418; resize = false; break;
		case 'street_corner_symphony': url = 'games/music/streetcornersymphony/start_2009.html'; title = 'Street Corner Symphony'; width = 770; height = 318; resize = true; break;
		
		// SCIENCE -->
		case 'grid_city_1': url = 'games/science/gridcity_2009/1.html'; title = 'Fair Game'; width = 770; height = 350; resize = true; break;
		case 'grid_city_2': url = 'games/science/gridcity_2009/2.html'; title = 'Little Green Visitor'; width = 770; height = 350; resize = true; break;
		case 'grid_city_3': url = 'games/science/gridcity_2009/3.html'; title = 'Living In A Material World'; width = 770; height = 350; resize = true; break;
		case 'grid_city_4': url = 'games/science/gridcity_2009/4.html'; title = 'Hunger Pains'; width = 770; height = 350; resize = true; break;
		case 'grid_city_5': url = 'games/science/gridcity_2009/5.html'; title = 'Towering Appetites'; width = 770; height = 350; resize = true; break;
		case 'grid_city_6': url = 'games/science/gridcity_2009/6.html'; title = 'The World Of Shadows'; width = 770; height = 350; resize = true; break;
		case 'grid_city_7': url = 'games/science/gridcity_2009/7.html'; title = 'Brother Can You Spare a Bone'; width = 770; height = 350; resize = true; break;
		case 'grid_city_8': url = 'games/science/gridcity_2009/8.html'; title = 'Get These Things Off My Boat'; width = 770; height = 350; resize = true; break;
		case 'grid_city_9': url = 'games/science/gridcity_2009/9.html'; title = 'Survival in the Extremes'; width = 770; height = 350; resize = true; break;
		case 'grid_city_10': url = 'games/science/gridcity_2009/10.html'; title = 'Potion Problems'; width = 770; height = 350; resize = true; break;
		case 'grid_city_11': url = 'games/science/gridcity_2009/11.html'; title = 'The Anti-Friction Machine'; width = 770; height = 350; resize = true; break;
		case 'grid_city_12': url = 'games/science/gridcity_2009/12.html'; title = 'You Light Up My House'; width = 770; height = 350; resize = true; break;
		case 'grid_city_13': url = 'games/science/gridcity_2009/13.html'; title = 'Hey Human Are You Nuts?'; width = 770; height = 350; resize = true; break;
		case 'grid_city_14': url = 'games/science/gridcity_2009/14.html'; title = 'Poppy Sorts em Out'; width = 770; height = 350; resize = true; break;
		case 'grid_city_15': url = 'games/science/gridcity_2009/15.html'; title = 'The Big Smell'; width = 770; height = 350; resize = true; break;
		case 'grid_city_16': url = 'games/science/gridcity_2009/16.html'; title = 'The Adventure Of The Rain Drop'; width = 770; height = 350; resize = true; break;
		case 'grid_city_17': url = 'games/science/gridcity_2009/17.html'; title = 'Oops, There Goes The Sun'; width = 770; height = 350; resize = true; break;
		case 'grid_city_18': url = 'games/science/gridcity_2009/18.html'; title = 'Can You Kick It?'; width = 770; height = 350; resize = true; break;
		case 'grid_city_19': url = 'games/science/gridcity_2009/19.html'; title = 'Neds Choice'; width = 770; height = 350; resize = true; break;
		case 'grid_city_20': url = 'games/science/gridcity_2009/20.html'; title = 'Eliminate The Bugs!'; width = 770; height = 350; resize = true; break;
		case 'grid_city_21': url = 'games/science/gridcity_2009/21.html'; title = 'Up Close And Personal'; width = 770; height = 350; resize = true; break;
		case 'grid_city_22': url = 'games/science/gridcity_2009/22.html'; title = 'The Reversing Machine'; width = 770; height = 350; resize = true; break;
		case 'grid_city_23': url = 'games/science/gridcity_2009/23.html'; title = 'No Super Springs'; width = 770; height = 350; resize = true; break;
		case 'grid_city_24': url = 'games/science/gridcity_2009/24.html'; title = 'Lost Reflections'; width = 770; height = 350; resize = true; break;
		case 'grid_city_25': url = 'games/science/gridcity_2009/25.html'; title = 'Grease Monkey'; width = 770; height = 350; resize = true; break;
		case 'grid_city_action': url = 'games/science/gridcity_2009/action.html'; title = 'Grid City Action'; width = 770; height = 350; resize = true; break;
		case 'grid_city_life': url = 'games/science/gridcity_2009/life.html'; title = 'Grid City Life'; width = 770; height = 350; resize = true; break;
		case 'grid_city_stuff': url = 'games/science/gridcity_2009/stuff.html'; title = 'Grid City Stuff'; width = 770; height = 350; resize = true; break;
		case 'life_underwater': url = 'games/general/games/lived_underwater/start_2009.html'; title = 'Life Underwater'; width = 770; height = 350; resize = true; break;
		case 'the_brain_game': url = 'games/science/braingame/start_2009.html'; title = 'The Brain Game'; width = 770; height = 318; resize = true; break;
		case 'the_planets': url = 'games/general/games/other_planets/start_2009.html'; title = 'The Planets'; width = 770; height = 350; resize = true; break;
		
		// EXTRAS -->
		case 'chess_mate': url = 'extras/chess/start_2009.html'; title = 'Chess Mate'; width = 760; height = 450; resize = true; break;
		case 'fact_gadget': url = 'info/fact_gadget_2009/index.html'; title = 'Fact Gadget'; width = 0; height = 0; scrollbars=true; break;
		case 'sats_magic': url = 'info/satsmagic/start_2009.html'; title = 'SATS Magic'; width = 770; height = 325; resize = true; break;
		case 'yo_zone': url = 'extras/yo-zone/'; title = 'Yo Zone'; width = 804; height = 740; scrollbars=true; break;
		case 'wordsearch': url = 'games/braingames/wordsearch/index.shtml'; title = 'Wordsearch'; width = 0; height = 0; scrollbars=true; break;
		case 'gunge': url = 'games/braingames/gunge/index.shtml'; title = 'Gunge'; width = 0; height = 0; scrollbars=true; break;
		
		// SPRAAK (LANGUAGE) 'NETHERLANDS' -->
		case 'koen_en_noor': url = 'games_nl/spraak/koen_en_noor/index.html'; title = 'Koen En Noor'; width = 800; height = 570; resize = true; break;
		
		// MATHEMATICA 'NETHERLANDS' -->
		case 'okkie': url = 'games_nl/mathematica/okkie/index.html'; title = 'Okkie'; width = 900; height = 680; resize = true; break;
		
		// MATH 'DOLLARS' -->
		case 'dessima_point_us': url = 'games_us/math/dessimapoint/site/start_2009.html'; title = 'Dessima Point'; width = 770; height = 350; resize = true; break;
		case 'make_a_million_us': url = 'games_us/math/makeamillion2/start_2009.html'; title = 'Make a Million'; width = 770; height = 318; resize = true; break;
		case 'number_know_how_us': url = 'games_us/math/help/start_2009.html'; title = 'Number Know How'; width = 550; height = 400; resize = true; resizeable=true; break;		
		case 'penalty_shoot_out_us': url = 'games_us/math/penaltyshootout/site/start_2009.html'; title = 'Penalty Shoot Out'; width = 770; height = 350; resize = true; break;
		case 'radius_of_the_lost_arc_us': url = 'games_us/math/radius/site/start_2009.html'; title = 'Radius of the Lost Arc'; width = 770; height = 350; resize = true; break;
		
		// VIDEOS -->
		case 'video_1': url = 'videos/video_1.html'; title = 'Volcano Puppets'; width = 425; height = 355; break;
		case 'video_2': url = 'videos/video_2.html'; title = 'Volcano Poem'; width = 480; height = 385; break;
		case 'video_3': url = 'videos/video_3.html'; title = 'Volcano Iceland'; width = 640; height = 385; break;
		case 'video_4': url = 'videos/video_4.html'; title = 'Volcano Description'; width = 480; height = 385; break;
		case 'video_5': url = 'videos/video_5.html'; title = 'Volcano Song'; width = 480; height = 385; break;
		case 'video_6': url = 'videos/video_6.html'; title = 'Kuroshio Sea'; width = 640; height = 385; break;
		case 'video_7': url = 'videos/video_7.html'; title = 'Dolphin'; width = 480; height = 385; break;
		case 'video_8': url = 'videos/video_8.html'; title = 'School of Fish'; width = 480; height = 385; break;		
		case 'video_9': url = 'videos/video_9.html'; title = 'Star Fish Story'; width = 480; height = 385; break;
		case 'video_10': url = 'videos/video_10.html'; title = 'Poem - Mini Whale'; width = 480; height = 385; break;
		case 'video_11': url = 'videos/video_11_bbc_science.html'; title = 'Water bottle rockets'; width = 975; height = 585; break;
		case 'video_12': url = 'videos/video_12_bbc_science.html'; title = 'How do you make a rainbow'; width = 975; height = 585; break;
		case 'video_13': url = 'videos/video_13_bbc_science.html'; title = 'Angle grinder in a vacuum'; width = 975; height = 585; break;
		case 'video_lyre_bird': url = 'videos/video_lyre_bird.html'; title = 'The Amazing Lyre Bird'; width = 480; height = 385; break;
		
	}
	absoluteURL = "http://www.gridclub.com/subscribers/" + url;
	return {width: width, height: height, url: url, absoluteURL: absoluteURL, title: title, resize: resize, resizeable: resizeable, scrollbars: scrollbars, border: border};
}
