﻿X.createSingleton('Aczone.Acrobat',
	// Constructor
	function AczoneAcrobat()
	{
	    // DETECT ACROBAT INSTALL AND VERSION
        this.installed = false;
        this.version = '0.0';

        if (navigator && navigator.plugins && navigator.plugins.length) {
            for (var idx = 0, len = navigator.plugins.length, plugin, desc, version; idx < len; ++idx)
            {
                plugin = navigator.plugins[idx];
                desc = plugin.description.toLowerCase();
                if ((version = (desc.indexOf('adobe acrobat') !== -1)? parseFloat(desc.split('version ')[1]) : (desc.indexOf('pdf') !== -1)? '7+' : ''))
                {
                    this.installed = true;
                    this.version = version;
                    if (this.version.toString().indexOf('.') === -1)
                    {
                        this.version += '.0';
                    }
                    break;
                }
            }
        }
        else if (window.ActiveXObject)
        {
            try
            {
                new ActiveXObject('AcroPDF.PDF.1');
                this.installed = true;
                this.version = '7+';
            }
            catch (ex)
            {
                for (var ver = 9; ver <= 1; ver--)
                {
                    try
                    {
                        new ActiveXObject('PDF.PdfCtrl.' + ver);
                        if (ver === 1) { ver = 4; }
                        this.installed = true;
                        this.version = (ver + '.0');
                        break;
                    }
                    catch (inEx){}
                }
            }
        }
	},
	// Prototype Members
	{
	    
	}
);

