<!-- ajaxRequest -->
//processing function
function callback(serverData, serverStatus, id) {
document.getElementById('definition').innerHTML = serverData;
scrollDiv(id); //scrolls div to desired location
}

function ajaxRequest(page, id) {
var id = id;
var AJAX = null;
if (window.XMLHttpRequest) {
AJAX=new XMLHttpRequest();
} else { 
AJAX=new ActiveXObject("Microsoft.XMLHTTP");
} // End setup Ajax.
if (AJAX==null) { // If Ajax couldn't initialize...
alert("Your browser doesn't support AJAX."); // Sorry msg. 
return false // Return false, couldn't set up ajax
}
AJAX.onreadystatechange = function() { // When the browser has the request info..
if (AJAX.readyState==4 || AJAX.readyState=="complete") { // see if the complete flag is set.
callback(AJAX.responseText, AJAX.status, id); // Passes the response to processing function
} // End Ajax readystate check.
}
var url=page; // This is the URL to be called.
AJAX.open("GET", url, true); // Open the url this object was set-up with.
AJAX.send(null); // Send the request.
}

<!-- scrolling function and variables -->
scrollSteps = 50
timer=""
moz=document.getElementById&&!document.all

function scrollDiv(id){
clearTimeout(timer)
scrollingDiv=document.getElementById("definition")

if((moz||window.opera)&&!scrollingDiv.style.position){
browserOffset=scrollingDiv.offsetTop
}

else{
browserOffset=0
}

if(scrollingDiv.scrollTop <= document.getElementById(id).offsetTop-scrollSteps-browserOffset){
scrollingDiv.scrollTop=document.getElementById("definition").scrollTop+scrollSteps
timer=setTimeout("scrollDiv('"+id+"')",10)

// if bottom of page reached before anchor point
if(scrollingDiv.scrollTop>(scrollingDiv.scrollHeight-scrollingDiv.offsetHeight)-scrollSteps){
clearTimeout(timer)
scrollingDiv.scrollTop=document.getElementById("definition").scrollHeight-scrollingDiv.offsetHeight
}

}

else{

if(scrollingDiv.scrollTop >= document.getElementById(id).offsetTop+scrollSteps-browserOffset){
scrollingDiv.scrollTop=document.getElementById("definition").scrollTop-scrollSteps
timer=setTimeout("scrollDiv('"+id+"')",10)
}

else{
clearTimeout(timer)
scrollingDiv.scrollTop=document.getElementById(id).offsetTop-browserOffset
}
}

}

function toTop(){
scrollingDiv=document.getElementById("definition")
clearTimeout(timer)

if(scrollingDiv.scrollTop >= scrollSteps){
scrollingDiv.scrollTop=document.getElementById("definition").scrollTop-scrollSteps
timer=setTimeout("toTop()",10)
}

else{
clearTimeout(timer)
scrollingDiv.scrollTop=0
}

}

