/*
 * ConvertRowsToLinks
 * 
 *    Makes an entire row of an HTML table be a hyperlink. An anchor cannot
 *    span columns.
 *
 * Tom Coppeto
 * 12 May 2007
 */


function ConvertRowsToLinks() {
    var tables = getElementsByClassName("linkedRows");
    for (var j = 0; j < tables.length; j++) {
	var rows = tables[j].getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
	    var link = rows[i].getElementsByTagName("a");
	    if (link.length == 1) {
		if (link[0].getAttribute("rel") == "external") {

		    /*		    rows[i].onclick = function(e) {
			window.open(link[0].href); 
			return (false);
			}*/

		    rows[i].onclick = new Function("window.open('" + link[0].href + "'); return (false); ");

		    rows[i].onkeypress = rows[i].onclick;
		    link[0].setAttribute("rel", "");
		} else {
		    rows[i].onclick = new Function("window.location.href='" + link[0].href + "'");
		}

		rows[i].onmouseover = new Function("this.className='highlight'");
		rows[i].onmouseout = new Function("this.className=''");
	    }
	}
    }
}


addEvent(window, "load", ConvertRowsToLinks);

