if (!window.HarryPotter5Promo)
	window.HarryPotter5Promo = {};

HarryPotter5Promo.Page = function() 
{
}

HarryPotter5Promo.Page.prototype =
{
	handleLoad: function(control, userContext, rootElement) 
	{
		this.control = control;
		
		this.BottomOverlayIn = control.content.findName("BottomOverlayIn");
		this.BottomOverlayOut = control.content.findName("BottomOverlayOut");
			
		this.movie = control.content.findName("MainMovie");
		this.movie.addEventListener("markerReached", Silverlight.createDelegate(this,this.movieMarkerReached));
		this.movie.addEventListener("MediaEnded", Silverlight.createDelegate(this,this.movieMediaEnded));
		
		this.MainRoot = control.content.findName("MainRoot");
		this.MainRoot.addEventListener("MouseEnter", Silverlight.createDelegate(this,this.handleMouseEnter));
		this.MainRoot.addEventListener("MouseLeave", Silverlight.createDelegate(this,this.handleMouseLeave));
		
		this.txtDVD = control.content.findName("txtDVD");
		this.txtDVD.cursor = "hand";
		this.txtDVD.addEventListener("MouseEnter", Silverlight.createDelegate(this,this.txtDVDMouseEnter));
		this.txtDVD.addEventListener("MouseLeave", Silverlight.createDelegate(this,this.txtDVDMouseLeave));
		this.txtDVD.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this,this.txtDVDMouseLeftButtonUp));
		
		this.txtHDDVD = control.content.findName("txtHDDVD");
		this.txtHDDVD.cursor = "hand";
		this.txtHDDVD.addEventListener("MouseEnter", Silverlight.createDelegate(this,this.txtHDDVDMouseEnter));
		this.txtHDDVD.addEventListener("MouseLeave", Silverlight.createDelegate(this,this.txtHDDVDMouseLeave));
		this.txtHDDVD.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this,this.txtHDDVDMouseLeftButtonUp));
		
		this.txtBluray = control.content.findName("txtBluray");
		this.txtBluray.cursor = "hand";
		this.txtBluray.addEventListener("MouseEnter", Silverlight.createDelegate(this,this.txtBlurayMouseEnter));
		this.txtBluray.addEventListener("MouseLeave", Silverlight.createDelegate(this,this.txtBlurayMouseLeave));
		this.txtBluray.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this,this.txtBlurayMouseLeftButtonUp));
	},
	
	/////////////////////////////////////////////////////////////////////////
	//  Main Canvas Events
	/////////////////////////////////////////////////////////////////////////
	
	// MouseEnter
	handleMouseEnter: function(sender, eventArgs) 
	{
		this.BottomOverlayIn.begin();
	},
	
	// MouseLeave
	handleMouseLeave: function(sender, eventArgs) 
	{
		this.BottomOverlayOut.begin();
	},
	
	/////////////////////////////////////////////////////////////////////////
	//  movie Events
	/////////////////////////////////////////////////////////////////////////
	
	movieMarkerReached: function(sender, eventArgs)
	{
        if (eventArgs.marker.text == "OverlayIn")
        {
          this.BottomOverlayIn.begin();
        }
        if (eventArgs.marker.text == "OverlayOut")
        {
          this.BottomOverlayOut.begin();
        }
	},
	
	movieMediaEnded: function(sender, eventArgs)
	{
	    sender.Position = "00:00:00";
        sender.play();
	},
	
	/////////////////////////////////////////////////////////////////////////
	//  txtDVD Events
	/////////////////////////////////////////////////////////////////////////
	
	// MouseEnter
	txtDVDMouseEnter: function(sender, eventArgs) 
	{
    this.txtDVD.Foreground = "white";
	},
	
	// MouseLeave
	txtDVDMouseLeave: function(sender, eventArgs) 
	{
    this.txtDVD.Foreground = "black";
	},
	
	// MouseClick
	txtDVDMouseLeftButtonUp: function(sender, eventArgs) 
	{
    window.location.href="http://www.amazon.com/gp/product/B000W45C70?ie=UTF8&tag=digitalwushuc-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B000W45C70";
	},
	
	/////////////////////////////////////////////////////////////////////////
	//  txtHDDVD Events
	/////////////////////////////////////////////////////////////////////////
	
	// MouseEnter
	txtHDDVDMouseEnter: function(sender, eventArgs) 
	{
    this.txtHDDVD.Foreground = "white";
	},
	
	// MouseLeave
	txtHDDVDMouseLeave: function(sender, eventArgs) 
	{
    this.txtHDDVD.Foreground = "black";
	},
	
	// MouseClick
	txtHDDVDMouseLeftButtonUp: function(sender, eventArgs) 
	{
    window.location.href="http://www.amazon.com/gp/product/B000W45D06?ie=UTF8&tag=digitalwushuc-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B000W45D06";
	},
	
	/////////////////////////////////////////////////////////////////////////
	//  txtBluray Events
	/////////////////////////////////////////////////////////////////////////
	
	// MouseEnter
	txtBlurayMouseEnter: function(sender, eventArgs) 
	{
    this.txtBluray.Foreground = "white";
	},
	
	// MouseLeave
	txtBlurayMouseLeave: function(sender, eventArgs) 
	{
    this.txtBluray.Foreground = "black";
	},
	
	// MouseClick
	txtBlurayMouseLeftButtonUp: function(sender, eventArgs) 
	{
    window.location.href="http://www.amazon.com/gp/product/B000W45C70?ie=UTF8&tag=digitalwushuc-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B000W45C70";
	}		
}