rem: YAHOO.util.Event.on(item, "mouseover", function(ev, ctx) { ctx.this.setCurrentSelection(ctx.index); }, { 'this': this, 'index': selectionIndex, 
add: var mouseOverHandler = function(ev, ctx) { ctx.me.setCurrentSelection(ctx.index); };  YAHOO.util.Event.on(item, "mouseover", mouseOverHandler, { 'me': this, 'index': selectionIndex 
context: CIASearch.displayResults = function(results, query){    if (!results.length) {	this.results.setBody("No results");	return;    }    var lcQuery = query.toLowerCase();    var list = document.createElement('div');    var numExact = 0;    this.selectionList = [];    this.currentSelection = null;    /* Divide the results up by section, and look for exact matches */    var sectionMap = {};    var sectionList = []    for (var i in results) {	var result = results[i];	var section = sectionMap[result.section];	if (!section) {	    section = sectionMap[result.section] = {		results: [],		name: result.section,	        hasExactMatch: false,		hasPrefixMatch: false,		info: this.sectionInfo[result.section]	    };	    sectionList.push(section);	}	var lcTitle = result.title.toLowerCase();	if (lcTitle == lcQuery) {	    result.isExactMatch = true;	    result.isPrefixMatch = true;	    section.hasExactMatch = true;	    numExact += 1;	} else {	    result.isExactMatch = false;	    if (lcTitle.indexOf(lcQuery) == 0) {		result.isPrefixMatch = true;		section.hasPrefixMatch = true;	    } else {		result.isPrefixMatch = false;	    }	}	section.results.push(result);    }    sectionList.sort(function(a, b) {	if (a.hasExactMatch != b.hasExactMatch) {	    return b.hasExactMatch - a.hasExactMatch;	}	if (a.hasPrefixMatch != b.hasPrefixMatch) {	    return b.hasPrefixMatch - a.hasPrefixMatch;	}	return b.info.priority - a.info.priority;    });    /* For each section with results... */    for (var i in sectionList) {	var section = sectionList[i];	/* Section heading */	var heading = document.createElement('div');	YAHOO.util.Dom.addClass(heading, 'search-heading');	heading.innerHTML = section.info.heading;	list.appendChild(heading);	section.results.sort(function(a, b) {	    if (a.isExactMatch != b.isExactMatch) {		return b.isExactMatch - a.isExactMatch;	    }	    if (a.isPrefixMatch != b.isPrefixMatch) {		return b.isPrefixMatch - a.isPrefixMatch;	    }	    if (a.title < b.title) {		return -1;	    }	    if (a.title > b.title) {		return 1;	    }	    return 0;	});	for (var j in section.results) {	    var result = section.results[j];	    /* Each result row is an <a> element */	    var item = document.createElement('a');	    item.href = result.url;	    list.appendChild(item);	    var selectionIndex = this.selectionList.length;	    this.selectionList.push(item);	    YAHOO.util.Event.on(item, "mouseover", function(ev, ctx) {		ctx.this.setCurrentSelection(ctx.index);	    }, {		'this': this,		'index': selectionIndex,	    });	    if (result.isExactMatch && numExact == 1) {		YAHOO.util.Dom.addClass(item, 'search-exact-match');		/*		 * If we got exactly one exact match, and the user		 * already confirmed this query, visit the match now.		 */		if (query == this.confirmedQuery) {		    this.visitSelection(item);		}	    }	    /* Reserve some space equal to our maximum icon size */	    var iconBox = document.createElement('div');	    YAHOO.util.Dom.addClass(iconBox, 'search-icon');	    item.appendChild(iconBox);	    if (result.icon) {		/* Center the icon in iconBox */		var icon = document.createElement('img');		icon.src = result.icon.url;		icon.style.width = result.icon.width + 'px';		icon.style.height = result.icon.height + 'px';		icon.style.left = (this.iconSize - result.icon.width) / 2 + 'px';		icon.style.top = (this.iconSize - result.icon.height) / 2 + 'px';		iconBox.appendChild(icon);	    }	    var title = document.createElement('span');	    title.innerHTML = htmlEscape(result.title);	    item.appendChild(title);	}    }    this.setCurrentSelection(0);    this.results.setBody(list);}
meta: 4793	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/4793/cb2bf1e6b4fc7c188dd6e825d90ad9ce6f42be0a/search.js/buggy/cia/media-src/js/local/search.js