if( location.pathname == "/system/pages/news" ) {
	
	var trap = false;
	var regex = /(\w+):\/\/([\w:.]+)(\/\S*)/;
	
	var selector = [];

	// Determine whether a link has the context to be a feed view link
	function isViewLink( aRef ) {
		var value = false;
		
		if( aRef.firstChild ) {
			var child = aRef.firstChild;
			
			if( child.tagName == "IMG" ) {
				var src = child.src;
				var match = child.src.match( regex );
				if( match ) {
					var path = match[3];
					value = path == "/system/images/qbullet/search.gif";
				}
			}
		}
		
		return value;
	}
		
	// Find all view links in the current document	
	function findViewLinks() {
		var links = document.getElementsByTagName( "a" );
		
		var viewLinks = [];
		
		for( var i = 0; i < links.length; i++ ) {
			if( isViewLink( links[i] ) ) {
				viewLinks.push( links[i] );
			}
		}
		
		return viewLinks;
	}
	
	function dumpStr( str ) {
		dump( str + "\n" );
	}
	
	function dumpNode( nodeRef ) {
		dumpStr( "Node[type="+nodeRef.nodeType+",name='"+nodeRef.nodeName+"',class='"+nodeRef.className+"',value='"+nodeRef.nodeValue+"']" );
	}
	
	function dumpRow( rowRef ) {
		dump( "Row(header=" + isHeaderRow( rowRef ) + ") -> " );
		dumpNode( rowRef );
	}
	
	// Return a reference to the row which contains the link anchor tag
	function getContainingRow( aRef ) {
		return aRef.parentNode.parentNode;
	}
	
	// Returns true if the specified row is a table header row
	function isHeaderRow( nodeRef ) {
		return nodeRef.cells[0].className == "dwsTableCellHeader";
	}
	
	function nextRow( nodeRef ) {
// 		dumpRow( nodeRef );
		
		nodeRef = nodeRef.nextSibling;
		while( nodeRef != null && nodeRef.nodeType == 3 ) {
			nodeRef = nodeRef.nextSibling;
		}
		
// 		dumpRow( nodeRef );
		
		return nodeRef;
	}
	
	// Get all rows following the specified row up to the last row or the next table header row (which ever comes soonest)
	function getSubordinateRows( aRef ) {
		var subordinateRows = [];
		
// 		dumpStr( "\n--------------------\nFind suborindates" );
		
		var headerRow = getContainingRow( aRef );
// 		dumpRow( headerRow );
		
		var row = nextRow( headerRow );
		while( row != null && !isHeaderRow( row ) ) {
// 			dumpRow( row );
			subordinateRows.push( row );
			row = nextRow( row );
		}
		
		return subordinateRows;		
	}
	
	function processCheckboxes( index, value ) {
		var rows = getSubordinateRows( selector[index] );
		
		for( var i = 0; i < rows.length; i++ ) {
			var row = rows[i];
			var cell = row.cells[0];
			var input = cell.firstChild;
			input.checked = value;
		}
	}
	
	function makeVisible( index ) {
		if( index < selector.length ) {
			var rows = getSubordinateRows( selector[index] );
			dumpNode( rows[0].cells[0].firstChild );
			rows[0].cells[0].firstChild.focus();
		}
	}
	
	function select( index ) {
		processCheckboxes( index, true );
		makeVisible( index+1 );
	}
	
	function deselect( index ) {
		processCheckboxes( index, false );
		makeVisible( index + 1 );
	}
	
	function appendSelect( index, linkRef ) {
		var elem = document.createElement( "a" );
		elem.appendChild( document.createTextNode( "select" ) );
		elem.href = "javascript:select( " + index + " )";
		linkRef.parentNode.appendChild( document.createTextNode( " " ) );
		linkRef.parentNode.appendChild( elem );
	}
	
	function appendDeselect( index, linkRef ) {
		var elem = document.createElement( "a" );
		elem.appendChild( document.createTextNode( "deselect" ) );
		elem.href = "javascript:deselect( " + index + " )";
		linkRef.parentNode.appendChild( document.createTextNode( " " ) );
		linkRef.parentNode.appendChild( elem );
	}
	
	function appendFunctions( index, linkRef ) {
		appendSelect( index, linkRef );
		appendDeselect( index, linkRef );
}
	
	var viewLinks = findViewLinks();
	for( var i = 0; i < viewLinks.length; i++ ) {
		var link = viewLinks[i];
		var index = selector.length;
		selector[index] = link;
		
		appendFunctions( index, link );
	}
}
