window.onload = function ()
{
	var node_a = document.getElementsByTagName('a');
	var num = node_a.length;
	var i;
	var strHref = location.href.replace("test_", "");

	for (i=0; i<num; i++)
	{
		if(node_a[i].className != null)
		{
			// aタグのhrefと現在表示中のページのURLが同じだったら、背景に色をつける
			if(strHref == node_a[i].href)
			{
				node_a[i].style.backgroundColor="#ffcc33";
			}

			if(node_a[i].className == 'popup')
			{
				node_a[i].onclick = function()
				{
					return winOpen(this.href, this.rel)
				};
			}
		}
	}
};

// <a href="[filename]" class="popup" rel="[width],[height],[toolbar],[location],[status],[menubar],[scrollbars],[resizable],[windowname]">
function winOpen(url, rel)
{
	var split = rel.split(',') ;
	var str = "";
	if(split[0] != "")
	{
		str += 'width=' + split[0];
	}

	if(split[1] != "")
	{
		str += ',height=' + split[1];
	}

	str += ',toolbar=' + split[2] + ',location=' + split[3] + ',status=' + split[4] + ',menubar=' + split[5] + ',scrollbars=' + split[6] + ',resizable=' + split[7];

	if(split[8] != "")
	{
		strWindowName = split[8]
	}
	else
	{
		strWindowName = 'popup'
	}

	var win = null;
	win = window.open(url,strWindowName,str);
	if(win != undefined && win != null)
	{
		win.focus();
	}
	return false;
};
