﻿if (!window.DNN_SilverlightApplication)
	window.DNN_SilverlightApplication = {};

DNN_SilverlightApplication.Scene = function() 
{
}

DNN_SilverlightApplication.Scene.prototype =
{
	handleLoad: function(plugIn, userContext, rootElement) 
	{
		this.plugIn = plugIn;
		
		// Sample button event hookup: Find the button and then attach event handlers
		this.button = rootElement.children.getItem(0);	
		
		this.button.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.handleMouseEnter));
		this.button.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));
		this.button.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleMouseUp));
		this.button.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.handleMouseLeave));
	},
	
	// Sample event handlers
	handleMouseEnter: function(sender, eventArgs) 
	{
		// The following code shows how to find an element by name and call a method on it.
		var mouseEnterAnimation = sender.findName("mouseEnter");
		mouseEnterAnimation.begin(); 
		
		sender.findName("txtButton").Text="Click Me";
	},
	
	handleMouseDown: function(sender, eventArgs) 
	{
		var mouseDownAnimation = sender.findName("mouseDown");
		mouseDownAnimation.begin(); 
	},
	
	handleMouseUp: function(sender, eventArgs) 
	{
		var mouseUpAnimation = sender.findName("mouseUp");
		mouseUpAnimation.begin(); 
		
		// Get an instance of the DNN_Silverlight object that contains the current
		// user information needed to securely access the web service
		var Module = new DNN_Silverlight.Module();
		GetUser(Module.PortalId,Module.ModuleId,Module.UserId,Module.Password,sender);
	},
	
	handleMouseLeave: function(sender, eventArgs) 
	{
		var mouseLeaveAnimation = sender.findName("mouseLeave");
		mouseLeaveAnimation.begin(); 
	}
}