rem:  var categoryText = categoryList.options[ categoryList.selectedIndex ].text; var textElement = document.getElementById( "categoryNameText" ); textElement.setAttribute( "value", categoryText );  settingsButton.value = settingsButtonText + categoryText;  
context: function SearchPanelStartup(){	settingsButton = document.getElementById("btn.Advanced");	settingsButtonText = settingsButton.getAttribute("value");  bundle = srGetStrBundle( "chrome://search/locale/search-panel.properties" );   	var tree = document.getElementById("Tree");	if (tree)	{		var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();		if (rdf)   rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);		if (rdf)		{			rootNode = rdf.GetResource("NC:LastSearchRoot", true);			textArc = rdf.GetResource("http://home.netscape.com/NC-rdf#LastText", true);			tree.database.AddObserver(RDF_observer);		}	}	var categoryList = document.getElementById("categoryList");	if (categoryList)	{		var internetSearch = Components.classes["component://netscape/rdf/datasource?name=internetsearch"].getService();		if (internetSearch)	internetSearch = internetSearch.QueryInterface(Components.interfaces.nsIInternetSearchService);		if (internetSearch)		{			var catDS = internetSearch.GetCategoryDataSource();			if (catDS)	catDS = catDS.QueryInterface(Components.interfaces.nsIRDFDataSource);			if (catDS)			{				categoryList.database.AddDataSource(catDS);				var ref = categoryList.getAttribute("ref");				if (ref)	categoryList.setAttribute("ref", ref);			}		}			}    try {    var pref = Components.classes["component://netscape/preferences"].getService();    if( pref )      pref = pref.QueryInterface( Components.interfaces.nsIPref );    var lastCategoryName = pref.CopyCharPref( "browser.search.last_search_category" );  }  catch( e ) {    var lastCategoryName = "";  }  dump("*** lastCategoryName = " + lastCategoryName + "\n");  var categoryList = document.getElementById( "categoryList" );  if( categoryList ) {  	 //set to default value 'the web'	 //hack: hardcoded postion in here replace with a function that finds the entry 'the web'	     // set the category name on the advanced panel    var categoryText = categoryList.options[ categoryList.selectedIndex ].text;    var textElement = document.getElementById( "categoryNameText" );    textElement.setAttribute( "value", categoryText );    //set the category name on the settings button    settingsButton.value = settingsButtonText + categoryText;        for( var i = 0; i < categoryList.options.length; i++ )    {      if( ( lastCategoryName == "" && categoryList.options[i].value == "NC:SearchEngineRoot" ) ||          ( categoryList.options[i].getAttribute("id") == lastCategoryName ) ) {        categoryList.selectedIndex = i;      }    }    if( lastCategoryName == "" )      lastCategoryName = "NC:SearchEngineRoot";    else      lastCategoryName = "NC:SearchCategory?category=" + lastCategoryName;  	var treeNode = document.getElementById("searchengines");  	treeNode.setAttribute( "ref", lastCategoryName );  }  loadEngines( lastCategoryName );}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/06c4a47e8f558e755c2c2bcc6a10eb09eb22ec14/search-panel.js/buggy/xpfe/components/search/resources/search-panel.js