if (!window.SilverlightComponent)
	window.SilverlightComponent = {};

SilverlightComponent.Page = function() 
{
}
SilverlightComponent.Page.prototype =
{
	handleLoad: function(control, userContext, rootElement) 
	{
		this.ratioA = 0.85; // Define No-Homepage ratio animation
		this.ratioB = 0.95; // Define No-Homepage ratio animation
		if(!hp)
		{
			rootElement.findName('cvsRootScale').SetValue("ScaleX",this.ratioA);
			rootElement.findName('cvsRootScale').SetValue("ScaleY",this.ratioA);
		} else {
			rootElement.findName('cvsRootScale').SetValue("ScaleX",this.ratioB);
			rootElement.findName('cvsRootScale').SetValue("ScaleY",this.ratioB);
		}
		rootElement.findName('intro_bulle').Stop();
		rootElement.findName('intro_sentences').Begin();
		rootElement.findName('intro_btnstart').addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));
		rootElement.findname('intro_txtstart').addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));	
		rootElement.findName('video_party_wmv').addEventListener("MediaEnded", Silverlight.createDelegate(this, this.handleMediaEnded));
		rootElement.findName('video_picnic_wmv').addEventListener("MediaEnded", Silverlight.createDelegate(this, this.handleMediaEnded));
		rootElement.findName('video_car_wmv').addEventListener("MediaEnded", Silverlight.createDelegate(this, this.handleMediaEnded));
		rootElement.findName('video_scene_wmv').addEventListener("MediaEnded", Silverlight.createDelegate(this, this.handleMediaEnded));
		
	},
	handleMediaEnded: function(sender, eventArgs)
	{
		sender.Stop();
		sender.Play();
	},
	
	handleMouseDown: function(sender, eventArgs) 
	{
		sender.findName('intro_btnstart').SetValue('Visibility','Collapsed');
		sender.findname('intro_txtstart').SetValue('Visibility','Collapsed');

		videoTrain = sender.findName('video_train');
		videoTrain.Stop();
		videoTrain.Play();

		introClean = sender.findName('intro_clean');
		introClean.addEventListener("Completed", Silverlight.createDelegate(this, this.handleCompleted));
		introClean.Begin();
		
	},
	
	handleCompleted: function(sender, eventArgs) 
	{
		sender.findName('intro_bulle').Begin();
		party = sender.findName('party');
		party.addEventListener("Completed", Silverlight.createDelegate(this, this.goScreens));
		party.Begin();
	},
	
	goScreens: function(sender, eventArgs)
	{
		//sender.findName('screens').SetValue('Visibility','Visible')
		sender.findName('screenAnim').Begin();
	}
}