var popupWindow = null;

function checkPopup(){
  //Close new window    
  if (popupWindow != null) {
    if (!popupWindow.closed) {
      popupWindow.close();     
    }      
  } 
}

function popup(adr,wdth, hgt){
  //I first have to pull the parameters from the content to the menu
  winName = adr.substring(0,adr.indexOf("."));
  checkPopup();
  //here I open the new window
  xpos = (screen.availWidth - wdth) / 2;
  ypos = (screen.availHeight - hgt) / 2;

  var NE = (navigator.appName.indexOf("Netscape") != -1);
  var IE = (navigator.appName.indexOf("Microsoft") != -1);
  if (NE) {
    popupWindow = window.open(adr,winName,'height='+hgt+',width='+wdth+',screenX='+xpos+',screenY='+ypos+',scrollbars=yes');
  } else if (IE) {
    popupWindow = window.open(adr,winName,'height='+hgt+',width='+wdth+',left='+xpos+',top='+ypos+',scrollbars=yes');
  }
}
