// File: 	core.js
// Date: 	05/04/2008
// Author: 	Gabriel
// Desc: 	Contains core javascript functions.

/// <summary>Determines if the current os is Windows XP</summary>
/// <returns>bool</returns>
function IsWinXP() {
	var agent = navigator.userAgent;
	return agent.indexOf("Windows NT 5.0") != -1;
};

/// <summary>Determines if the current os is Windows Server 2003</summary>
/// <returns>bool</returns>
function IsWin2003() {
	var agent = navigator.userAgent;
	return agent.indexOf("Windows NT 5.2") != -1;
};

/// <summary>Determines if the current os is Windows Vista</summary>
/// <returns>bool</returns>
function IsWinVista() {
	var agent = navigator.userAgent;
	return agent.indexOf("Windows NT 6.0") != -1;
};

/// <summary>Determines if the current os is Windows Vista 64</summary>
/// <returns>bool</returns>
function IsWinVista64() {
	var agent = navigator.userAgent;
	return agent.indexOf("WOW64") != -1;
};

/// <summary>Function that returns the correct install url for the detected operating system.</summary>
/// <param name="baseUrl">The base url that will be used to compose the full install url.</param>
/// <returns>The full url for the instalation file</returns>
function DownloadDataSafeBackup(baseUrl) {
    if (IsWin2003()) {
        window.location.href=baseUrl + 'DataSafeBackupSetupWin2003.msi';
    }
	else if (IsWinVista64()) {
		window.location.href=baseUrl + 'DataSafeBackupSetupWinVista64.msi';
	}
	else if (IsWinVista()) {
		window.location.href=baseUrl + 'DataSafeBackupSetupWinVista.msi';
    }
    else {
        window.location.href=baseUrl + 'DataSafeBackupSetupWinXP.msi';
    }
};



