//<script language="javascript">
var winImgView

function imagePreview(url, guid, size, mode) {
	if (!mode) mode = '';
  var left = screen.availWidth - 480;
  var top = 100;
  if (url!=null) {
    var s  = '<html><title>image</title>'
        s += '<body leftmargin=0 topmargin=0 scroll=auto>'
        s += '<img src="'+url+'" onload="window.opener.resizeImageWindow(window, this.width, this.height)">'
        s += '</body></html>'
  }
  if (guid!=null) {
    var s  = '<html><title>image</title>'
        s += '<body leftmargin=0 topmargin=0 scroll=auto><center>'
        s += '<img src="view.php?type=image&guid='+guid+'&mode='+mode+'&size=original" onload="window.opener.resizeImageWindow(window, this.width, this.height)">'
        s += '</center></body></html>'
  }
  winImgView = window.open('','viewimage','left='+left+',top='+top+',width=480,height=360,scrollbars=1,location=0,resizable=1,modal=1')
  var o = winImgView.document.open("text/html", "replace");
  o.write(s)
}

function resizeImageWindow(win, w, h) {
  var maxW = screen.availWidth * 0.75;
  var maxH = screen.availHeight * 0.75;
  if (w>maxW) w = maxW
  if (h>maxH) h = maxH
  win.resizeTo(w+64, h+64)
  win.moveTo(screen.availWidth - (w+164), 100)
  win.focus()
}

function unitPopup(guid) {
  var left = 600, top = 200;
  window.popup = window.open('index.php?pop=yes&unit='+guid, 'popup', 'left='+left+',top='+top+',width=480,height=360,scrollbars=1,location=0,resizable=1,modal=1')
}

function void_() { }

//</script>
