// Kick-A asthma arcade game

$(document).ready(function() {
	var lastShow = $('#firstShow');
	var lastLink = $('#firstLink');
	$('#arcade-game li').hover(function() {
		lastLink.removeClass('selected');
		lastShow.hide();
		(lastLink = $(this)).addClass('selected');
		(lastShow = $('img',this)).show();
	}, function() {
		return false;
	});
	
	$('ul#arcade-game h2 a').click(function(event) {
		gameconsole(event.target);
		event.preventDefault();
	});
	
});

function gameconsole(element) {
	var videoVars = $(element).attr('href').split("?width="); //get the dimensions
	dimensions = videoVars[1].split("&height="); // split the two dimensions; they're either side of the '&amp;height='
	window.open(videoVars[0],'Video console','width='+dimensions[0]+',height='+dimensions[1]+',scrollbars=1');
}