var packagePlatform = "Unsupported";
var packageInstaller = "";

function loadPackage ()
{
    if (IsLinux32)
    {
        packagePlatform = "Linux";
        packageInstaller = "linux_i386/cstub";
        HelpButtonHide(true);
        // Magic state 20 == Java check
        Start(20);
    }
    else if (IsLinux64)
    {
        packagePlatform = "Linux";
        packageInstaller = "linux_x64/cstub";
        HelpButtonHide(true);
        // Magic state 20 == Java check
        Start(20);
    }
    else if (IsIntelMacOsX)
    {
        packagePlatform = "Mac OS X 10.4+ (intel)";
        packageInstaller = "darwin_x64/cstub"; 
        HelpButtonHide(true);
        // Magic state 40 == Java check
        Start(20);
    }
    else if (IsPowerPcMacOsX)
    {
        packagePlatform = "Mac OS X 10.4+ (power pc)";
        packageInstaller = "darwin_ppc/cstub";
        HelpButtonHide(true);
        // Magic state 40 == Java check
        Start(20);

    }
    else if (IsWinCE)
    {
        packagePlatform = "Windows Mobile 5/6 - ARMv4i";
        packageInstaller = "wince_armv4i/cstub.exe";
        // Magic state 10 == begin ActiveX install
        //TODO: ActiveX for CE
        //Start(10);
        //Bypass CSD as we don't have ActiveX for 3.5
        HelpButtonHide(true);        
        Start(-101);

    }
    else if (IsWin2kXpVista)
    {
        packagePlatform = "Windows 10/7/Vista/64/XP/2000";
        packageInstaller = "windows_i386/cstub.exe";
        //TODO: Get ocx done and uncomment here!
        // Magic state 1 == begin full windows detection sequence
        //Start(1);

        //TODO: Remove the following lines
        // Magic state 20 == Java check
        HelpButtonHide(true);
        Start(1);
    }
    else
    {
        // Not a supported platform. Try bypassing CSD
        // Magic state -101 == bypass CSD
        Start(-101);
    }
}
