function popup_image(popup_href, img_width, img_height)
{

  var paddingTop=0;
  var paddingBottom=0;
  var paddingLeft=0;
  var paddingRight=0;
  if (typeof screen.availWidth != 'undefined' && typeof screen.availHeight != 'undefined')
  {
    if (typeof screen.availLeft != 'undefined' && typeof screen.availHeight != 'undefined')
    {
      var left = Math.max(0, Math.ceil(screen.availLeft + (screen.availWidth - img_width - paddingLeft - paddingRight) / 2));
      var top = Math.max(0, Math.ceil(screen.availTop + (screen.availHeight - img_height - paddingTop - paddingBottom) / 2));
    }
    else
    {
      var left = Math.max(0, Math.ceil((screen.availWidth - img_width - paddingLeft - paddingRight) / 2));
      var top = Math.max(0, Math.ceil((screen.availHeight - img_height - paddingTop - paddingBottom) / 2));
    }
  }
  else
  {
    var left = 0;
    var top = 0;
  }

  var preview = window.open(popup_href, 'preview', 'width='+img_width+',height='+img_height+',top='+top+',left='+left+',resizable=0,toolbar=0,directories=0,location=0,menubar=0,personalbar=0,scrollbars=0,status=0');
  preview.focus(); 
  return false;
}

function findObj(n, d) {
    var p,i,x;
    if (!d)
        d=document;
    if ((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
    }
    if (!(x=d[n])&&d.all)
        x=d.all[n];
    for (i=0;!x&&i<d.forms.length;i++)
        x=d.forms[i][n];
    for (i=0;!x&&d.layers&&i<d.layers.length;i++)
        x=findObj(n,d.layers[i].document);
    if (!x && d.getElementById)
        x=d.getElementById(n);
    return x;
}