﻿function WaitForInstallCompletion()
{
    try
    {   //This forces Firefox/Safari to refresh their list of known plugins.
        navigator.plugins.refresh();
    }
    catch (e)
    {
        //IE does not support the method, so an exception will be thrown.
    }
    if (Silverlight.isInstalled("2.0"))
    {
        //Silverlight is installed. Refresh the page.
        window.location.reload(false);
    }
    else
    {
        // wait 3 seconds and try again
        setTimeout(WaitForInstallCompletion, 3000);
    }
}

function onLoad()
{
    //This only works if we are performing a clean install, not an upgrade.
    if (!Silverlight.isInstalled("2.0"))
    {
        //Silverlight is not installed. Try to refresh the page when it is installed.
        //WaitForInstallCompletion();

        // we are going to another site!!!
        RedirectToDivingMatrix();
    }
}

function onSourceDownloadProgressChanged(sender, eventArgs)
{
    var slHost = document.getElementById("ctl00_PathfinderPlaceHolder_pfContent");
    var slText = slHost.content.findName("ProgressText");
    slText.Text = "Loading - " + Math.round(eventArgs.get_progress() * 100) + "%";
}

function RedirectToDivingMatrix()
{
    window.location = "http://www.divingmatrix.co.uk/index.aspx";
}

