$(function() {
    // Add transparent background
    $(".content-background,.navbar-background").backOpacity({
        background: '#ffffff',
        opacity: '0.63'
    });
    // Round corners of background
    $(".backopacity").corner();
    
    if (detectAcrobat())
    {
        // Make open in a new window so that it can download in the background
        $("a.pdf").attr("target", "_blank");
    }

    $("#submitContact_content").focus(function() {
       $("#amIaBot").attr("value", "Of course I'm not a bot!");
    });
});

function detectAcrobat()
{
    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 false;
            }
        }
        if (control)
        {
            return true;
        }
    }
    else if (navigator.plugins && navigator.plugins.length)
    {
        // Check navigator.plugins for "Adobe Acrobat" or "Adobe PDF Plug-in"
        for (var i=0; i < navigator.plugins.length; i++)
        {
            if (navigator.plugins[i].description.indexOf("Adobe Acrobat") != -1)
            {
                return true;
            }
            else if (navigator.plugins[i].description.indexOf("Adobe PDF Plugn-in") != -1)
            {
                return true;
            }
        }
    }
    return false;
}
