0 ) { strTempFile = strMUIDir; strTempFile += strUserUILanguage; strTempFile += "\\"; strTempFile += strLocXMLFileName; bFileLoaded = m_arrObjs[nIndex].loadXML(strTempFile); m_currentUILang = strUserUILanguage; } // Load the default localization file, // if loading the given UI language file failed if ( bFileLoaded == false ) { strTempFile = strDefaultResDir; strTempFile += strLocXMLFileName; bFileLoaded = m_arrObjs[nIndex].loadXML(strTempFile); m_currentUILang = "Default"; } } return m_currentUILang; } //----------------------------------------------------------------------------- // // Method: getNodeTextFromString // // Arguments: (string) strNode - Single node to select // (node) nodParent - Parent node // // Returns: (string) - The value from the attribute or "". // //----------------------------------------------------------------------------- function getNodeTextFromString(strNode, nodParent) { //------------------------------------------------------------------------- // Select the node, or return null if not found //------------------------------------------------------------------------- var pNodeKey; //------------------------------------------------------------------------- // If nodParent undefined or null, then fail //------------------------------------------------------------------------- if(pNodeKey == nodParent || null == nodParent) return null; pNodeKey = nodParent.selectSingleNode(strNode); //------------------------------------------------------------------------- // If not found then return null. //------------------------------------------------------------------------- if(pNodeKey == null) return null; //------------------------------------------------------------------------- // Otherwise return the node text or "" //------------------------------------------------------------------------- return (pNodeKey.text) ? pNodeKey.text : ""; } //----------------------------------------------------------------------------- // // Method: getNodeAttribute // // Arguments: (object) nod - Node to select from // (string) strNode - Single node to select // (string) strAttr - Attribute to retrieve // // Returns: (string) - The value from the attribute or null. // //----------------------------------------------------------------------------- function getNodeAttribute(nod, strNode, strAttr) { //------------------------------------------------------------------------- // Select the node, or return null if not found //------------------------------------------------------------------------- var pNodeKey = nod; if(strNode) { pNodeKey = nod.selectSingleNode(strNode); if(null == pNodeKey) return null; } //------------------------------------------------------------------------- // Return the value or null if not found //------------------------------------------------------------------------- return pNodeKey.getAttribute(strAttr); } //----------------------------------------------------------------------------- // // Method: getNodeTextFromNode // // Arguments: (node) nod - The node to query // // Returns: (string) - The value from the attribute or the empty string. // //----------------------------------------------------------------------------- function getNodeTextFromNode(nod) { //------------------------------------------------------------------------- // If the node passed in is null, then return the empty string //------------------------------------------------------------------------- if(nod == null) return ""; //------------------------------------------------------------------------- // Otherwise return the node text or "" //------------------------------------------------------------------------- return (nod.text) ? nod.text : ""; } //----------------------------------------------------------------------------- // // Method: FormatString // FormatString is a similar function as Win32 FormatMessage // It replaces %1 with the first paramter as so forth // // Arguments: (string) strString- The string that will be formatted // ( Variable argument) // // Returns: (string) - Formatted string // //----------------------------------------------------------------------------- function FormatString(strString) { var numargs = arguments.length; if ( numargs > 1 ) { for ( i = 1 ; i < numargs ; i++) { strParam = "%" + i ; strString = strString.replace(strParam, arguments[i]); } } return strString; } ]]>