You could execute this an easier way, not as complex but much easier.
create a function like so:
<script>
<!--
function getImg(imgX,w,h){
window.open(imgX,'','toolbars=0,width='+w+'scrollbars=1,height='+h+'status=0')
}
//-->
</script>
then in your href links put this :
<a...