


/**
 * This array is used to remember mark status of rows in browse mode
 */
var marked_row = new Array;
var last_marked_unique_id = 0;

/**
 * enables highlight and marking of rows in data tables
 *
 */
function PMA_markRowsInit() {

    // for every table row ...
    var rows = document.getElementById("tblTopics").getElementsByTagName('tr');
    for ( var i = 0; i < rows.length; i++ ) {
        // ... with the class 'odd' or 'even' ...
        if ( 'odd' != rows[i].className.substr(0,3) && 'even' != rows[i].className.substr(0,4) ) {
           continue;
        }
        // ... add event listeners ...
        // ... to highlight the row on mouseover ...
        if ( navigator.appName == 'Microsoft Internet Explorer' ) {
            // but only for IE, other browsers are handled by :hover in css
            rows[i].onmouseover = function() {
                this.className += ' hover';
            }
            rows[i].onmouseout = function() {
                this.className = this.className.replace( ' hover', '' );
            }
        }
        // Do not set click events if not wanted
        if (rows[i].className.search(/noclick/) != -1) {
            continue;
        }
        // ... and to mark the row on click ...
        rows[i].onmousedown = function() {
			
			var unique_id = this.id;
			
			if (last_marked_unique_id > 0 ) unMarkRow(last_marked_unique_id);
			
            if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
                this.className += ' marked';
				last_marked_unique_id = unique_id;
				window.parent.UpdateDetailsIFrame(unique_id);
				return;
            }

        }

    }
}
window.onload=PMA_markRowsInit;



function unMarkRow( unique_id ) {

    var row = document.getElementById(unique_id);
	if (row) {
		row.className = row.className.replace(' marked', '');
		marked_row[unique_id] = false;
	}
    return true;
}

