// JScript source code
//contains calls to silverlight.js, examples are below
//setting the alpha-channel in the 'background' parameter drastically affects the cost of rendering


function createSilverlight()
{                                 
    //example calls, please replace with calls that match your site's requirements    
    //Silverlight.createObject("xaml/piano.xaml", pe, "SlControl1",
                                 //{width:'1024', height:'530', inplaceInstallPrompt:false, background:'white', isWindowless:'false', framerate:'24', enableFramerateCounter:'false', version:'1.0'},
                                 //{onError:null, onLoad:null, onResize:onResize},
                                 //null);
                                 
   //Silverlight.createObjectEx({source: 'xaml/piano.xaml', parentElement:pe, id:'SlControl1', properties:{width:'1024', height:'530', background:'white', isWindowless:'false', framerate:'24', enableFramerateCounter:'false', version:'1.0'}, events:{onError:null, onLoad:null, onResize:null}, context:null});

    Silverlight.createObject(
        "Default.aspx.xaml",         // Source property value.
        document.getElementById('SilverlightControlHost'),
        'SilverlightControl',           // Unique plug-in ID value.
        {                               // Per-instance properties.
            width:'100%',               // Width of rectangular region of 
                                        // plug-in area in pixels.
            height:'100%',              // Height of rectangular region of 
                                        // plug-in area in pixels.
            inplaceInstallPrompt:false, // Determines whether to display 
                                        // in-place install prompt if 
                                        // invalid version detected.
            background:'#FFFFFF',       // Background color of plug-in.
            isWindowless:'false',       // Determines whether to display plug-in 
                                        // in Windowless mode.
            framerate:'24',             // MaxFrameRate property value.
            version:'1.0'               // Silverlight version to use.
        },
        {
            onError:handleError,         // OnError property value, event handler function name.
            onLoad:null           // OnLoad property value, event handler function name.
        },
        null);                          // Context value -- event handler function name.
   
}

var SilverlightControl;

function handleLoad(control, userContext, rootElement)
{
    SilverlightControl = control;
}


function handleError(sender, args)
{
    var strError = "Error Details: \n";
    strError += "Type: " + args.errorType + "\n";
    strError += "Message: " + args.errorMessage + "\n";
    strError += "Code: " + args.errorCode + "\n";
    alert(strError);    
}