var hotshots_Source = "";
var hotshots_panels = 4;

var silverlightInstallHtml = "<img src='/Scripts/hotshots_install.jpg' alt='Get Microsoft Silverlight' style='border-style: none' onclick='onSilverlightInstallClick();'/>"
var silverlightInstallingHtml = "<img src='/Scripts/hotshots_setup_working.jpg' alt='Installing Microsoft Silverlight 2 ...' style='border-style: none' />";
var silverlightRestartHtml = "<img src='/Scripts/hotshots_reboot.jpg' alt='Microsoft Silverlight 2 is installed.  Please reboot.' style='border-style: none' />";
var silverlightVersion = "2.0";


function initHotShots(source, panels) {

    hotshots_Source = source;
    if(!(panels == undefined)) {
        hotshots_panels = panels;
    }
}

function onSilverlightInstallClick() {
    window.location = "http://go2.microsoft.com/fwlink/?linkid=124807";
    document.getElementById("hotshotsHost").innerHTML = silverlightInstallingHtml;
}

function injectHotShots() {

    var params = "panels=" + hotshots_panels;
    Silverlight.createObjectEx(
            {
                source: hotshots_Source,
                id: "scavengerHuntObject",
                parentElement: document.getElementById("hotshotsHost"),
                properties: {
                    version: silverlightVersion,
                    background: "#000",
                    width: "100%",
                    height: "100%",
                    autoUpgrade: "false",
                    enableHtmlAccess: "true",
                    isWindowless: "false",
                    initParams: params
                }
                
            }
            )
}

function hotshots_OnSilverlightInstalled() {
    injectHotShots();
}

function hotshotsLoad() {
    Silverlight.onSilverlightInstalled = hotshots_OnSilverlightInstalled;
    if (Silverlight.isRestartRequired) {
        document.getElementById("hotshotsHost").innerHTML = silverlightRestartHtml;
        return;
    }
    if (Silverlight.isInstalled(silverlightVersion)) {
        injectHotShots(false);
    }
    else {

        document.getElementById("hotshotsHost").innerHTML = silverlightInstallHtml;

    }

}

if (window.addEventListener) {
    window.addEventListener('load', hotshotsLoad, false);
}
else {
    window.attachEvent('onload', hotshotsLoad);
}
   