﻿var slHtml = '  <div class="slInstall">' +
             '     <div style="padding:20px;">A családfa kirajzolásához szükség van a Microsoft által készített Silverlight nevű program telepítésére!<br />A telepítés indításához kattints az alábbi képre:</div>'+             
             '     <div class="sllogo">' +
             '     <div id="installPromptDiv"></div>' +
             '     </div>' +
             '     <div id="postInstallGuidance" style="padding:20px;"></div>'+
             '  </div>';

if(!window.Silverlight)
    window.Silverlight={};

var ver = '1.0';

Silverlight.InstallAndCreateSilverlight = function()
{
  if (Silverlight.isInstalled(ver) )
  {
    CreateSL();
  }
  else
  {
    document.getElementById('pluginHost').innerHTML=slHtml;
    document.getElementById('installPromptDiv').innerHTML=Silverlight.createObject(null, null, null, {version: ver, inplaceInstallPrompt:true},{}, null);
    var postInstallGuidance = document.getElementById('postInstallGuidance');
    if (Silverlight.ua.Browser == "MSIE")
    {
      setTimeout(ReloadSL, 10000);
		  postInstallGuidance.innerHTML="Ha a telepítés végén nem jelenik meg automatikusan a családfa rajza, akkor indítsd újra böngésződet!";
    }
    else
    {
      if (Silverlight.ua.Browser == "Firefox" || Silverlight.ua.Browser == "Safari")
      {
        postInstallGuidance.innerHTML="A telepítés végén újra kell indítanod a böngésződet!";
      }
      else
      {
        postInstallGuidance.innerHTML='A böngésződ sajnos nem támogatja a Microsoft Silverlight programját. A feltételekről leírást <a target="_blank" href="http://www.microsoft.com/silverlight/system-requirements.aspx">itt találsz</a>.';
      }  
    }
  }
}

ReloadSL = function()
{
  if (Silverlight.isInstalled(ver))
  {
    CreateSL();
  }
  else
  {
    setTimeout(ReloadSL, 500);
  }
}

function CreateSL()
{
  Silverlight.createObject("#xamlContent", document.getElementById("pluginHost"), "ji",{width:'596', height:'400', inplaceInstallPrompt:true, background:'white', isWindowless:'true', framerate:'24', version: '1.0'},{onError:null, onLoad:null}, null);
}


