You can set the base href from the default to the required. For example assume the following HTML code is included.
<base href="http://beamish/flat/sIFR/" />
Thereafter all references would precede with: http://beamish/flat/sIFR/
Therefore:
<script src="sifr.js" type="text/javascript"></script>
Would infact call:
http://beamish/flat/sIFR/sifr.js