﻿//**** Required lobalInclude.js ****
function test_silverlight_installed() {
    var b = '3.0.40624.0';

    var a = 1,
        m = null;
    try {

        var axObj = null,
            noIE = false;

        if (window.ActiveXObject)
            try {

            axObj = new ActiveXObject("AgControl.AgControl");

            if (axObj.IsVersionSupported(b))
                a = 0;
            axObj = null
        } catch (l) {
            noIE = true
        }
        else
            noIE = true;

        if (noIE) {
            var nPlgs = navigator.plugins["Silverlight Plug-In"];
            if (nPlgs) {
                var h = nPlgs.description;
                if (h === "1.0.30226.2")
                    h = "2.0.30226.2";

                var c = h.split(".");

                while (c.length > 3)
                    c.pop();

                while (c.length < 4)
                    c.push(0);

                var e = b.split(".");

                while (e.length > 4)
                    e.pop();

                var d, g, f = 0;

                do {
                    d = parseInt(e[f]);
                    g = parseInt(c[f]);
                    f++;
                } while (f < e.length && d === g);

                if (d <= g && !isNaN(d))
                    a = 0;
            }
        }
    } catch (l) {
        a = 1
    }
    return a
};

function on_install_test() {
    if (test_silverlight_installed() == 0) {
        element('slInstallingText').style.display = 'none';
        element('slInstallCompletedText').style.display = 'block';

        try {
            help_window.close();
        }
        catch (e) {
        }

        window.setTimeout('location.reload()', 5000);
    }
    else
        window.setTimeout(on_install_test, 2000);
}
function on_install() {
    element('slInstallIntoText').style.display = 'none';

    if (test_silverlight_installed() == 0) {
        alert('Silverlight is niet goed geinstalleerd.\n'
                     + 'We gaan nu silverlight nu opnieuw installeren.\n'
                     + 'Na de installatie moet uw browser opnieuw opstarten');
    }
    else {
        window.setTimeout(on_install_test, 5000);
    }

    element('slInstallingText').style.display = 'block';

    try {
        ShowHelp('/public/resources/files/charthelp/silverlightinstall-help.html')
    }
    catch (e) {
        alert('Kan help window niet open\nFout: ' + e.description);
    }

    try {
        top.location = 'http://go2.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0';
    }
    catch (e) {
        alert('Kan download niet starten\nFout: ' + e.description);
    }
}