function winOpen(file,title,w,h)
{
  var look = '';
  var sbars = 0;
  var resize = 0;

  if(w > screen.availWidth)
  {
    w = screen.availWidth-30;
    sbars = 0;
    resize = 1;
  }
  if(h > screen.availHeight)
  {
    h = screen.availHeight-60;
    sbars = 0;
    resize = 1;
  }

  xpos = (screen.availWidth / 2)-(w / 2);
  ypos = (screen.availHeight / 2)-(h / 2);

  if(typeof(newWin)=='object')
  {
    if(!newWin.closed)
      newWin.resizeTo(w+10, h+29);
  }
  look = 'scrollbars='+sbars+', resizable='+resize+', width='+w+', height='+h+', left='+xpos+', top='+ypos;
  newWin = window.open(file,'newWinodow','toolbar=0,statusbar=0,location=0,'+look);
  newWin.document.write("<html><head><title>"+title+"</title></head>");
  newWin.document.write("<body style='margin: 0px; background-color: #f2f1f1'><img src='" +file+ "' onClick='window.close();' border='0' />");
  newWin.document.write("</body></html>");
  newWin.focus();
  newWin.document.close();
} 