﻿


//function onLoaded(sender, args) {
//    //getElementById("slPlug");
//    // Retrieve a reference to the plug-in.
//   var slPlugin = sender.getHost();
//    // Set the event handler function to the OnResize event.
//    sender.findName("txtStatus").Text = "Load";
//    slPlugin.content.onResize = onResized;

//    // Do initial layout of the application based on initial size.
//    updateLayout(slPlugin.content.actualWidth, slPlugin.content.actualHeight);
// 
//}

var isSizeCalculated = 0;
var winW = 40, winH = 40;
var plugin_1 = document.getElementById("SLPlugin_1");
var slPlugin;
var _Progress = 0;
function onProgressChanged(sender, eventArgs)

        {
            // Concatenate the size values as a formatted message string.

          
            // Set the event handler function to the OnResize event.
            
            
            // Determine whether the 1.0 version of Silverlight is available.
            

    

            // Do initial layout of the application based on initial size.
            //var slPlugin = sender.getHost();
            //updateLayout(slPlugin.content.actualWidth, slPlugin.content.actualHeight);

            //------------------



                     if (isSizeCalculated == 0) {

                         isSizeCalculated = 0;

                  
                         if (parseInt(navigator.appVersion) > 3) {

                             if (navigator.appName == "Netscape") {

                                 winW = window.innerWidth;
                                 winH = window.innerHeight;
                                 
                             }

                             if (navigator.appName.indexOf("Microsoft") != -1) {

                                 winW = document.body.offsetWidth;
                                 winH = document.body.offsetHeight;
                               
                             }

                         }

                     }
                     
                     var parentCanvas = sender.findName("parentCanvas");

                     parentCanvas.Width = winW;
                     parentCanvas.Height = winH;

                     var contentCanvas = sender.findName("main");
                     
                     contentCanvas.setValue("Canvas.Top", (winH - contentCanvas.Height) / 2);
                     contentCanvas.setValue("Canvas.Left", (winW - contentCanvas.Width) / 2);
                     
                     sender.findName("Loading_txt").Text = "Loading: " + Math.round(eventArgs.progress * 100) + "%";









                    
                     //  sender.findName("Loading_ani").Seek(TimeSpan.FromSeconds(_Progress));
                     sender.findName("uxProgressBar").ScaleY = eventArgs.progress *50;
                     sender.findName("txtStatus").Text = "Loading: " + sender.findName("uxProgressBar").ScaleX + "%";
                    // sender.findName("Loading_ani").Pause();
       
         
        
        
     }


//     function onResized(sender, eventArgs) {
//         alert("Silverlight 1.0: " + slPlugin.isVersionSupported("1.0"));
//         
//         var canvas_cont = sender.findName("main");
//         canvas_cont.setValue("Canvas.Top", (winH - canvas_cont.Height) / 2);

//         canvas_cont.setValue("Canvas.Left", (winW - canvas_cont.Width) / 2);
//     }

