


var EOIR = EOIR ? EOIR : function()
{
	var obj = 
	{
	};
	
	return obj;
} ();

EOIR.Build = function ()
{
	var obj =
	{
		_getBuildInfo: function (strInfo, strDefault)
		{
			try
			{
				var strXML = EOIR.Utils.getProperty("InfoStr", null);
				var xml;
				if(strXML != null)
				{
					xml = EOIR.XML.loadFromString(strXML);
				}
				else
				{
					xml = EOIR.XML.load(EOIR.Utils.getAbsolutePath('/config/info.xml'), false);
					EOIR.Utils.setProperty("InfoStr", EOIR.XML.serialize(xml));
				}

				return xml.selectSingleNode("/configuration/build/@" + strInfo).value;
			}
            catch (e)
            {
                try
                {
                    var xmlConfig = EOIR.XML.load(EOIR.Utils.getAbsolutePath('/config/info.xml'));

                    return xmlConfig.selectSingleNode("/configuration/build/@" + strInfo).value;
                }
                catch (e2)
                {
                    //alert("EOIR.Build._getBuildInfo error (" + strInfo + "): " + e2.description);
                }

            }

			return strDefault;
		},

		getVersion: function ()
		{
			return this._getBuildInfo("version", "");
		},

		getBuildDate: function ()
		{
			return this._getBuildInfo("date", "");
		},

		getTitle: function ()
		{
			return this._getBuildInfo("title", ">>> PROGRAM TITLE <<<");
		},

		getAppName: function ()
		{
			return this._getBuildInfo("appname", ">>> APP NAME - Must match whats in XUL application.ini <<<");
		},

		initialize: function ()
		{
			EOIR.Utils.setProperty("appName", EOIR.Build.getAppName());
		}

	};

	return obj;
} ();


function WinVersionInfo(nPlatformId, nMajorVer, nMinorVer, nBuildNum, strInfo)
{
	this.Platform = nPlatformId;
	this.MajorVersion = nMajorVer;
	this.MinorVersion = nMinorVer;
	this.Build = nBuildNum;
	this.Info = strInfo;
}

function getWindowsVersion()
{
	try
	{
		var strWinVer = getPropertyDefault("WinVer", null);
		if(strWinVer == null)
		{
			strWinVer = getExternal().WindowsVersion;
			if(strWinVer == null)
			{
				return new WinVersionInfo(VER_PLATFORM_WIN32_NT, 4, 0, 0, "");
			}
			setProperty("WinVer", strWinVer);
		}

		var arrElems = strWinVer.split("|");

		return new WinVersionInfo(parseInt(arrElems[0]), parseInt(arrElems[1]), parseInt(arrElems[2]), parseInt(arrElems[3]), arrElems[4]);
		//		return new WinVersionInfo(VER_PLATFORM_WIN32_NT, 4, parseInt(arrElems[2]), parseInt(arrElems[3]), arrElems[4]);		
	}
	catch(e)
	{
		//		return new WinVersionInfo(VER_PLATFORM_WIN32_NT, 4, 0, 0, "");
	}
}
