in redback/components/apidocs/assets/search_autocomplete.js [31:103]
function sync_selection_table(toroot)
{
var filtered = document.getElementById("search_filtered");
var r; //TR DOM object
var i; //TR iterator
gSelectedID = -1;
filtered.onmouseover = function() {
if(gSelectedIndex >= 0) {
set_row_selected(this.rows[gSelectedIndex], false);
gSelectedIndex = -1;
}
}
//initialize the table; draw it for the first time (but not visible).
if (!gInitialized) {
for (i=0; i<ROW_COUNT; i++) {
var r = filtered.insertRow(-1);
var c1 = r.insertCell(-1);
// var c2 = r.insertCell(-1);
c1.className = "jd-autocomplete";
// c2.className = "jd-autocomplete jd-linktype";
var link = document.createElement("a");
c1.onmousedown = function() {
window.location = this.firstChild.getAttribute("href");
}
c1.onmouseover = function() {
this.className = this.className + " jd-selected";
}
c1.onmouseout = function() {
this.className = "jd-autocomplete";
}
c1.appendChild(link);
}
/* var r = filtered.insertRow(-1);
var c1 = r.insertCell(-1);
c1.className = "jd-autocomplete jd-linktype";
c1.colSpan = 2; */
gInitialized = true;
}
//if we have results, make the table visible and initialize result info
if (gMatches.length > 0) {
document.getElementById("search_filtered_div").className = "showing";
var N = gMatches.length < ROW_COUNT ? gMatches.length : ROW_COUNT;
for (i=0; i<N; i++) {
r = filtered.rows[i];
r.className = "show-row";
set_row_values(toroot, r, gMatches[i]);
set_row_selected(r, i == gSelectedIndex);
if (i == gSelectedIndex) {
gSelectedID = gMatches[i].id;
}
}
//start hiding rows that are no longer matches
for (; i<ROW_COUNT; i++) {
r = filtered.rows[i];
r.className = "no-display";
}
//if there are more results we're not showing, so say so.
/* if (gMatches.length > ROW_COUNT) {
r = filtered.rows[ROW_COUNT];
r.className = "show-row";
c1 = r.cells[0];
c1.innerHTML = "plus " + (gMatches.length-ROW_COUNT) + " more";
} else {
filtered.rows[ROW_COUNT].className = "hide-row";
}*/
//if we have no results, hide the table
} else {
document.getElementById("search_filtered_div").className = "no-display";
}
}