Jquery display block after partial page load
<p>here is my code:</p>

<pre><code>$("a").live('click', function(){
history.pushState({}, '', this.href);
popstate(this.href);
$("#loadpage").css("display", "block");
return false;
});
popstate = function(url){
url = '/ajaxlinks/ajaxlink'+window.location.pathname.substr(1);
if (url == '/ajaxlinks/ajaxlink'){url = '/ajaxlinks/ajaxlinkindex.php'}
if (url.indexOf(".php") == -1){url = '/ajaxlinks/ajaxlinkprofile.php'}
if (url == '/ajaxlinks/ajaxlinkaccountrecovery.php'){window.location =     'http://www.pearlsquirrel.com/accountrecovery.php';}
if (url == '/ajaxlinks/ajaxlinklogin.php'){window.location =    'http://www.pearlsquirrel.com/login.php';}
if (url == '/ajaxlinks/ajaxlinklogout.php'){window.location =    'http://www.pearlsquirrel.com/logout.php';}
$('#ajaxloadcontent').load(url);
$('html, body').animate({scrollTop:0}, 'fast');
}
$(document).load(function(){
window.onpopstate = function(event){
popstate(window.location.href);
event.preventDefault();
}
});
</code></pre>

<p>When clicking on a link, I start this bit of code to show the loading div:</p>

<pre><code>$("#loadpage").css("display", "block");
</code></pre>

<p>However, I don't know where to put the bit of code that displays this div as none:</p>

<pre><code>$("#loadpage").css("display", "none");
</code></pre>

<p>I have tried putting this bit of code everywhere, and I just can not seem to get it to work.  If anyone knows where I should put this code and maybe if I should even use different syntax, the help would be greatly appreciated.</p>
