﻿function createSilverlight(name, component, appKey) {

    parentelementname = "placeholder_" + name.toLowerCase();

    Silverlight.createObjectEx({
        source: applicationPath + "ClientBin/RF.Navigator.xap",
        parentElement: parentelementname,
        id: "silverlightControl." + name,
        properties:
		{
		    width: "100%",
		    height: "100%",
		    version: "3.0",
		    background: "Transparent",
		    isWindowless: "true"
		},
        events:
		{
		    onError: null,
		    onLoad: null
		},
        initParams: "applicationpath=" + applicationPath + ",appkey=" + appKey + ",component=" + component
                ,installerUiConfig:
        	    {
        	        component: component
        	       }
       });
}
//function createSilverlight(appKey, scene) 
//{
//    Silverlight.createObjectEx({
//		    source: applicationPath + 'RS/Api/Web/CreateControl.aspx?appkey=' + appKey,
//		    parentElement: document.getElementById('placeholder_' + appKey),
//		    id: 'silverlightControl.' + appKey,
//		    properties:
//			{
//			    width: '100%',
//			    height: '100%',
//			    version: '1.0',
//			    background: 'Transparent',
//			    isWindowless: 'true'
//			},
//		    events: {
//			    onLoad: Silverlight.createDelegate(scene, scene.handleLoad),
//				onResize: Silverlight.createDelegate(scene, scene.handleResize)
//			}
//		});
//}

//if (!window.Silverlight)
//    Silverlight = {};

//Silverlight.createDelegate = function(instance, method) 
//{
//    return function() 
//    {
//        return method.apply(instance, arguments);
//    }
//}
