I have this neat little code:
<script type="text/javascript" language="javascript">
$(function(){
$(window).hashchange( function(){
window.scrollTo(0,0);
var hash = location.hash;
if (hash == "") {
hash="#main";
}
var newhash = !/\.php$/i.test(hash)? hash+".html": hash;
ajax_loadContent('m',newhash.slice(1,newhash.length));
$('.menu li a').each(function(){
var that = $(this);
that[ that.attr( 'href' ) === hash ? 'addClass' : 'removeClass' ]( 'current' );
});
})
$(window).hashchange();
});
</script>
The only problem is that if I navigate to pages containing Javascript that code isn't being executed. How can I make it run the Javascript code as if the browser loaded the page normally?