context: function OpenSearch( tabName, forceDialogFlag, aSearchStr, engineURIs ){	var searchMode = 0;	var searchEngineURI = null;	var autoOpenSearchPanel = false;	var defaultSearchURL = null;	try	{    if( pref ) {  		searchMode = pref.GetIntPref("browser.search.powermode");	  	autoOpenSearchPanel = pref.GetBoolPref("browser.search.opensidebarsearchpanel");      if( !engineURIs )  		  searchEngineURI = pref.CopyCharPref("browser.search.defaultengine");  		defaultSearchURL = pref.CopyCharPref("browser.search.defaulturl");    }	}	catch(ex)	{	}		if ( !defaultSearchURL )		defaultSearchURL = "http://search.netscape.com/cgi-bin/search?search=";	if( searchMode == 1 || forceDialogFlag )	{		// Use a single search dialog    var windowManager = getService( "component://netscape/rdf/datasource?name=window-mediator", "nsIWindowMediator" );		var searchWindow = windowManager.getMostRecentWindow("search:window");		if (searchWindow)		{			searchWindow.focus();			if( searchWindow.loadPage )	        searchWindow.loadPage( tabName, searchStr );		}		else			top.openDialog("chrome://communicator/content/search/search.xul", "SearchWindow", "dialog=no,close,chrome,resizable", tabName, searchStr);	}	else	{    var searchDS = Components.classes["component://netscape/rdf/datasource?name=internetsearch"].getService();    if( searchDS )      searchDS = searchDS.QueryInterface( Components.interfaces.nsIInternetSearchService );  	if( searchDS )		{  	  if( !aSearchStr )         return false;    	var	escapedSearchStr = escape( aSearchStr );			searchDS.RememberLastSearchText( escapedSearchStr );  		try  		{        if( !engineURIs || ( engineURIs && engineURIs.length <= 1 ) ) {          // not called from sidebar or only one engine selected          if( engineURIs )          {            searchEngineURI = engineURIs[0];            gURL = "internetsearch:engine=" + searchEngineURI + "&text=" + escapedSearchStr;          }          // look up the correct search URL format for the given engine          var	searchURL = searchDS.GetInternetSearchURL( searchEngineURI, escapedSearchStr );          if( searchURL )          {            defaultSearchURL = searchURL;          }          else           {            defaultSearchURL = defaultSearchURL + escapedSearchStr;            gURL = "";          }          // load the results page of selected or default engine in the content area          if( defaultSearchURL )            top._content.location.href = defaultSearchURL;        }        else {          // multiple providers          searchURL = "";          for( var i = 0; i < engineURIs.length; i++ )           {            if( searchURL == "" )              searchURL = "internetsearch:";            else              searchURL += "&";            searchURL += "engine=" + engineURIs[i];          }          searchURL += ( "&text=" + escapedSearchStr );                    gURL = searchURL;                    top._content.location.href = "chrome://communicator/content/search/internetresults.xul";        }  		}  		catch(ex)  		{  		}        	setTimeout("checkSearchProgress('" + searchURL + "')", 1000);    }	}}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/f697476c976a15f8edf37dcd34a311fcafaf157e/search-panel.js/clean/suite/common/search/search-panel.js