﻿if (!window.WS2008TestDemo)
	WS2008TestDemo = {};

WS2008TestDemo.Page = function() 
{
}

WS2008TestDemo.Page.prototype =
{
	handleLoad: function(control, userContext, rootElement) 
	{
		this.control = control;
		
		// Sample event hookup:	
		rootElement.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));
	},
	
	// Sample event handler
	handleMouseDown: function(sender, eventArgs) 
	{
		// The following line of code shows how to find an element by name and call a method on it.
		// this.control.content.findName("Storyboard1").Begin();
	}
}

var clickState; 

function onLoaded(sender, eventArgs) 
{
    clickState="";
    sender.findName("stBanner").begin();
}

function onMouseLeave(sender, eventArgs)
{
    //Button Style
    clickState = "MouseLeave";
    var enter = sender.findName("btn" + sender.name+"Over");
    var normal = sender.findName("btn" + sender.name+"Off");
    enter.Opacity = 0;
    normal.Opacity = 1;

    //Robot Animation.
    sender.findName("stBanner").Resume();
}

function onMouseEnter(sender, eventArgs)
{
    //Button Style
    clickState = "MouseEnter";
    var enter = sender.findName("btn" + sender.name+"Over");
    var normal = sender.findName("btn" + sender.name+"Off");
    enter.Opacity = 1;
    normal.Opacity = 0;
    
    //Robot Animation.
    sender.findName("stBanner").Pause();
    
    if(sender.name == "Home")
    {
        sender.findName("stBanner").Seek("0:0:2");
    }
    else if(sender.name == "Stability")
    {
        sender.findName("stBanner").Seek("0:0:4.5");
    }
    else if(sender.name == "Manageability")
    {
        sender.findName("stBanner").Seek("0:0:7");
    }
    else if(sender.name == "Security")
    {
        sender.findName("stBanner").Seek("0:0:9.5");
    }
    else if(sender.name == "Web")
    {
        sender.findName("stBanner").Seek("0:0:12");
    }
}

function onMouseLeftButtonDown(sender, eventArgs)
{
    //link.
    if(sender.name == "Home")
    {
        this.location.href = "./default.aspx";
    }
    else if(sender.name == "Stability")
    {
        this.location.href = "http://switch.atdmt.com/action/FY08_WS2008_HomeToStability_Button";
    }
    else if(sender.name == "Manageability")
    {
        this.location.href = "http://switch.atdmt.com/action/FY08_WS2008_HomeToManagebility_Button";
    }
    else if(sender.name == "Security")
    {
        this.location.href = "http://switch.atdmt.com/action/FY08_WS2008_HomeToSecurity_Button";
    }
    else if(sender.name == "Web")
    {
        this.location.href = "http://switch.atdmt.com/action/FY08_WS2008_HomeToWeb_Button";
    }
    else
    {
        //blank..
    }
}