$(document).ready(function() {

				$('a').click(function(){
					
					$(this).addClass('local');
					$("a:urlExternal").removeClass('local').addClass('external');
					elemclass = $(this);
					if (elemclass.hasClass ("local")) {
					
					// Do some stuff
					$('html, body').stop().animate({scrollTop:0}, 300);
					// Stop doing stuff
				
				    // Wait 300ms before loading the url
					var myurl = ('#' + $(this).attr("href"));	
						
					setTimeout(function() { window.location = myurl }, 300 ); 
					return false;
					} else {
					$(this).attr('target', '_blank');
					}
				});
	});
