<!--
/***********************************
/ 이미지 사이즈에 맞게 새창띄우기
/***********************************/
function OpenImage(s){
 //
 // 변수 정의
 //
 srcImg = new Image();
 clientWidth = screen.width;
 clientHeight = screen.height;
 srcImg.src = s;
 //
 // 열려는 파일을 이름
 //
 var srcFileName = srcImg.src.substr(srcImg.src.lastIndexOf("/")+1, srcImg.src.length);
 //
 // 새창 띄우고 이미지 삽입
 //
 win = window.open("","","width=15,height=15,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,left="+(clientWidth/2-15)+",top="+(clientHeight/2-15)+"");
 win.document.writeln("<html>");
 win.document.writeln("<head>");
 win.document.writeln("<title>"+document.title+" ["+srcFileName+"]</title>");
 win.document.writeln("</head>");
 win.document.writeln("<body style='margin:0px;' bgcolor='#000000'>");
 win.document.writeln("<table border='0' cellpadding='0' cellspacing='0' style='cursor:hand' onclick='self.close()'>");
 win.document.writeln(" <tr>");
 win.document.writeln("  <td align='center'><img src="+s+" name='winImg' style='cursor:hand' onclick='self.close()' alt='Close the window'></td>");
 win.document.writeln(" </tr>");
 win.document.writeln("</table>");
 win.document.writeln("</body>");
 win.document.writeln("</html>");

 srcImg = win.document.winImg;
 //
 // 이미지가 모두 로딩될때까지 기다림
 //
 while(true)
 if(srcImg.readyState == "complete")
 break;
 
 //
 // 새창의 크기 설정
 //
 var winWidth = srcImg.width+13;
 var winHeight = srcImg.height+80;
 //
 // 새창이 띄워질 위치 설정
 //
 var left = (clientWidth/2)-(srcImg.width/2);
 var top = (clientHeight/2)-(srcImg.height/2);
 //
 // 이미지의 크기 overflow 확인후 새창의 크기와 위치 재설정
 //
 if(clientWidth <= srcImg.width){
  winWidth = clientWidth;
  left = 0;
  win.document.body.scroll = "auto";
 }
 if(clientHeight <= srcImg.height){
  winHeight = clientHeight-30;
  top = 0;
  win.document.body.scroll = "auto";
 }
 //
 // 이미지로딩이 끝났음으로 이미지의 크기를 사용할수 있다.
 // 해당 이미지의 사이즈에 맞게 윈도우를 재설정한다.
 win.moveTo(left, top);
 win.resizeTo(winWidth, winHeight);
}

