var left = 0;
var top = 0;
var width = 400;
var height = 450;


var yt_left = 0;
var yt_top = 0;
var yt_width = 445;
var yt_height = 370;

var j = 0;
var openwindows = Array();

var g;
var d;
var st;

function setGlobals(gs, ds, sts)
{
	g = gs;
	d = ds;
	st= sts;
}
function p(songdataid)
{
	left += 30;
	top += 30;

	if ( (left + width) > screen.width )
	{
		left -= (screen.width - width);
	}

	if ( (top + height) > screen.height )
	{
		top -= (screen.height - height);
	}


	if ( obj = window.open('songs.php?submit&s=' + songdataid + '&d=' + d + '&g=' + g + '&st=' + st, 's_' + songdataid, "left=" + left + ", top=" + top + ", width="+width+", height="+height+", toolbar=no, scrollbars=yes, resizable=yes") )
	{
		openwindows[j] = obj;
		j++;
	}
	return false;
}
function y(key)
{
	yt_left += 30;
	yt_top += 30;

	if ( (yt_left + yt_width) > screen.width )
		yt_left -= (screen.width - yt_width);

	if ( (yt_top + yt_height) > screen.height )
		yt_top -= (screen.height - yt_height);

	window.open('viewyoutube.php?key=' + key, 'y_' + key, "left=" + yt_left + ", top=" + yt_top + ", width="+yt_width+", height="+yt_height+", toolbar=no, scrollbars=yes, resizable=yes");
	return false;
}
function closescores()
{
	for(i = 0; i < openwindows.length; i++)
		openwindows[i].close();
}
