var newWindow1;
var printWindow1;
var pcWin;
var pcWinPop;
var csCalendar;

function popContentWin(strUrl, contentName, categoryName, width, height) {
  if (newWindow1 && !newWindow1.closed) { newWindow1.close(); }
  if (pcWin && !pcWin.closed) { pcWin.close(); }
  if (pcWinPop && !pcWinPop.closed) { pcWinPop.close(); }
  if (csCalendar && !csCalendar.closed) { csCalendar.close(); }

  if (width == null) width = 390;
  if (height == null) height = 340;
  var url = strUrl;
  var attrs = 'width=' + width +',height=' + height + ',status=no,directories=no,toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,top=200,left=200';

  pcWin = window.open(url ,"pcWin",attrs);
  pcWin.focus();
}

function popWin(strUrl,width, height) {
  popContentWin(strUrl, '', '', width, height);
}

function openPopup(strUrl, width, height) {
  if (newWindow1 && !newWindow1.closed) { newWindow1.close(); }
  if (pcWin && !pcWin.closed) { pcWin.close(); }
  if (pcWinPop && !pcWinPop.closed) { pcWinPop.close(); }
  if (csCalendar && !csCalendar.closed) { csCalendar.close(); }

  if (width == null) width = 800;
  if (height == null) height = 600;
  var popUrl = strUrl;
  var popAttrs = 'width=' + width +',height=' + height + ',status=yes,directories=yes,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,resizable=yes,top=100,left=100';

  pcWinPop = window.open(popUrl ,"pcWinPop",popAttrs);
  pcWinPop.focus();
}

function openNewWindow(destination, comboBoxName, accountRights, action, param, comboFormName, accountListName){
  if (newWindow1 && !newWindow1.closed) { newWindow1.close(); }
  if (pcWin && !pcWin.closed) { pcWin.close(); }
  if (pcWinPop && !pcWinPop.closed) { pcWinPop.close(); }
  if (csCalendar && !csCalendar.closed) { csCalendar.close(); }
  
  var hasParameters = new RegExp("\\?")  
  if (!hasParameters.test(destination))
    destination = destination + "?" ;
  else
   destination = destination + "&" ;
  
  var url = destination + "accountRights=" + accountRights + ( (typeof comboFormName == "undefined") ? "" : ("&comboFormName=" + comboFormName) ) + "&comboBoxName=" + comboBoxName + "&action=" + action + ( (typeof accountListName == "undefined") ? "" : ("&accountListName=" + accountListName) );
  var wParam = 'resizable=yes,status=no,toolbar=no,scrollbars=yes,width=700,height=350,top=100,left=100';

  newWindow1 = window.open(url, "IHBWindow1", wParam );
  newWindow1.focus();
}

