My Javascript ain\'t so hot, so before I get into some messy string operations, I thought I\'d ask:
If the current url is: \"http://stackoverflow.com/questions/ask\"
alert(window.location.pathname);
Here's some documentation for you for window.location.
window.location