/*
This file is used to customize the experience  for users who do not have Silverlight Installed.
Please customize the following messages as well as the associated CSS files to customize
the experience.
The LAYOUT is as Follows
->PreInstall Message
->Install Silverlight Button
-> Installation instructions (tayloed to IE, FF or Safari)
*/

//Create our install experience html
var installExperienceHTML = '<div id="installexperience" >';
installExperienceHTML += '<div id="preinstalltext"></div>';
installExperienceHTML += '<div id="InstallPromptDiv"></div>';
installExperienceHTML += '<div id="PostInstallGuidance"></div></div>';

var browser = navigator.appName;

if(!window.Silverlight)
    window.Silverlight={};

Silverlight.InstallAndCreateSilverlight = function(version, SilverlightDiv, installExperienceHTML, installPromptDivID, createSilverlightDelegate) {

   	var RetryTimeout = 8000;               //The interval at which Silverlight instantiation is attempted(ms)
   	if (Silverlight.isInstalled(version)) {
   		createSilverlightDelegate();
   	}
   	else {
   		if (installExperienceHTML && SilverlightDiv) {
   			SilverlightDiv.innerHTML = installExperienceHTML;
   			document.body.innerHTML;
   		}

   		if (installPromptDivID) {
   		    var installPromptDiv = document.getElementById(installPromptDivID);
   		    var notationS = document.getElementById("preinstalltext");
   		    notationS.innerHTML = 'You will need to install the Microsoft Silverlight plugin in order to stream this recording.  Please click on the button below to begin with the installation.';

   		    if (installPromptDiv)
   		        installPromptDiv.innerHTML = Silverlight.createObject(null, null, null, { version: version, inplaceInstallPrompt: true }, {}, null);
   		}

   		//place text below the install medallion to inform the users what to do after installation
   		var PostInstallGuidance = document.getElementById('PostInstallGuidance');
   		if (document.getElementById('PostInstallGuidance')) {
   			if (browser == "Microsoft Internet Explorer" || browser == "Explorer") {
   				if (Silverlight.available) {
   					var usertext = '<p id="usertext">A little bar will appear on the top of internet explorer with the text "To help protect your security, Internet Explorer has blocked this site from downloading files to your computer, click here for options." Click on this bar and select the "download file" option. </p>';
   					var picture = '<p id="picture" ><img class="browserDownloadImage" src="../installexperience/IE.png" alt="IE_Helper" ></p>';
   					var original = "When installation is complete, restart your browser to activate your Silverlight content.";

   					PostInstallGuidance.innerHTML = usertext + picture;
   				}
   				else {

   					var usertext = '<p id="usertext">A little bar will appear on the top of internet explorer with the text "To help protect your security, Internet Explorer has blocked this site from downloading files to your computer, click here for options." Click on this bar and select the "download file" option. </p>';
   					var picture = '<p id="picture" ><img class="browserDownloadImage" src="../installexperience/IE.png" alt="IE_Helper" ></p>';
   					var original = "When installation is complete, restart your browser to activate your Silverlight content.";

   					PostInstallGuidance.innerHTML = usertext + picture;
   				}
   			}
   			else if (browser == "Netscape" || browser == "Safari") {
   			    var usertext = '<p id="usertext">Firefox will show a popup saying "you have chosen to open Silverlight.exe" and it will ask you if you would like to save the file, Click on the button "Save File"</p>';
   			    var picture = '<p id="picture" ><img class="browserDownloadImage" src="../installexperience/FF.png" alt="Browser_HelperImage" ></p>';
   				var original = "Your browser is " + browser + ". When installation is complete,<br />restart your browser to activate your Silverlight content.";

   				PostInstallGuidance.innerHTML = usertext + picture;
   			}
   			else {
   				PostInstallGuidance.innerHTML = "Your browser may not be supported by Microsoft Silverlight.<br />Please visit http://www.microsoft.com/silverlight/system-requirements.aspx for more information.";
   			}
   		}
   		//end of insert

   		if (!(Silverlight.available || browser != 'Microsoft Internet Explorer')) {
   			TimeoutDelegate = function() {
   				Silverlight.InstallAndCreateSilverlight(version, null, null, null, createSilverlightDelegate);
   			}
   			setTimeout(TimeoutDelegate, RetryTimeout);
   		}
   	}
}
///////////////////////////////////////////////////////////////////////////////
//
//  installcreatesilverlight.js   			version 1.0
//
//  This file is provided by Microsoft as a helper file for websites that
//  incorporate Silverlight Objects. This file is provided under the Silverlight 
//  SDK 1.0 license available at http://go.microsoft.com/fwlink/?linkid=94240.  
//  You may not use or distribute this file or the code in this file except as 
//  expressly permitted under that license.
// 
//  Copyright (c) 2007 Microsoft Corporation. All rights reserved.
// installExperienceHTML += '<div style="position:auto; text-align:left; background-repeat:no-repeat; height:477px; background-image:url(assets/images/faded_preinstall.png);">';
// '<div id="anotherinstallhelper" style="position: absolute; top: 10px; left: 5px; width: 240px; height: 150px; background-color: pink;"></div>';
///////////////////////////////////////////////////////////////////////////////

