Changing part of url through document.location

Hi, I need to change the url in the user his browser, when he presses a button based on the buttonname. But it only needs to be visual (in other words, not going to the url, but only see it change). So people can bookmark it.

Now I have this:

 
ExternalInterface.call("document.location +=" , "?loc=" + location);

I need to stay in the current Flashapp, but change the url (just visually). Is this possible? If not, how can I strip the url dynamicly from the “?loc=something” part. And with dynamicly I mean, it detects what domain I am instead of hardcoding it.

Thanks