How to pass value to querystring using JavaScript

I have an external JavaScript code - which basicially has
functionality so that different images are shown when a next or previous button is selected.
What I need to do and know is how to pass the value of the image to the querystring as I need
to use it further. Also I need the remote_sill value in the querystring to have
the default value of image_sill as such in the querystring upon first load.

So the external JavaScript is called like this in the page:

<script type="text/javascript" src="nextPrevious.js"></script>

In the HTML - of the previous and next buttons - I tried to pass the value as such with no luck:

OK - so I created a test of this and the external js file below - the function prev() and function next() - the hidden image name from the setImage() - isn't being fired or passed in as the alerts I added are not displaying any values at all. below is the .js as well as a sample HTML I'm using: