//usage: <a href="url" onclick="return openSubWin(this.href, '', null, null, width, heigh)">anchor text</a>

function openSubWin(url, nm, x, y, w, h, atts) { //atts might be (example): "toolbar,location,menubar,resizable,scrollbar,status,dependent"
  nm = nm || "subwindow";
  atts = atts || "resizable=1,scrollbars=1";
  w = w || 600; h = h || 450;
  x = (typeof x=="number")? x: window.opera? 100: Math.round( (screen.availWidth - w)/2 );
  y = (typeof y=="number")? y: window.opera? 20: Math.round( (screen.availHeight - h)/2 );
  atts += ',width='+w+',height='+h+',left='+x+',top='+y;
  var win = window.open("", nm, atts); 
  if (win) {
    if (!win.closed) { win.moveTo(x,y); win.resizeTo(w,h); win.focus(); win.location.href=url; return false; }
  } 
  return true;
}