var lastVisible = "vle_contents";

if (!window.LaunchH)
  window.LaunchH = {};

LaunchH.Page = function()
{
}

LaunchH.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 selectCommunity(s)
{
  hideLast(s);
  communityImage = s.findName("community_contents");
  communityImage.Visibility = "Visible";
  lastVisible = "community_contents";

}


function selectStory(s)
{
  hideLast(s);
  storyImage = s.findName("story_contents");
  storyImage.Visibility = "Visible";
  lastVisible = "story_contents";

}


function selectComic(s)
{
  hideLast(s);
  comicImage = s.findName("comic_contents");
  comicImage.Visibility = "Visible";
  lastVisible = "comic_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()
{
  window.open("http://www.microsoft.com/virtualevents");
}

function goToCommunity()
{
  window.open("http://www.heroescommunitylaunch.com/");
}

function goToStory()
{
 // window.open("/spain/lanzamiento2008/portrait-gallery/default.mspx");
  location.href = "/spain/lanzamiento2008/partners/portrait-gallery/default.mspx";
}

function goToComic()
{
  window.open("http://www.itdevcomics.com");
}

function goToComicTeaser()
{
 // window.open("/spain/lanzamiento2008/partners/comic/default.mspx");
  location.href = "/spain/lanzamiento2008/partners/comic/default.mspx";
}

function goToComicRSS()
{
  window.open("http://blogs.technet.com/hhh_comic/rss.xml");
}