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  
  checkPopup();
  //here I open the new window
  xpos = (screen.availWidth - wdth) / 2;
  ypos = (screen.availHeight - hgt) / 2;

  var tNE = (navigator.appName.indexOf("Netscape") != -1);
  var tIE = (navigator.appName.indexOf("Microsoft") != -1);

  if (tNE) {
    popupWindow = window.open(adr,'popup','height='+hgt+',width='+wdth+',screenX='+xpos+',screenY='+ypos+',scrollbars=yes');
  } else if (tIE) {
    popupWindow = window.open(adr,'popup','height='+hgt+',width='+wdth+',left='+xpos+',top='+ypos+',scrollbars=yes');
  }
}