function Clear(id)
{
  form = document.getElementById(id);

  elem = form.getElementsByTagName('input');

  for(var i=0;i<elem.length;i++)
  {
      if (elem[i].className == 'input')
        elem[i].value = '';
  }

  elem = form.getElementsByTagName('textarea');
  for(var i=0;i<elem.length;i++)
  {
      if (elem[i].className == 'textarea')
        elem[i].value = '';
  }
}

function popup(src)
{
  var default_left=window.screen.width / 2 - 20;
  var default_top=window.screen.height / 2 - 50;
  var window_params = 'width=30,height=10,scrollbars=no,resizable=no,help=no,status=yes,left=' + default_left + ',top=' + default_top;
  var myWin = open("", "", window_params);
  var HTMLtext = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head><body style='margin:0; padding:0;' onload='wResize();'>";
  HTMLtext += "<script>function wResize() { var oImg=document.images[0]; var width=oImg.width+6; var height=oImg.height+54; var left = Math.round(window.screen.width / 2 - width / 2); var top = Math.round(window.screen.height / 2 - height / 2); document.getElementById('hide').style.visibility='hidden'; window.moveTo(left, top); window.resizeTo(width, height); oImg.style.visibility='visible'; }</script>";
  HTMLtext += "<img id='img' src='" + src + "' onclick='window.close();' style='visibility:hidden;'><div id='hide' style='color:#FF0000; padding-left:5px;'>Загрузка...</div>";
  HTMLtext += "</body></html>";
  myWin.document.write(HTMLtext);
  myWin.document.close();
  return false;
}
function select(src, id)
{
  obj = document.getElementById(id);
  obj.src = src;
  return false;
}

function unselect(src, id)
{
  obj = document.getElementById(id);
  obj.src = '?node_id=' + src + '&original';
  obj.style.filter = 'none';
}

