function browserSupportsPDF() {
    var isInstalled = false;
    var version = null;
    if (window.ActiveXObject) {
        var control = null;
        try {
            // AcroPDF.PDF is used by version 7 and later
            control = new ActiveXObject('AcroPDF.PDF');
        } catch (e) {
            // Do nothing
        }
        if (!control) {
            try {
                // PDF.PdfCtrl is used by version 6 and earlier
                control = new ActiveXObject('PDF.PdfCtrl');
            } catch (e) {
                return undefined;
            }
        }
        if (control) {
            isInstalled = true;
            version = control.GetVersions().split(',');
            version = version[0].split('=');
            version = parseFloat(version[1]);
        }
    } else {
        if(navigator.mimeTypes['application/pdf'].enabledPlugin) {
            isInstalled = true;
        }
    }
    return isInstalled;
}

// create fancybox links for all anchors with 'fancybox' class
$(document).ready(function() {
    $("a.fancybox").fancybox({
        'width': '100%',
        'height': '100%',
        'autoScale' : false,
        'transitionIn' : 'elastic',
        'transitionOut' : 'elastic',
        'type' : 'iframe'
    });
});

function highlightAutocompleteItem(value, input) {
    return value.replace(input, "<strong>" + input + "</strong>");
}

function formatAutocompleteItem(row) {
    return row[0] + " (" + row[1] + ")";
}
