function createSilverlight()
{
	var scene = new Family.Page();
	Silverlight.createObjectEx({
		source: "family.xaml",
		parentElement: document.getElementById("SilverlightControlHost"),
		id: "SilverlightControl",
		properties: {
			width: "100%",
			height: "100%",
			version: "1.0"
		},
		events: {
			onLoad: Silverlight.createDelegate(scene, scene.handleLoad)
		}
	});
}


if (!window.Silverlight) 
	window.Silverlight = {};

Silverlight.createDelegate = function(instance, method) {
	return function() {
		return method.apply(instance, arguments);
	}
}

if (!window.Family)
	window.Family = {};

Family.Page = function() 
{
}

Family.Page.prototype =
{
	handleLoad: function(control, userContext, rootElement) 
	{
		this.control = control;
		
		// Sample event hookup:	
		rootElement.addEventListener("MouseLeftButtonDown",Silverlight.createDelegate(this, this.handleMouseDown));
	},
	
	// Sample event handler
	handleMouseDown: function(sender, eventArgs) 
	{
		// The following line of code shows how to find an element by name and call a method on it.
		// this.control.content.findName("Timeline1").Begin();
	}
}

function showInfo(sender, args) {
    sender.findName("DetailsName").text = sender.Name;
    sender.findName("DetailsPic").ImageSource = "../images/" + sender.Name + ".jpg";

    sender.findName("DetailsContent").Text = "";	
    numElems = sender.findName(sender.Name + "Content").Inlines.Count;
    for (ctr = 0; ctr < numElems; ctr++)
    {
	var contentTBA = '<Run/>';
	contentRO = sender.findName(sender.Name + "Content").Inlines.getItem(ctr);
	contentRW = sender.getHost().content.createFromXaml(contentTBA);
	contentRW.Text = contentRO.Text;
	contentRW.FontStyle = contentRO.FontStyle;
	sender.findName("DetailsContent").Inlines.add(contentRW);
    }

    sender.findName("Details").visibility = "Visible";
    sender.findName("Mask").visibility = "Visible";
}

function hideInfo(sender, args) {
    sender.findName("Details").visibility = "Collapsed";
    sender.findName("DetailsPic").ImageSource = "";
    sender.findName("Mask").visibility = "Collapsed";
}