function WPImage(link, title, width, height, root)
{
  width += 20;
  height += 40;
  w = ((width < screen.width) ? width : (screen.width - 40));
  h = ((height < screen.height) ? height : (screen.height - 60));

  opts = 'width=' + w + ',height=' + h +',resizable=yes';
  url = root + 'gallery/image.php?link='
      + escape(link.replace(/ /g, '+'))
      + '&title=' + escape(title.replace(/ /g, '+'));

  window.open(url, 'img', opts);
}

