/*Popup window script*/

//add popup code to relevant links dynamically
//links must have class="popup"
function prepareLinks()
{
	if (document.getElementById)
	{
		//add popup handlers to selected links
		var _links = document.getElementsByTagName('a');
		for (x=0; x<_links.length; x++)
		{
			var _link = _links[x];
			if (_link.className.indexOf("popup") > -1)
			{
				//_link.title = "This page will open in a new window.";
				_link.onclick = function ()
				{
					var popup = window.open(this.getAttribute('href'), 'popup', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1');
					if (popup != null)
					{
						if (popup.focus)
						{
							popup.focus();
						}
					}
					return false;
				}
			}
		}
	}
}

if (window.addEventListener)
{
	window.addEventListener('load',prepareLinks,false)
}
else if (window.attachEvent)
{
	window.attachEvent('onload',prepareLinks)
}
//this will over-write any previously defined "onload" event
//window.onload = prepareLinks;
