// Ensure that the prepareLinks function is called once the page has
// been loaded and the Document Object Model created
window.onload = prepareLinks;

function prepareLinks() 
{
	// Get an array containing references to all of the <a> elements on the page
	var links = document.getElementsByTagName("a");
	for (var i=0; i < links.length; i++) 
	{
		// The following is a cross-browser workaround.  The problem is that IE for Windows
		// does not like attributes that are the same name as JavaScript reserved words and
		// 'class' is a reserved word.  So, in IE for Windows, 'className' needs to be used 
		// instead of 'class'.  In Firefox, 'class' is the correct attribute name.  Testing for both
		// will work in all browsers.
		if (links[i].getAttribute("className") == "newwindow" ||
		    links[i].getAttribute("class") == "newwindow")
		{
			// If the <a> element has an attribute 'class="newwindow"', set the onclick
			// method to be a call to the newWindowfunction
			links[i].onclick = function() 
									{
										newWindow(this.getAttribute("href")); return false;
									}
		}
	}
}

function newWindow(winURL) 
{
	window.open(winURL,"popup","");
}

