kTreeColGroupAtom         	= NS_NewAtom("treecolgroup");
XULSortServiceImpl::XULSortServiceImpl(void){	NS_INIT_REFCNT();	if (gRefCnt == 0)	{	        kTreeAtom            		= NS_NewAtom("tree");	        kTreeCellAtom        		= NS_NewAtom("treecell");		kTreeChildrenAtom    		= NS_NewAtom("treechildren");		kTreeColAtom         		= NS_NewAtom("treecol");		kTreeItemAtom        		= NS_NewAtom("treeitem");		kContainerAtom			= NS_NewAtom("container");		kResourceAtom        		= NS_NewAtom("resource");		kResource2Atom        		= NS_NewAtom("resource2");		kSortActiveAtom			= NS_NewAtom("sortActive");		kSortResourceAtom		= NS_NewAtom("sortResource");		kSortResource2Atom		= NS_NewAtom("sortResource2");		kSortDirectionAtom		= NS_NewAtom("sortDirection");		kSortSeparatorsAtom		= NS_NewAtom("sortSeparators");		kIdAtom				= NS_NewAtom("id");		kRDF_type			= NS_NewAtom("type");  		trueStr				= "true"; 		nsresult rv;		if (NS_FAILED(rv = nsServiceManager::GetService(kRDFServiceCID,						  kIRDFServiceIID, (nsISupports**) &gRDFService)))		{			NS_ERROR("couldn't create rdf service");		}		rv = nsServiceManager::GetService(kXULContentUtilsCID,						nsCOMTypeInfo<nsIXULContentUtils>::GetIID(),						(nsISupports**) &gXULUtils);		NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get XUL content utils");		// get a locale factory 		nsCOMPtr<nsIFactory>		aFactory;		nsCOMPtr<nsILocaleFactory>	localeFactory;		if (NS_SUCCEEDED(rv = nsComponentManager::FindFactory(kLocaleFactoryCID, getter_AddRefs(aFactory)))			&& ((localeFactory = do_QueryInterface(aFactory)) != nsnull))		{			nsCOMPtr<nsILocale>	locale;			if (NS_SUCCEEDED(rv = localeFactory->GetApplicationLocale(getter_AddRefs(locale))) && (locale))			{				nsCOMPtr<nsICollationFactory>	colFactory;				if (NS_SUCCEEDED(rv = nsComponentManager::CreateInstance(kCollationFactoryCID, NULL,						kICollationFactoryIID, getter_AddRefs(colFactory))))				{					if (NS_FAILED(rv = colFactory->CreateCollation(locale, &collationService)))					{						NS_ERROR("couldn't create collation instance");					}				}				else				{					NS_ERROR("couldn't create instance of collation factory");				}			}			else			{				NS_ERROR("unable to get application locale");			}		}		else		{			NS_ERROR("couldn't get locale factory");		}		gRDFService->GetResource(kURINC_Name, 				&kNC_Name);		gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf",	&kRDF_instanceOf);		gRDFService->GetResource(RDF_NAMESPACE_URI "Seq",		&kRDF_Seq);	        // Register the XUL and RDF namespaces: these'll just retrieve	        // the IDs if they've already been registered by someone else.		nsINameSpaceManager* mgr;		if (NS_SUCCEEDED(rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,		                           nsnull,		                           kINameSpaceManagerIID,		                           (void**) &mgr)))		{			static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;			rv = mgr->RegisterNameSpace(kXULNameSpaceURI, kNameSpaceID_XUL);			NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XUL namespace");			rv = mgr->RegisterNameSpace(kRDFNameSpaceURI, kNameSpaceID_RDF);			NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register RDF namespace");			NS_RELEASE(mgr);		}		else		{			NS_ERROR("couldn't create namepsace manager");		}	}	++gRefCnt;}