///////////////////////////////////////////////////////////////////////////////
//
//  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.
//
///////////////////////////////////////////////////////////////////////////////
if(!window.Silverlight)
    window.Silverlight={};

Silverlight.InstallAndCreateSilverlight = function(version, SilverlightDiv, installExperienceHTML, installPromptDivID, createSilverlightDelegate)
{
  var RetryTimeout=3000;	              //The interval at which Silverlight instantiation is attempted(ms)	
  if ( Silverlight.isInstalled(version) )
  {
    createSilverlightDelegate(SilverlightDiv.id);
  }
  else
  {
    if ( installExperienceHTML && SilverlightDiv )
    {
      SilverlightDiv.innerHTML=installExperienceHTML;
      document.body.innerHTML;
    }
    if (installPromptDivID)
    {
      var installPromptDiv = document.getElementById(installPromptDivID);
      if ( installPromptDiv )
        installPromptDiv.innerHTML = Silverlight.createObject(null, null, null, {version: version, inplaceInstallPrompt:true},{}, null);
    }
    if ( ! (Silverlight.available || Silverlight.ua.Browser != 'MSIE' ) )
    {
      TimeoutDelegate = function()
    {
    Silverlight.InstallAndCreateSilverlight(version, SilverlightDiv, null, null, createSilverlightDelegate);
    }
    setTimeout(TimeoutDelegate, RetryTimeout);
    }
  }

  Silverlight.PostInstallationGuidance();

}

Silverlight.PostInstallationGuidance = function(PostInstallationDIV)
{
  var PostInstallGuidance = document.getElementById('PostInstallGuidance');

  if ( document.getElementById('PostInstallGuidance') )
  {
    if ( Silverlight.ua.Browser == "MSIE" )
    {
      if ( Silverlight.available )
      {
        PostInstallGuidance.innerHTML="When installation is complete, restart your browser to activate your Silverlight content.";
      }
      else
      {
        PostInstallGuidance.innerHTML= "The application will load once installation is completed.";
      }
    }
    else if ( Silverlight.ua.Browser == "Firefox" || Silverlight.ua.Browser == "Safari")
    {
      PostInstallGuidance.innerHTML="Your browser is "+ Silverlight.ua.Browser + ". When installation is complete,<br />restart your browser to activate your Silverlight content.";
    }
    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.";
    }
  }
}

Silverlight.InstallExperienceHTML = function(height, imageUrl, InstallPromptDiv)
{
var installExperienceHTML =  '<div style="position:auto; text-align:left; background-repeat:no-repeat; height:' + height + 'px; background-image:url(' + imageUrl + ');">'; 
    installExperienceHTML += '<div style="padding-left:212px; padding-top:170px;">';
    installExperienceHTML += '<div id="' + InstallPromptDiv + '"> </div> </div> <div id="PostInstallGuidance"'; 
    installExperienceHTML += 'style="width:auto; font-weight:bold; font-size:18px; font-family:sans-serif; height:auto; padding-top:20px;text-align:center; color:#3366ff; ';
    installExperienceHTML += 'font-weight:normal; font-size:11pt">&nbsp;</div> </div>';
return installExperienceHTML;
}
