﻿Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);    
function beginRequest(sender, args) { showLightbox(); }
function endRequest(sender, args) { hideLightbox(); if( typeof(psScroll) == 'undefined' ){ ScrollToTop(); } }
function ScrollToTop() { ss.smoothScroll(); }
var ss = { smoothScroll: function(e) { ss.STEPS = 25; clearInterval(ss.INTERVAL);
    ss.INTERVAL = setInterval('ss.scrollWindow()',10); if (window.event) { window.event.cancelBubble = true; window.event.returnValue = false; }
    if (e && e.preventDefault && e.stopPropagation) { e.preventDefault(); e.stopPropagation(); } },
scrollWindow: function() { var cypos = ss.getCurrentYPos(), dest = 0; scramount = parseInt((-cypos)/ss.STEPS);
    scramount = ( scramount.toString().replace('-', '') <= 0 ? -1 : scramount );
    wascypos = ss.getCurrentYPos(); isAbove = (wascypos < dest); window.scrollTo(0,wascypos + scramount);
    iscypos = ss.getCurrentYPos(); isAboveNow = (iscypos < dest);
    if ((isAbove != isAboveNow) || (wascypos == iscypos)) { window.scrollTo(0,dest); clearInterval(ss.INTERVAL); } },
getCurrentYPos: function() { if (document.body && document.body.scrollTop) return document.body.scrollTop; if (document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop; if (window.pageYOffset) return window.pageYOffset; return 0; }
}
