Your show function would look like this:
var sName = imgName[ImageIndex];
var sHTML = "<html><body><img src=\" + sName + "\"></body></html>";
var oWin = window.open("");
var oDoc = oWin.document;
For next and previous you will have to have code in the new window to link to the relevant image. It would be easier if your show function took the name of the image, instead of writing the count put the image source, and have a second parameter for whetehr a new window is needed or not. This way it can be re-used for both windows.
Joe (Microsoft MVP - XML