javascript has a "scroll" function in which the page automatically scrolls to a certain point. you might want to look into that. but i don't really understand the whole script and how it works...it's hard to provide information.

another solution (depending on how you wrote the script) would be to set a variable to the place you wanted them to go.

ex.
function goThere(place){
document.href = "page.html#" + place;
}

i didn't try it out so it may have a bug or 2 but you get my drift.