I am working on Javascript Navigation menu for the entire site. I am getting problem making javascript to understand siteroot.

I have a file myNav.js with the URL paths and Links Text defined. siteroot is http://my.site.com.
var links = new Array

var links_text = new Array
"A-Z List",
"Business Process",

I am using this array in another file (which is not at the siteroot but in 'navigation' folder under siteroot) to output the links.
for(var i=0; i<links.length; i++)
document.write('<a href= "' + links[i] + '">' + links_text[i] + '</a>');

I am getting problem at this point. Instead of the path "http://my.site.com/index.html", the path is coming as "http://my.site.com/navigation/index.html. How to make sure javascript prefixes siteroot rather than the filepath ?

Thanks for the help,