﻿toggleLogo = function(showSilverlightLogo)
{
    var slLogo = document.getElementById("sl-logo");
    var simpleLogo = document.getElementById("simple-logo");
    if (slLogo != null)
    {
        slLogo.style.display = showSilverlightLogo ? "block" : "none";
        slLogo.style.left = showSilverlightLogo ? "0" : "-1000px";
        var slObject = document.getElementById("sl-logo-object");
        if (showSilverlightLogo && (slObject != null))
        {
            slObject.Content.LogoApp.ClickedEvent = onLogoClicked;
        }
    }
    if (simpleLogo != null)
    {
        simpleLogo.style.display = showSilverlightLogo ? "none" : "block";
    }
}
onLogoSLError = function()
{
    toggleLogo(false);
}
onLogoSLLoad = function()
{
    toggleLogo(true);
}
onLogoClicked = function()
{
    window.location.href = "/";
}

checkForSL = function()
{
    if (-1 == navigator.userAgent.indexOf("MSIE "))
    {
        // For non-IE browsers plug-ins are used (rather than ActiveX). For Chrome we want to explicitly check for Silverlight's
        // presence and explicitly hide the <object> if we don't find it.
        var plugInArrayExists = (typeof(navigator.plugins) != "unknown") && (typeof(navigator.plugins) != "undefined");
        var slPluginName = "Silverlight Plug-In";
        var slPlugInExists = plugInArrayExists && (typeof(navigator.plugins[slPluginName]) != "unknown") && (typeof(navigator.plugins[slPluginName]) != "undefined") && (navigator.plugins[slPluginName] != null);
        toggleLogo(slPlugInExists);
    }
}

if (window.addEventListener) 
{ 
    window.addEventListener('load', checkForSL, false);  
}  
else if (window.attachEvent) 
{ 
    window.attachEvent('onload', checkForSL); 
}

