﻿// Silverlight Splash Screen Javascript
// Musters.ca

// Download Complete
function silverlightControlHost_SourceDownloadComplete(sender, eventArgs) {

}

// Download Progress Changed
function silverlightControlHost_SourceDownloadProgressChanged(sender, eventArgs) {
	// Get the Percentage of Progress Loaded
	var percentageOfProgress = Math.round((eventArgs.progress * 1000)) / 10;

	// Determine the decimals to show
	var decimalString = "       ";
	if ((percentageOfProgress <= 0) && (percentageOfProgress <= 5)) {
		decimalString = " .     ";
	}
	else if ((percentageOfProgress > 5) && (percentageOfProgress <= 10)) {
		decimalString = " . .   ";
	}
	else if ((percentageOfProgress > 10) && (percentageOfProgress <= 15)) {
		decimalString = " . . . ";
	}
	else if ((percentageOfProgress > 20) && (percentageOfProgress <= 25)) {
		decimalString = "       ";
	}
	else if ((percentageOfProgress > 25) && (percentageOfProgress <= 30)) {
		decimalString = " .     ";
	}
	else if ((percentageOfProgress > 30) && (percentageOfProgress <= 35)) {
		decimalString = " . .   ";
	}
	else if ((percentageOfProgress > 35) && (percentageOfProgress <= 40)) {
		decimalString = " . . . ";
	}
	else if ((percentageOfProgress > 40) && (percentageOfProgress <= 45)) {
		decimalString = "       ";
	}
	else if ((percentageOfProgress > 45) && (percentageOfProgress <= 50)) {
		decimalString = " .     ";
	}
	else if ((percentageOfProgress > 50) && (percentageOfProgress <= 55)) {
		decimalString = " . .   ";
	}
	else if ((percentageOfProgress > 55) && (percentageOfProgress <= 60)) {
		decimalString = " . . . ";
	}
	else if ((percentageOfProgress > 60) && (percentageOfProgress <= 65)) {
		decimalString = "       ";
	}
	else if ((percentageOfProgress > 65) && (percentageOfProgress <= 70)) {
		decimalString = " .     ";
	}
	else if ((percentageOfProgress > 70) && (percentageOfProgress <= 75)) {
		decimalString = " . .   ";
	}
	else if ((percentageOfProgress > 75) && (percentageOfProgress <= 80)) {
		decimalString = " . . . ";
	}
	else if ((percentageOfProgress > 80) && (percentageOfProgress <= 85)) {
	decimalString = "       ";
	}
	else if ((percentageOfProgress > 85) && (percentageOfProgress <= 90)) {
		decimalString = " .     ";
	}
	else if ((percentageOfProgress > 90) && (percentageOfProgress <= 95)) {
		decimalString = " . .   ";
	}
	else if ((percentageOfProgress > 95) && (percentageOfProgress >= 100)) {
		decimalString = " . . . ";
	}

	// Set Titles
	sender.findName("txtTitle").Text = "Musters.ca";

	// Set Loading and Progress Bar
	var loadingString = "Loading " + decimalString
	sender.findName("txtLoading").Text = loadingString;
	sender.findName("txtPercentage").Text = percentageOfProgress.toFixed(1) + "%";
	sender.findName("progressBarScale").ScaleX = eventArgs.progress;

	// Calculate which section to place ProgressAnimationObject

	// Based on ProgressAnimationObjects position, determine where ProgressFilledObject's should be placed

}
