if (!window.HTMLandXAML)
	window.HTMLandXAML = {};

HTMLandXAML.Scene = function() 
{
}

HTMLandXAML.Scene.prototype =
{
	handleLoad: function(plugIn, userContext, rootElement) 
	{
		this.plugIn = plugIn;
		
		// Setup Buttons
		this.setupButton(rootElement.findName("button1"));	
		this.setupButton(rootElement.findName("button2"));	
		
	},
	
  setupButton: function(button) {
		button.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.handleMouseEnter));
		button.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));
		button.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleMouseUp));
		button.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.handleMouseLeave));
  },

  handleMouseEnter: function(sender, eventArgs) {
    var gradientStop1 = sender.findName(sender.Name + "_gradientStop1");
	  var gradientStop2 = sender.findName(sender.Name + "_gradientStop2");
	  gradientStop1.offset = 1;
	  gradientStop2.offset = .403;
  },

  handleMouseLeave: function(sender, eventArgs) {
	  var gradientStop1 = sender.findName(sender.Name + "_gradientStop1");
	  var gradientStop2 = sender.findName(sender.Name + "_gradientStop2");
	  gradientStop1.offset = 0;
	  gradientStop2.offset = 1;
  },

  handleMouseUp: function(sender, eventArgs) {
	  var gradientStop1 = sender.findName(sender.Name + "_gradientStop1");
	  var gradientStop2 = sender.findName(sender.Name + "_gradientStop2");
	  gradientStop1.offset = 1;
	  gradientStop2.offset = .403;
  	
	  alert("clicked: " + sender.Name);
  },

  handleMouseDown: function(sender, eventArgs) {
	  var gradientStop1 = sender.findName(sender.Name + "_gradientStop1");
	  var gradientStop2 = sender.findName(sender.Name + "_gradientStop2");
	  gradientStop1.offset = .7;
	  gradientStop2.offset = .475;
  }
}