var lastVisible = "vle_contents";

if (!window.EventsLanding)
  window.EventsLanding = {};

EventsLanding.Page = function()
{
}

EventsLanding.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("Timeline1").Begin();
  }
}

function hideLast(s)
{
  if (lastVisible != "")
  {
    hide = s.findName(lastVisible);
    hide.Visibility = "Collapsed";

    if (lastVisible == "vle_contents")
    {
      vleVideo = s.findName("vle_contents");
      vleVideo.findName("vle_video").Stop();
    }
  }
}


function selectVle(s)
{
  hideLast(s);

  vleVideo = s.findName("vle_contents");
  vleVideo.Visibility = "Visible";
  vleVideo.findName("vle_video").Play();

  lastVisible = "vle_contents";
}

function selectLaunch(s)
{
  hideLast(s);
  launchImage = s.findName("launch_contents");
  launchImage.Visibility = "Visible";
  lastVisible = "launch_contents";

}


function selectLearning(s)
{
  hideLast(s);
  learningImage = s.findName("learning_contents");
  learningImage.Visibility = "Visible";
  lastVisible = "learning_contents";

}


function selectOnline(s)
{
  hideLast(s);
  onlineImage = s.findName("online_contents");
  onlineImage.Visibility = "Visible";
  lastVisible = "online_contents";

}

var currentCanvasZIndex = 0;

function handleMouseEnter(s) {

  if (s["Name"]) {

    // Set the collection's ZIndex
    currentCanvasZIndex = s.GetParent()["Canvas.ZIndex"];
    s.GetParent()["Canvas.ZIndex"] = 100;

    // Get the event handler
    handlerStoryBoard = s.findName(s["Name"] + "_MouseEnter");
    handlerStoryBoard.Begin();
  }
}

function handleMouseLeave(s) {

  if (s["Name"]) {

    // Reset the ZIndex
    s.GetParent()["Canvas.ZIndex"] = currentCanvasZIndex;

    // Get the event handler
    handlerStoryBoard = s.findName(s["Name"] + "_MouseLeave");
    handlerStoryBoard.Begin();
  }
}

function goToVLE(s)
{
  window.open("http://www.microsoft.com/virtualevents");
}

function goToVLE2(s)
{
  window.open("http://www.microsoft.com/virtualevents/sneakpeek");
}


function goToLaunch()
{
  //window.open("http://www.microsoft.com/heroeshappenhere/register/default.mspx");
  location.href = "/heroeshappenhere/register/default.mspx";
}

function goToLearning()
{
  window.open("http://www.heroescommunitylaunch.com/");
}

function goToWindowsServerWV()
{
  window.open("http://www.microsoft.com/events/series/windowsserver2008.aspx");
}

function goToWindowsServerTestdrive()
{
 // window.open("http://www.microsoft.com/heroeshappenhere/Testdrive/windows-server-2008/default.mspx");
   location.href = "/heroeshappenhere/Testdrive/windows-server-2008/default.mspx";
}

function goToVisualStudioWV()
{
  window.open("http://msdn2.microsoft.com/en-us/aa740361.aspx");
}

function goToVisualStudioTestdrive()
{
 // window.open("http://www.microsoft.com/heroeshappenhere/Testdrive/visual-studio-2008/default.mspx");
  location.href = "/heroeshappenhere/Testdrive/visual-studio-2008/default.mspx";

}

function goToSQLServerWV()
{
  window.open("http://www.microsoft.com/sql/2008/learning/default.mspx");
}

function goToSQLServerTestdrive()
{
 // window.open("http://www.microsoft.com/heroeshappenhere/TestDrive/sql-server-2008/default.mspx");
  location.href = "/heroeshappenhere/Testdrive/sql-server-2008/default.mspx";
}


