﻿///////////////////////////////////////////////////////////////////////////////
//
//  InstallHandler.js
//
//  Provides handling the events invoked by SilverlightChecker.
//
///////////////////////////////////////////////////////////////////////////////

function onCheckPassed(e)
{
	// warn the user if the Silvelight version is unsupported (e.g. Opera users)
	// modal dialog is timed to allow the app to load in the background
	window.onload = function()
	{
		if (!e.isSupported)
			window.alert("Your browser or operating system may not be supported by the Microsoft Silverlight plug in, but you can install here. If it does not work, please try again in a few weeks as we will be making upgrades.");
		
		document.getElementById("example").focus();
	};
	
	// create the Silverlight object
	Silverlight.createObject
	(
		e.data.source,
		document.getElementById("exampleParent"),
		"example",
		{		    
            windowless: "true",             
            background: "White",
			width: "995",
			height: "678",			
			enableHtmlAccess: "True",
			enableFrameRateCounter: "False",
			allowHtmlPopupWindow: "True",
			version: e.version
		},
		null,
		e.data.initParams
	);
}

function onCheckFailed(e)
{
	// warn the user if the Silvelight version is unsupported (e.g. Opera users)
	// modal dialog is timed to allow the app to load in the background
	window.onload = function()
	{
		if (!e.isSupported)
			window.alert("Your browser or operating system may not be supported by the Microsoft Silverlight plug in, but you can install here. If it does not work, please try again in a few weeks as we will be making upgrades.");
		
		document.getElementById("install").focus();
	};
	
	// display a user-friendly install/upgrade message or image
	if (!e.isInstalled)
	    document.write("<a id=\"install\" class=\"install\" href=\"http://go.microsoft.com/fwlink/?linkid=124807\"><img src=\"http://static.cbslocal.com/Themes/CBS/_resources/img/install_screen_viewcontent.jpg\" border=\"0\" /></a>");
	else
	    document.write("<a id=\"install\" class=\"install\" href=\"http://go.microsoft.com/fwlink/?linkid=124807\"><img src=\"http://static.cbslocal.com/Themes/CBS/_resources/img/install_screen_latestversion.jpg\" border=\"0\" /></a>");
}