var nowImage = 0;

function popupWindow(image, height, width) {
//resizeOk は必要ないかも。。
  var resizeOk = 0;
  if(nowImage != 0){
	win1.close();
  }
  if(nowImage == image){
	nowImage = 1;
  }
  if(nowImage != image) {
	nowImage = image; 
  	var tmpheight = height;
  	var tmpwidth = width
  	if(resizeOk == 0){
  		win1 = window.open('','popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150');
  		win1.document.writeln('<html>');
  		win1.document.writeln('<head><title>商品画像</title></head>');
  		win1.document.writeln('<body>');
  		win1.document.writeln('<table width="100%" align="center" valign="center" class="popupimage"><tr><td class="popupimages" align="center" valign="middle">');
  		win1.document.writeln('<a href="javascript:window.close()"><img src="images/'+image+'_L.jpg" border="0" /></a></td></tr></table>');
  		win1.document.writeln('</body>');
  		win1.document.writeln('</html>');
  		winName = win1.name;
  		resizeOk = 1;
  	}
  }else{
  	resizeOk = 1;
  }
  if(resizeOk == 1){
  	resize(tmpheight,tmpwidth);
	resizeOk = 0;
  }
}
function resize(imageheight,imagewidth) {
  var i=0;
  if (navigator.appName == 'Netscape'){
	 i=10;
  }
  if (document.images[0]) {
	imgWidth = imagewidth+30;
  	imgHeight = imageheight+85-i;
	var height = screen.height;
 	var width = screen.width;
  	var leftpos = width / 2 - imgWidth / 2;
  	var toppos = height / 2 - imgHeight / 2;
  	win1.moveTo(leftpos, toppos);
	win1.window.resizeTo(imgWidth, imgHeight);
 }
  win1.focus();
}