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 OpenPopup(url, name, width, height) {
	var rnd = (Math.round((Math.random()*999)+1));
        var top=Math.round((screen.height-height)/2);
        var left=Math.round((screen.width-width)/2);
        this.open(url, name, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no,toolbar=no");
}

