/**
 * Adds an event handler to the event handler list for a given even on a given
 * object in a portable and clean manner. This is better and cleaner than
 * using HTML attributes.
 */
function AddEvent(obj, type, fn)
{
	// If a string was passed in rather than an object, get the object it
	// refers to.
	if (typeof obj == "string")
		obj = document.getElementById(obj);

    // Mozilla/W3C listeners?
    if (obj.addEventListener)
    {
        obj.addEventListener(type, fn, true);
        return true;
    }

    // IE-style listeners?
    if (obj.attachEvent)
        return obj.attachEvent("on" + type, fn);

    return false;
}

/*
 * Catch all the links we want opening in a new window.
 */
AddEvent(window, "load", function()
{
	var handler = function()
	{
		window.open(this.href, null,
			"width=650,height=556,resizable=yes,toolbar=no");
		return false;
	};

	var links = document.getElementsByTagName("a");
	for (var i = 0; i < links.length; i++)
		if (/\bnew-window\b/.test(links[i].className))
			links[i].onclick = handler;
});

