// Copyright (C) 2005-2008 Ilya S. Lyubinskiy. All rights reserved.
// Technical support: http://www.php-development.ru/
//
// YOU MAY NOT
// (1) Remove or modify this copyright notice.
// (2) Re-distribute this code or any part of it.
//     Instead, you may link to the homepage of this code:
//     http://www.php-development.ru/javascripts/dropdown.php
//
// YOU MAY
// (1) Use this code on your website.
// (2) Use this code as part of another product.
//
// NO WARRANTY
// This code is provided "as is" without warranty of any kind.
// You expressly acknowledge and agree that use of this code is at your own risk.


// ***** Loader Control *********************************************************

// ***** loader_show_aux *****

function loader_show_aux(attach)
{
  var p = attach.parent;
  var c = attach.child;

  c.style.position   = "absolute";
  c.style.top        = p.style.top;
  c.style.left       = p.style.left;
  c.style.height     = p.offsetHeight;
  c.style.width      = p.offsetWidth;
  c.style.visibility = "visible";
  c.style.display    = "block";
  c.style.zIndex     = "1000";
}

// ***** loader_show *****

function loader_show(attach)
{
  loader_show_aux(attach);
  clearTimeout(attach.child["loader_timeout"]);
}

// ***** loader_hide *****

function loader_hide(attach)
{
  attach.child["loader_timeout"] = setTimeout("hideControl('"+attach.child.id+"')", 333);
}

function hideControl(p)
{
    cntl = document.getElementById(p);
    cntl.style.visibility  = 'hidden';
    cntl.style.display     = 'none';
}

// ***** loader_attach *****

// PARAMETERS:
// parent   - id of the parent html element
// child    - id of the child  html element that should be droped down

function loader_attach(p, c)
{
  this.parent = document.getElementById(p);
  this.child = document.getElementById(c);
}
