function imgResize(img){
  img1= new Image();
  img1.src=(img);
  imgControll(img);
}

function imgControll(img){
  if((img1.width!=0)&&(img1.height!=0)){
    viewImage(img);
  }
  else{
    controller="imgControll('"+img+"')";
    intervalID=setTimeout(controller,20);
  }
}

function viewImage(img){
    W=img1.width;
    H=img1.height;
    O="width="+W+",height="+H;
    imgWin=window.open("","",O);
    imgWin.document.write("<html><head><title>이미지 미리보기</title></head>");
    imgWin.document.write("<body topmargin=0 leftmargin=0>");
    imgWin.document.write("<img src="+img+" onclick='self.close()' style=cursor:hand>");
    imgWin.document.close();
}
