Thanks again for your time, Coothead, but that is not going to work for me either. I need a solution that parses the current page address, an duses that to build the address of the new one. Then, I can plug it in without having to be explicit about any address.
This is what I've been playing aorund with, but cannot get it working, and I have no idea how to debug JS.
Code:
<script>
function myFunction() {
var currentpage = window.location.href;
var n = currentpage.indexof(_spanish);
var len = location.path.length;
if n>0 {
/* make the new page address without _spanish */
var firstbit = location.hostname;
var secondbit = currentpage.substr(n+1,len-n);
var newpage= concat(firstbit, secondbit);
}
else {
/* make the new page address with _spanish inserted after domain name*/
var spa = "/_spanish/"
var firstbit = location.hostname;
var secondbit = location.path;
var newpage= concat(firstbit,spa, secondbit);
}
location.href=newpage
}
</script>
Bookmarks