﻿function checkForPlugin() {
    var found = false;
    var info = '';

    try {
        acrobat = new ActiveXObject('AcroPDF.PDF.1');
        if (acrobat) {
            found = true;
            //info = 'v. 7+';
        }
    }
    catch (e) {
        //???
    }

    if (!found && navigator.plugins && navigator.plugins.length > 0) {
        for (var i = 0; i < navigator.plugins.length; i++) {
            if (navigator.plugins[i].name.indexOf('Adobe Acrobat') > -1) {
                found = true;
                //info = navigator.plugins[i].description + ' (' + navigator.plugins[i].filename + ')';
                break;
            }
        }
    }

    if (!found) {
        //alert("To interact with these PDF documents you will need to install the free Adobe Reader application.\n\nIf you do not have Adobe Reader installed, go here: http://get.adobe.com/reader/");
        promptToInstallPlugin();
    }
}

function promptToInstallPlugin() {
    var msg = confirm("To interact with these PDF documents you will need to install the free Adobe Reader application.\n\nIf you do not have Adobe Reader installed, click OK to download and install Adobe Reader.");
    if (msg == true) {
        location.href = "http://get.adobe.com/reader/";
        return true;
    }
    else {
        return false;
    }
}