function fillSelectElement(id, list) {
  el = document.getElementById(id)
  emptySelectElement(id)
  for (i=0; i<list.length; i++)
    el.options[i]=new Option(list[i], list[i])
}

function emptySelectElement(id) {
  el = document.getElementById(id)
  for(i = 0; i < el.options.length; i++)
    el.options[i] = null;
  el.options.length=0
}

function multyFillSelectElement(parentId, id, list) {
  el = document.getElementById(id)
  pel = document.getElementById(parentId)
  ind = 0
  ind = pel.selectedIndex
  emptySelectElement(id)
  if (ind != -1)
    for (i=0; i<list[ind].length; i++)
      el.options[i]=new Option(list[ind][i], list[ind][i])
}

function advWindow(url) {
   var width = 600;
   var height = 540;
   var name = url;
   name = name.replace(/\//g, '');
   name = name.replace(/-/g, '');
   name = name.replace(/\./g, '');
   name = name.replace(/\?/g, '');
   name = name.replace(/=/g, '');
   var left = Math.floor((screen.width / 2) - (width / 2));
   var top = Math.floor((screen.height / 2) - (height / 2) );
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   winParms += ",status=no,toolbar=no,menubar=no,location=no,scrollbars=yes";
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;
}

