if (!window.Animation)
	window.Animation = {};

Animation.Scene = function() 
{
}

Animation.Scene.prototype =
{
	handleLoad: function(control, userContext, rootElement) 
	{
		// Keyframes for animation
        this.keyFrames = new Array(
	        "M7.95,210L-20.05,210L-20.05,231L7.95,231L7.95,210",
	        "M49.5,210L21.5,210L21.5,231L49.5,231L49.5,210",
	        "M87.75,210L59.75,210L59.75,231L87.75,231L87.75,210",
	        "M122.7,210L94.7,210L94.7,231L122.7,231L122.7,210",
	        "M154.3,210L126.3,210L126.3,231L154.3,231L154.3,210",
	        "M182.55,210L154.55,210L154.55,231L182.55,231L182.55,210",
	        "M207.5,210L179.5,210L179.5,231L207.5,231L207.5,210",
	        "M229.1,210L201.1,210L201.1,231L229.1,231L229.1,210",
	        "M247.4,210L219.4,210L219.4,231L247.4,231L247.4,210",
	        "M262.35,210L234.35,210L234.35,231L262.35,231L262.35,210",
	        "M274,210L246,210L246,231L274,231L274,210",
	        "M282.35,210L254.35,210L254.35,231L282.35,231L282.35,210",
	        "M287.3,210L259.3,210L259.3,231L287.3,231L287.3,210",
	        "M289,210L261,210L261,231L289,231L289,210",
	        "M289,210L261,210L261,231L289,231L289,210",
	        "M289,210L261,210L261,231L289,231L289,210",
	        "M289,210L261,210L261,231L289,231L289,210",
	        "M321,181.9Q275.35,176.05,229,181.9Q221.9,218.3,229,250.9Q274.25,256.35,321,250.9Q326.95,216.4,321,181.9",
	        "M353,153.8Q275.75,142.05,197,153.8Q182.75,216.1,197,270.8Q273.45,281.75,353,270.8Q364.9,212.3,353,153.8",
	        "M385,125.7Q276.15,108.1,165,125.7Q143.65,213.85,165,290.7Q272.7,307.15,385,290.7Q402.85,208.2,385,125.7",
	        "M417,97.6Q276.55,74.1,133,97.6Q104.5,211.65,133,310.6Q271.9,332.55,417,310.6Q440.8,204.1,417,97.6",
	        "M449,69.5Q276.95,40.1,101,69.5Q65.35,209.4,101,330.5Q271.1,357.95,449,330.5Q478.75,200,449,69.5",
	        "M446.35,71.5Q276.3,61.9,103.65,71.5Q87.7,214.15,103.65,328.5Q271.15,340.55,446.35,328.5Q457.9,207.6,446.35,71.5",
	        "M443.7,73.5Q275.65,83.75,106.3,73.5Q110.05,218.95,106.3,326.5Q271.2,323.15,443.7,326.5Q437.05,215.2,443.7,73.5",
	        "M441,75.5Q275,105.6,109,75.5Q132.4,223.75,109,324.5Q271.25,305.7,441,324.5Q416.2,222.8,441,75.5",
	        "M443,74Q275,96.6,107,74Q124.55,217.85,107,326Q272.15,311.9,443,326Q424.4,217.1,443,74",
	        "M445,72.5Q275,87.55,105,72.5Q116.7,211.9,105,327.5Q273.1,318.1,445,327.5Q432.6,211.4,445,72.5",
	        "M447,71Q275,78.55,103,71Q108.85,205.95,103,329Q274.05,324.3,447,329Q440.8,205.7,447,71",
	        "M449.5,330.45L101.5,330.45L101.5,69.45L449.5,69.45L449.5,330.45",
	        "M449.5,330.45L101.5,330.45L101.5,69.45L449.5,69.45L449.5,330.45",
	        "M449.5,330.45L101.5,330.45L101.5,69.45L449.5,69.45L449.5,330.45",
	        "M449.5,330.45L101.5,330.45L101.5,69.45L449.5,69.45L449.5,330.45",
	        "M449,69.5L101,69.5L101,330.5L449,330.5L449,69.5",
	        "M449,158.4L101,158.4L101,330.5L449,330.5L449,158.4",
	        "M449,227.55L101,227.55L101,330.5L449,330.5L449,227.55",
	        "M449,276.9L101,276.9L101,330.5L449,330.5L449,276.9",
	        "M449,306.55L101,306.55L101,330.5L449,330.5L449,306.55",
	        "M449,316.45L101,316.45L101,330.5L449,330.5L449,316.45",
	        "M360.15,316.45L189.85,316.45L189.85,330.5L360.15,330.5L360.15,316.45",
	        "M306.8,316.45L243.2,316.45L243.2,330.5L306.8,330.5L306.8,316.45",
	        "M289,316.45L261,316.45L261,330.5L289,330.5L289,316.45",
	        "M289,281.1L261,281.1L261,330.5L289,330.5L289,281.1",
	        "M289,248.3L261,248.3L261,330.5L289,330.5L289,248.3",
	        "M289,218.15L261,218.15L261,330.5L289,330.5L289,218.15",
	        "M289,190.65L261,190.65L261,330.5L289,330.5L289,190.65",
	        "M289,165.75L261,165.75L261,330.5L289,330.5L289,165.75",
	        "M289,143.45L261,143.45L261,330.5L289,330.5L289,143.45",
	        "M289,123.8L261,123.8L261,330.5L289,330.5L289,123.8",
	        "M289,106.75L261,106.75L261,330.5L289,330.5L289,106.75",
	        "M289,92.35L261,92.35L261,330.5L289,330.5L289,92.35",
	        "M289,80.55L261,80.55L261,330.5L289,330.5L289,80.55",
	        "M289,71.35L261,71.35L261,330.5L289,330.5L289,71.35",
	        "M289,64.8L261,64.8L261,330.5L289,330.5L289,64.8",
	        "M289,60.9L261,60.9L261,330.5L289,330.5L289,60.9",
	        "M289,59.55L261,59.55L261,330.55L289,330.55L289,59.55",
	        "M289,82.7L261,82.7L261,307.4L289,307.4L289,82.7",
	        "M289,103.45L261,103.45L261,286.65L289,286.65L289,103.45",
	        "M289,121.7L261,121.7L261,268.4L289,268.4L289,121.7",
	        "M289,137.55L261,137.55L261,252.55L289,252.55L289,137.55",
	        "M289,151L261,151L261,239.1L289,239.1L289,151",
	        "M289,161.95L261,161.95L261,228.15L289,228.15L289,161.95",
	        "M289,170.5L261,170.5L261,219.6L289,219.6L289,170.5",
	        "M289,176.6L261,176.6L261,213.5L289,213.5L289,176.6",
	        "M289,180.25L261,180.25L261,209.85L289,209.85L289,180.25",
	        "M289,181.5L261,181.5L261,208.6L289,208.6L289,181.5",
	        "M348.3,181.5L201.5,181.5L201.5,208.6L348.3,208.6L348.3,181.5",
	        "M398.5,181.5L151.1,181.5L151.1,208.6L398.5,208.6L398.5,181.5",
	        "M439.55,181.5L109.9,181.5L109.9,208.6L439.55,208.6L439.55,181.5",
	        "M471.5,181.5L77.85,181.5L77.85,208.6L471.5,208.6L471.5,181.5",
	        "M494.3,181.5L54.95,181.5L54.95,208.6L494.3,208.6L494.3,181.5",
	        "M508,181.5L41.2,181.5L41.2,208.6L508,208.6L508,181.5",
	        "M512.6,181.5L36.6,181.5L36.6,208.6L512.6,208.6L512.6,181.5",
	        "M391.55,181.5L157.7,181.5L157.7,208.6L391.55,208.6L391.55,181.5",
	        "M318.9,181.5L230.4,181.5L230.4,208.6L318.9,208.6L318.9,181.5",
	        "M294.65,181.5L254.65,181.5L254.65,208.6L294.65,208.6L294.65,181.5",
	        "M374.3,181.5L334.3,181.5L334.3,208.6L374.3,208.6L374.3,181.5",
	        "M443.4,181.5L403.4,181.5L403.4,208.6L443.4,208.6L443.4,181.5",
	        "M501.8,181.5L461.8,181.5L461.8,208.6L501.8,208.6L501.8,181.5",
	        "M549.65,181.5L509.65,181.5L509.65,208.6L549.65,208.6L549.65,181.5",
	        "M586.8,181.5L546.8,181.5L546.8,208.6L586.8,208.6L586.8,181.5"
        );
		
		// Sample button event hookup: Find the button and then attach event handlers
		this.timer = rootElement.findName("timer");	
		this.timer.addEventListener("completed", Sys.Silverlight.createDelegate(this, this.onTimerCompleted));
		this.frameNum = 0;
		this.timer.begin();
	},
	
	onTimerCompleted: function(sender, eventArgs) 
	{
	    this.frameNum = (this.frameNum + 1) % this.keyFrames.length;

        // Advance to the next keyframe
        var path = sender.FindName("thePath");
        path.Data = this.keyFrames[this.frameNum];

        // Continue our per frame callback
        this.timer.begin(); 
	}
}