rem: var internetSearch = Components.classes[ISEARCH_CONTRACTID].getService(nsIInternetSearchService); if (internetSearch) { var catDS = internetSearch.GetCategoryDataSource(); if (catDS)	catDS = catDS.QueryInterface(nsIRDFDataSource); if (catDS) { var categoryList = document.getElementById("categoryList"); if (categoryList) { categoryList.database.AddDataSource(catDS); var ref = categoryList.getAttribute("ref"); if (ref)	categoryList.setAttribute("ref", ref); } var engineTree = document.getElementById("searchengines"); if (engineTree) { engineTree.database.AddDataSource(catDS); var ref = engineTree.getAttribute("ref"); if (ref)	engineTree.setAttribute("ref", ref); } } } 
add: var tree = document.getElementById("Tree"); tree.database.AddObserver(RDF_observer); 
context: function SearchPanelStartup(){	bundle = srGetStrBundle( STRINGBUNDLE_URL );	var tree = document.getElementById("Tree");	if (tree)	{        var rdf = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);		if (rdf)		{			rootNode = rdf.GetResource("NC:LastSearchRoot", true);			textArc = rdf.GetResource("http://home.netscape.com/NC-rdf#LastText", true);			modeArc = rdf.GetResource("http://home.netscape.com/NC-rdf#SearchMode", true);			tree.database.AddObserver(RDF_observer);		}	}    var internetSearch = Components.classes[ISEARCH_CONTRACTID].getService(nsIInternetSearchService);	if (internetSearch)	{		var catDS = internetSearch.GetCategoryDataSource();		if (catDS)	catDS = catDS.QueryInterface(nsIRDFDataSource);		if (catDS)		{			var categoryList = document.getElementById("categoryList");			if (categoryList)			{				categoryList.database.AddDataSource(catDS);				var ref = categoryList.getAttribute("ref");				if (ref)	categoryList.setAttribute("ref", ref);			}			var engineTree = document.getElementById("searchengines");			if (engineTree)			{				engineTree.database.AddDataSource(catDS);				var ref = engineTree.getAttribute("ref");				if (ref)	engineTree.setAttribute("ref", ref);			}		}	}	// try and determine last category name used  var lastCategoryName = nsPreferences.copyUnicharPref("browser.search.last_search_category", "");  if (lastCategoryName) {    // strip off the prefix if necessary    var prefix = "NC:SearchCategory?category=";    if (lastCategoryName.indexOf(prefix) == 0)      lastCategoryName = lastCategoryName.substr(prefix.length);  }	// select the appropriate category	var categoryList = document.getElementById( "categoryList" );	var categoryPopup = document.getElementById( "categoryPopup" );	if( categoryList && categoryPopup )	{	 	var found = false;		for( var i = 0; i < categoryPopup.childNodes.length; i++ )		{			if( ( lastCategoryName == "" &&			      categoryPopup.childNodes[i].getAttribute("data") == "NC:SearchEngineRoot" ) ||			    ( categoryPopup.childNodes[i].getAttribute("id") == lastCategoryName ) )			{				categoryList.selectedItem = categoryPopup.childNodes[i];				found = true;				break;			}		}		if (found == false)		{			categoryList.selectedItem = categoryPopup.childNodes[0];		}    		if (( lastCategoryName == "" ) || (lastCategoryName == null))		{			lastCategoryName = "NC:SearchEngineRoot";		}		if (lastCategoryName != "NC:SearchEngineRoot")		{			lastCategoryName = "NC:SearchCategory?category=" + lastCategoryName;		}		var treeNode = document.getElementById("searchengines");		treeNode.setAttribute( "ref", lastCategoryName );	}	loadEngines( lastCategoryName );	var searchMode = updateSearchMode();	// if we have search results, show them, otherwise show engines	if ((haveSearchResults() == true) || (searchMode == 0))	{		switchTab(0);	}	else	{		switchTab(1);	}}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/c837d8cd69e2d1c5d2619fe01ec4c3979b2e5f7e/search-panel.js/buggy/suite/common/search/search-panel.js