function changeWindowSize(pic)
{
    var myWidth=pic.width;
    var myHeight=pic.height;
	Window.alert("\nmyWidth=" + myWidth + " \nmyHeight=" + myHeight);

   document.resizeTo(myWidth+20,myHeight+30);
}

function image_open(image_loc,img)
{
  HTML = "<html><style>body{margin:0px 0px 0px 0px}</style><body onBlur='top.close()'><img src='"+ 
  image_loc +"' border=0 name=load_image onLoad='window.resizeTo(document.load_image.width+10,document.load_image.height+30)'></body></html>";
  popupImage = window.open('','_blank','toolbar=no,scrollbars=no,width=640,height=480');
  popupImage.document.open();
  popupImage.document.write(HTML);
  popupImage.document.close();
  var obj_img = document.getElementById(img);
  obj_img.src= obj_img.src;
}

function openNewWindow(filename)
{
  var features;
  var gotSize=false;
  var pic=new Image();
  pic.src=filename;

  if(eval(pic).height)
  {
    myWidth=eval(pic).width;
    myHeight=eval(pic).height;
	gotSize=true;
  }
  else
  {
    myWidth=640;
    myHeight=480;
    pic.onload=changeWindowSize;
  }
  features = 'resizable,left=0,top=0' +
             ',width=' + (myWidth+20) +
             ',height=' + (myHeight+30);
  var popupWin = window.open(filename, 'open_window', features)
  popupWin.document.bgColor="black";
 }

function showThumbnailx(filename)
{
  var picname=filename.split('.');
  var smallPic=new Image();
  bigPicName=picname[0] + "." + picname[1];
  smallPic.src=picname[0] + "_sm." + picname[1];
/*
  document.write("<a href=\"javascript:openNewWindow(\'" + bigPicName + "\');\">" + 
                 "<img src=\"" + smallPic.src + "\"></a>");
*/				 
  document.write("<a href=\"javascript:image_open(\'" + bigPicName + "\',\'img1\');\">" + 
                 "<img src=\"" + smallPic.src + "\" id=\'img1\'></a>");
}
