﻿function createSilverlight()
{
	Silverlight.createObjectEx(
	{
		source: "Cellbi.SvLite.Demo.xap",
		parentElement: document.getElementById("silverlightControlHost"),
		id: "SilverlightControl",
		properties: {
		  background: "#2F2F2F",
			width: "100%",
			height: "100%",
			version: "2.0",
			enableHtmlAccess: "true",
			splashScreenSource: "SplashScreen.xaml"
		},
		events:
		{
		  onSourceDownloadProgressChanged: onSourceDownloadProgressChanged
		}
	});

	// Give the keyboard focus to the Silverlight control by default
  document.body.onload = function()
  {
    var silverlightControl = document.getElementById('SilverlightControl');
    if (silverlightControl)
      silverlightControl.focus();
  }
}

function onSourceDownloadProgressChanged(sender, eventArgs)
{
	sender.findName("uxStatus").Text =  "Loading: " + Math.round((eventArgs.progress * 1000)) / 10 + "%";
	sender.findName("uxProgress").Width = eventArgs.progress * 356;
}