Hi I have text links on top-right of every html page that switch to another language of the current page. How do I use javascript or jquery to switch languages without editing every page?

currently my links look like below:
<li id="EngToChi"><a href="/account/en/page1.html"><img src="/images/account/buttons/english.jpg" alt="English" width="36" height="13" align="top" /></a></li>

I want <a href="/account/en/page1.html"> to use javascript instead:

<a href="dynamically use current url and change from /ch/ to /en/ and vice versa">