function viewImage(ifile, iw, ih, ititle) { 
var win;
var winl = (screen.width - iw) / 2;
var wint = (screen.height - ih) / 2;
var sWidth;
var sHeight;
var NS = (document.layers) ? 1 : 0;
var ww = ih + 18;
win = window.open("", "imageviewer", "top=" + wint + ", left=" + winl + ", width=" + iw + ", height=" + ww + ", menubar=no, toolbar=no");
if (NS) {
sWidth = win.innerWidth;
sHeight = win.innerHeight;
} else {
sWidth = win.document.body.clientWidth;
sHeight = win.document.body.clientHeight;
}
if (sWidth!=iw || sHeight!=ww) {
win.close();
setTimeout("viewImage('" + ifile + "', " + iw + ", " + ih + ", '" + ititle + "')", 250);
return;
}
win.document.open();

win.document.write('<html><head><title>' + ititle + '</title>');
win.document.write('<script type="text/javascript">');
win.document.write('function changeImage(filename) {');
win.document.write('mainimage.src = filename;');
win.document.write('}');
win.document.write('</script>');
win.document.write('<script type="text/javascript"> {');
win.document.write('image1 = new Image(' + iw + ', ' + ih + ');');
win.document.write('image1.src = "/download-games/snake-munch/images/screenshot1.jpg";');
win.document.write('image2 = new Image(' + iw + ', ' + ih + ');');
win.document.write('image2.src = "/download-games/snake-munch/images/screenshot2.jpg";');
win.document.write('image3 = new Image(' + iw + ', ' + ih + ');');
win.document.write('image3.src = "/download-games/snake-munch/images/screenshot3.jpg";');
win.document.write('}');
win.document.write('</script>');
win.document.write('</head><body>');
win.document.write('<table style="position: absolute; width: ' + iw + 'px; height: ' + ih + 'px; text-align: left; left: 0px; top: 0px; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0"><body>');
win.document.write('<tr><td style="text-align: center; vertical-align: middle;"><img name="mainimage" style="width: ' + iw + 'px; height: ' + ih + 'px;" alt="" src="'  + ifile + '"></td></tr>');
win.document.write('<tr><td>');
win.document.write('<table style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; width: 100%;" border="0" cellpadding="0" cellspacing="0"><tbody>');
win.document.write('<tr>');
win.document.write('<td style="height: 18px; text-align: center; font-weight: bold; color: rgb(0, 0, 0); background-color: rgb(255, 255, 223); cursor: default;" onmouseover="this.style.backgroundColor=\'rgb(255, 127, 0)\'; this.style.cursor=\'pointer\';" onmouseout="this.style.backgroundColor=\'rgb(255, 255, 223)\'; this.style.cursor=\'default\';" onclick="changeImage(\'/download-games/snake-munch/images/screenshot1.jpg\')">1</td>');
win.document.write('<td style="height: 18px; text-align: center; font-weight: bold; color: rgb(0, 0, 0); background-color: rgb(255, 255, 223); cursor: default;" onmouseover="this.style.backgroundColor=\'rgb(255, 127, 0)\'; this.style.cursor=\'pointer\';" onmouseout="this.style.backgroundColor=\'rgb(255, 255, 223)\'; this.style.cursor=\'default\';" onclick="changeImage(\'/download-games/snake-munch/images/screenshot2.jpg\')">2</td>');
win.document.write('<td style="height: 18px; text-align: center; font-weight: bold; color: rgb(0, 0, 0); background-color: rgb(255, 255, 223); cursor: default;" onmouseover="this.style.backgroundColor=\'rgb(255, 127, 0)\'; this.style.cursor=\'pointer\';" onmouseout="this.style.backgroundColor=\'rgb(255, 255, 223)\'; this.style.cursor=\'default\';" onclick="changeImage(\'/download-games/snake-munch/images/screenshot3.jpg\')">3</td>');
win.document.write('</tr>');
win.document.write('</tbody></table></td></tr></tbody></table></body></html>');

win.document.close();
}

