﻿/// <reference name="MicrosoftAjax.js"/>
Sys.Application.add_init(App_Init);

function App_Init()
{
  Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequest);
  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
}

function BeginRequest(sender, args)
{
  // Find the ID of the UpdatePanel raising the partial postback.
  var sendingPanelID = sender._postBackSettings.panelID.split("|")[0].replace(/\$/g,"_");
  
  // Using that ID, get a reference to that UpdatePanel's div.
  var sendingPanel = document.getElementById(sendingPanelID);
  
  // Get an array of all the input elements in that div.
  var links = sendingPanel.getElementsByTagName('a');
  
  links[0].style.display = 'none';
  links[1].style.display = 'block';
}

function EndRequest(sender, args)
{
  var sendingPanelID = sender._postBackSettings.panelID.split("|")[0].replace(/\$/g,"_");
  
  // Using that ID, get a reference to that UpdatePanel's div.
  var sendingPanel = document.getElementById(sendingPanelID);
  
  // Get an array of all the input elements in that div.
  var links = sendingPanel.getElementsByTagName('a');
  
  links[0].style.display = 'block';
  links[1].style.display = 'none';
}