function display_screenshot(name, image, description)
{
    url = document.location.href;
	url = String(url);
	match = url.match(/\/(perinatal|developmental|nursery|antepartum)\//);
	product = match[1];
	
	var name_of = new Object;
	name_of.perinatal = "The Perinatal Data Center";
	name_of.developmental = "The Infant Development Center";
	name_of.nursery = "The Daily Baby Center";
	name_of.antepartum = "The Antepartum Testing Center";
	
	product_name = name_of[product];
	
    popup_win = window.open('','name','height=720,width=825,left=100,top=100,location=0,menubar=0,status=0');
	
	popup_win.document.write('<html><head><title>Site of Care Systems | ' + name + '</title><base href="http://www.siteofcare.com/" /><link rel="stylesheet" media="screen" type="text/css" href="css/screenshot.css"></style><script type="text/javascript" src="js/behaviour.js"></script></head><body onblur="window.close()"><h1>' + name + '</h1><p id="center">' + product_name + '</p><img src="' + image + '"><p>' + description + '</p><p id="close_window"><a href="javascript:window.close();">[close window]</a></p></body></html>');
    popup_win.document.close();
    popup_win.document.title = name;
	popup_win.focus();
}

function setup_screenshots()
{
	var screenshots = document.getElementById("screenshots");
	for(var obj = screenshots.firstChild; obj != null; obj = obj.nextSibling)
	{
		if(obj.nodeName == 'TBODY');
		for(var tr = obj.firstChild; tr != null; tr = tr.nextSibling)
		{
			var th = tr.firstChild;
			var td = th.nextSibling;
			if (td.nodeName != 'TD') { td = td.nextSibling; }
			
			var image = th.firstChild.href;
			var name = th.firstChild.firstChild.nextSibling.data;
			
			var description = td.innerHTML;
			description = description.replace(/'/g, "&#39;")
			th.firstChild.href = "javascript:display_screenshot('" + name + "','" + image + "','" + description + "')";
			th.firstChild.target = '';
		}
	}
//	alert(screenshots);
}

Behaviour.addLoadEvent(setup_screenshots);
