function subwin(name) {
  tempwin = window.open("",name)
  tempwin.close()
  return false;
}

function window_left() {
  if((top != null) && (top.screenX != null)) return top.screenX;
  if((window != null) && (window.screenX != null)) return window.screenX;
  if((top != null) && (top.screenLeft != null)) return top.screenLeft;
  if((window != null) && (window.screenLeft != null)) return window.screenLeft;
  return 0;
}

function window_top() {
  if((top != null) && (top.screenY != null)) return top.screenY;
  if((window != null) && (window.screenY != null)) return window.screenY;
  if((top != null) && (top.screenTop != null)) return top.screenTop;
  if((window != null) && (window.screenTop != null)) return window.screenTop;
  return 0;
}

function window_width() {
  if((top != null) && (top.outerWidth != null)) return top.outerWidth;
  if((window != null) && (window.outerWidth != null)) return window.outerWidth;
  if(screen.availWidth != null) return screen.availWidth;
  if(screen.width != null) return screen.width;
  return 0;
}

function window_height() {
  if((top != null) && (top.outerHeight != null)) return top.outerHeight;
  if((window != null) && (window.outerHeight != null)) return window.outerHeight;
  if(screen.availHeight != null) return screen.availHeight;
  if(screen.height != null) return screen.height;
  return 0;
}

function getBrowserType() {
  var sBrowser = navigator.appName;
  var sVersion = parseInt(navigator.appVersion);
  var sDetail  = navigator.userAgent;
	
  if(sBrowser == "Netscape")  {
    if(sVersion == 2) return "Net2";
    if(sVersion >= 3 && sVersion < 4) return "Net3";
    if(sVersion >= 4) return "Net4";
  } else if(sBrowser == "Microsoft Internet Explorer") {
    if(sVersion >= 2 && sVersion <= 3)  {
      if(sDetail.indexof("3.") != -1) return "IE3";
      return "IE2";
    } else if(sVersion >= 4)
      return "IE4";
  }
  return null;
}

function popwin(winname, loc, posX, posY, width, height, resiz, scrollb, modal) {
  var sBrowVer = getBrowserType();
  if(posX < 0) {
    posX = (window_width() - width) / 2; if(posX < 0) posX = 0;
    if(sBrowVer.indexOf("IE") == -1) posX = window_left() + posX;
  }
  if(posY < 0) {
    posY = (window_height() - height) / 2; if(posY < 0) posY = 0;
    if(sBrowVer.indexOf("IE") == -1) posY = window_top() + posY;
  }
  if(resiz == null) resize = "1";
  if(scrollb == null) scrollb = "1";
  if(modal == null) modal = "0";
	
  if(sBrowVer == "Net2" || sBrowVer == "Net3") {
    NewWindow = window.open("", winname, "height=" + height + ",width=" + width + ",screenX=" + posX + ",left=" + posX + ",screenY=" + posY + ",top=" + posY +",menubar=0,status=0,resizable=" + resiz + ",scrollbars=" + scrollb);
    NewWindow.location.href = loc;
    if(sBrowVer == "Net3") NewWindow.focus();
    return NewWindow;
  }
  if(sBrowVer == "Net4") {
    NewWindow = window.open("", winname, "height=" + height + ",width=" + width + ",screenX=" + posX + ",left=" + posX + ",screenY=" + posY + ",top=" + posY +",menubar=0,status=0,resizable=" + resiz + ",scrollbars=" + scrollb + (modal ? ",modal=yes" : ""));
    NewWindow.location.href = loc;
    NewWindow.focus();
    return NewWindow;
  }
  if(sBrowVer == "IE3") {
    NewWindow = window.open("", winname, "height=" + height + ",width=" + width + ",screenX=" + posX + ",left=" + posX + ",screenY=" + posY + ",top=" + posY + ",dependent=1,directories=0,fullscreen=0,location=0,menubar=0,channelmode=0,resizable=" + resiz + ",scrollbars=" + scrollb + ",status=0,toolbar=0");
    if(NewWindow != null) {
      if(NewWindow.opener == null) NewWindow.opener = self;
      NewWindow.location.href = loc;
    }
    return NewWindow;
  }
  if(sBrowVer == "IE4") {
    NewWindow = window.open("", winname, "height=" + height + ",width=" + width + ",screenX=" + posX + ",left=" + posX + ",screenY=" + posY + ",top=" + posY + ",dependent=1,directories=0,fullscreen=0,location=0,menubar=0,channelmode=0,resizable=" + resiz + ",scrollbars=" + scrollb + ",status=1,toolbar=0");
    NewWindow.location.href = loc;
    NewWindow.focus();
    return NewWindow;
  }
  if(sBrowVer == null) {
    NewWindow = window.open("", winname, "height=" + height + ",width=" + width + ",screenX=" + posX + ",left=" + posX + ",screenY=" + posY + ",top=" + posY + ",dependent=1,directories=0,fullscreen=0,location=0,menubar=0,channelmode=0,resizable=" + resiz + ",scrollbars=" + scrollb + ",status=0,toolbar=0");
    NewWindow.location.href = loc;
    NewWindow.focus();
    return NewWindow;
  }
  return null;
}