function stateChanged() is where you are using your var idst, yet your passing it to showhistory without sending it through to stateChanged();
In my experience the stateChanged function doesn't like arguments passed to it using the xmlHttp.onreadystatechange function.
I use one division for all ajax calls, and then move that to the appropriate location on each page.
if your interested, here is my ajax code:
use: getPage('fileWithoutExstention','null') for a page passing no variables;
use: getPage('fileWithoutExstention','cmd=command') for page with variables;
will return results to a <div id="results">