var photo = 0;


function sayit()
{
	var form = document.getElementById('rsForm');
	//var content = document.getElementById('rsText');

	if (navigator.appName=="Microsoft Internet Explorer")
	{
		if (window.getSelection) // recent Mozilla versions
		{
			var selectedString = window.getSelection();
		}
		else if (document.all) // MSIE 4+
		{
			rng = document.selection.createRange();
			selectedString = rng.text;
		}
	}
	else
	{
		var selectedString = window.getSelection(); // works for all browsers except IE
	}
	if (window.location.href)
	{
		//document.rs_form.url.value = window.location.href;
		form.url.value = window.location.href;
	}
	else if (document.location.href)
	{
		//document.rs_form.url.value = document.location.href;
		form.url.value = document.location.href;
	}
	//document.rs_form.rstext.value = selectedString;
	form.rstext.value = selectedString;
}

function copyselected()
{
	setTimeout("sayit()",50);
	return true;
}

document.onmouseup = copyselected;
document.onkeyup = copyselected;

function popup(id,x,y)
{
	x = parseInt(x);
	y = parseInt(y);

	photoX = x+30;
	photoY = y+115;

	var left = (screen.width-photoX)/2;
	var top = (screen.height-photoY)/2;

	if (!photo.closed && photo.location)
	{
		photo.moveTo(left, top);
		photo.resizeTo(photoX,photoY);
		photo.location.href = '/kids-pictures-popup.php?id=' + id + '';
	}
	else
	{
		photo=window.open('/kids-pictures-popup.php?id=' + id + '', 'photoPopup','resizable=no,width='+ photoX +',height='+ photoY +',scrollbars=0,top=' + top + ',left=' + left + '');
		if (!photo.opener) photo.opener = self;
		photo.resizeTo(photoX,photoY);
		photo.moveTo(left, top);
	}
	if (window.focus)
	{
		photo.focus();
	}
}