﻿// JScript File

//Seta posicao na tela (para posicionar em um mesmo ponto da tela apos Postback)
//<body bgcolor="#e2deb8" onload="SetScrollerPosition()">
function SetScrollerPosition()
{ 
   if (document.getElementById("XPos").value != "")
   {
      var x = document.getElementById("XPos").value;
      var y = document.getElementById("YPos").value;
      window.scrollTo(x, y);
   }
   document.getElementById("XPos").value = "0";
   document.getElementById("YPos").value = "0";
}

//Pega a posicao na tela (para posicionar em um mesmo ponto da tela apos Postback)
//<asp:Button ID="cmdFinalizar" runat="server" Text="Finalizar" OnClientClick="GetScollerPosition()" />
function GetScollerPosition()
{
   var scrollX, scrollY;
   if (document.all)
   {
      if (!document.documentElement.scrollLeft)
          scrollX = document.body.scrollLeft;
      else
          scrollX = document.documentElement.scrollLeft;
      if (!document.documentElement.scrollTop)
          scrollY = document.body.scrollTop;
      else
          scrollY = document.documentElement.scrollTop;
   }   
   else
   {
       scrollX = window.pageXOffset;
       scrollY = window.pageYOffset;
   }
   document.getElementById("XPos").value = scrollX;
   document.getElementById("YPos").value = scrollY;
}
