if (!window.wssg)
	window.wssg = {};

wssg.Page = function() 
{
}

wssg.Page.prototype =
{
	handleLoad: function(control, userContext, rootElement) 
	{
		this.control = control;
		
		var downloader = control.createObject("downloader");
		
		downloader.addEventListener("downloadProgressChanged", "onDownloadProgressChanged");
    downloader.addEventListener("completed", "downloadCompleted");

	  downloader.open("GET", "/windowsserver/essential/ebs/sl/ebshero.deploy");
	  downloader.send();

	}
}

function onDownloadProgressChanged(sender, eventArgs)
{
    // Calculate the downloaded percentage.
    var percentage = Math.floor(sender.downloadProgress * 100);

    // Update the Rectangle and TextBlock objects of the visual progress indicator.
    var progressText = sender.findName("progressText");
//var progressRectangle = sender.findName("progressRectangle");
progressText.text = percentage + "%";
   //progressRectangle.width = percentage * 2; 
}

function downloadCompleted(sender, args)
{
  // Make sure the download was ok
  if (sender.status != 200) 
  {
    alert("download failed");
    return;
  }

  // Hide the Loading...
  sender.findName("progressText").opacity = 0;
  //sender.findName("back").opacity = 0;
//sender.findName("progressBar").opacity = 0;

    // Build the XAML
  var theXaml = sender.getResponseText("Body.xaml");
  var theContent = sender.getHost().content.createFromXaml(theXaml);
  
  // Add to the Root
  var root = sender.findName("root");
  root.children.insert(0, theContent);

  // Set the Image
  var theImage1 = theContent.findName("bg");
  theImage1.setSource(sender, "images/bg.jpg");

var theImage2 = theContent.findName("photo1");
  theImage2.setSource(sender, "images/photo1.jpg");

var theImage3 = theContent.findName("learnmore_normal");
  theImage3.setSource(sender, "images/learnmore.jpg");

var theImage3a = theContent.findName("learnmore_over");
  theImage3a.setSource(sender, "images/learnmore_over.jpg");

var theImage4 = theContent.findName("ebslogo");
  theImage4.setSource(sender, "images/ebslogo.png");

var theImage5 = theContent.findName("power");
  theImage5.setSource(sender, "images/power.png");

var theImage6 = theContent.findName("quote1");
  theImage6.setSource(sender, "images/quote1.png");

var theImage7 = theContent.findName("quote2");
  theImage7.setSource(sender, "images/quote2.png");

var theImage8 = theContent.findName("quote3");
  theImage8.setSource(sender, "images/quote3.png");

}