///////////////////////////////////////////////////////////////////////////////
//
//  SlideshowCreate.js   			version 1.0
//
//  This file is provided by First Floor and implements parts of the Slideshow.
//
//  See also http://www.firstfloorsoftware.com/Slideshow.
// 
//  Copyright (c) 2007 First Floor. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////
//	1-17-08
//	Note - scene.xml needs a relative path if the html that calls it is in another path.
//	This implementation calls for identical filenames for the html and slidelist xml files...
//	And the slide show images reside in separate sub folders, while the .js files and scene.xml reside in a common folder.
//
//	slideshow.js has 3 similar relative paths to the warning and error .png files.
//
//	Adding the relative paths here allows me to keep the filenames for the html file
//	and the xml slidelist to be identical and for them to reside in the slide folder...
//	while just one version of the .js and scene.xml (and .png files) live here.
//
/////////////////////////////////////////////////////////////////////////////////

function createSlideshow(parentId, settings){
    if (!parentId){
        alert("Missing required parentId parameter");
        return;
    }
    if (!settings)settings = {};
	var scene = new Slideshow.Scene();
	Silverlight.createObjectEx({
		source: '../../PhotoGalleries/Scene.xml',
		parentElement: document.getElementById(parentId),
		id: parentId + 'SilverlightPlugIn',
		properties: {
			width: settings.width == undefined ? '400' : settings.width,
			height: settings.height == undefined ? '388' : settings.height,
			background: settings.pageBackground == undefined ? "White" : settings.pageBackground,
            isWindowless: 'false',
			version: '0.8'
		},
		events: {
		    onError: null,
			onLoad: Silverlight.createDelegate(scene, scene.handleLoad)
		},		
		context: settings 
	});
}

if (!window.Silverlight) 
	window.Silverlight = {};

Silverlight.createDelegate = function(instance, method) {
	return function() {
        return method.apply(instance, arguments);
    }
}
