var show_i = 0;
function show(i)
{
  if (show_i && (show_i != i)) hide(show_i);
  if (document.getElementById('menu' + i).className != 'act') document.getElementById('menu' + i).className = 'over';
  if (document.getElementById('dropmenu' + i)) document.getElementById('dropmenu' + i).style.display = '';
  if (window.tm) window.clearTimeout(window.tm);
  //window.tm = window.setTimeout('hide('+i+')', 1000);
  show_i = i;
}
function hide_tm(i)
{
  if (window.tm) window.clearTimeout(window.tm);
  window.tm = window.setTimeout('hide('+i+')', 100);
}
function hide(i)
{
  if (document.getElementById('menu' + i).className != 'act') document.getElementById('menu' + i).className = '';
  if (document.getElementById('dropmenu' + i)) document.getElementById('dropmenu' + i).style.display = 'none';
}
function checkForm(frm, arr)
{
  el = null;
  err = '';
  for(i in arr)
  {
    switch(frm.elements[i].type)
    {
      case 'text':
      case 'password':
      case 'textarea':
        if (frm.elements[i].value == '')
        {
          if (!el) el = frm.elements[i];
          err += arr[i] + "\n";
        }
    	break;
      case 'select-one':
        if (frm.elements[i].selectedIndex == 0)
        {
          if (!el) el = frm.elements[i];
          err += arr[i] + "\n";
        }
    	break;
    }
  }
  if (err == '') return true;
  else
  {
    el.focus();
    alert("Будьласка заповніть обов'язкові поля:\n-----------------------------------\n" + err + "-----------------------------------");
    return false;
  }
}
