function times(n,time,myfunc,myendfunc)
{
  var n2 = n;
  var time2=time;
  var myfunc2=myfunc;
  var myendfunc2=myendfunc;

  if (n2 > 0)
  {
    n2--;
    myfunc(n);
    setTimeout(function()
    {
      times(n2,time2,myfunc2,myendfunc2);
    },time);
  }
  else
  {
    myendfunc();
  }
}

function del_id(id)
{
  var tag = document.getElementById(id);

  if (tag)
  {
    tag.style.borderColor = 'black';
    tag.style.borderWidth = '1px';
    tag.style.borderStyle = 'solid';
    tag.style.background  = 'url(images/gone.gif)';
    tag.style.overflow    = 'hidden';

    var parent = tag.parentNode;
    if (parent) 
    {
      var height = tag.offsetHeight;
      var dheight = Math.floor((height + 10) / 20);

      // just one animation
      times(20,5,function(i){height -=dheight;if (height >=0)tag.style.height = height+'px';},function(){parent.removeChild(tag);});

      return true;
    }
  }
  return false;
}

