// Output variable
var installedPlugins = "";

MSDetect = "false";
var nsPlugins = "";
var iePlugins = "";

if (!(navigator.plugins && navigator.plugins.length)
&&  !(navigator.mimeTypes && navigator.mimeTypes.length))
{
    MSDetect = "true";
}

function detectPluginVBCode(
    startingVersion, 
    endingVersion, 
    activeXName, 
    activeXDescription)
{
    document.writeln('    installed = 0');
    document.writeln('    version = 0');
    document.writeln('    For i = ' + startingVersion + ' to ' + endingVersion);
    document.writeln('        If Not(IsObject(CreateObject("' 
        + activeXName + '." & i))) _');
    document.writeln('        Then');
    document.writeln();
    document.writeln('        Else');
    document.writeln('            installed = 2');
    document.writeln('            version = i');
    document.writeln('        End If');
    document.writeln('    Next');
    document.writeln('    if installed = 2 Then');
    document.writeln('        iePlugins = iePlugins & ", ' 
        + activeXDescription + ' " & version');
    document.writeln('    End If');

    // detectPluginVBCode()
}

document.writeln('<script LANGUAGE="VBScript">');
document.writeln();
document.writeln('on error resume next');
document.writeln();
document.writeln('If MSDetect = "true" Then');

detectPluginVBCode(1, 8, 'ShockwaveFlash.ShockwaveFlash', 
    'Shockwave Flash Plugin');

detectPluginVBCode(1, 8, 'Pdf.PdfCtrl', 'Acrobat PDF Plugin');

document.writeln('End If');
document.writeln();
document.writeln('</SCR' + 'IPT>');

for (i = 0; i < navigator.plugins.length; i++)
{
    // description, filename, length, name
    nsPlugins += ", " + navigator.plugins[i].description;
}

if (MSDetect == "true")
{
    if (iePlugins.length > 0)
    {
        iePlugins = iePlugins.substring(2);
    }

    installedPlugins = iePlugins;
}
else
{
    if (nsPlugins.length > 0)
    {
        nsPlugins = nsPlugins.substring(2);
    }

    installedPlugins = nsPlugins;
}
