/*
 *	By jc@vitalyn.com
 *	V1.0 : 04-06-2006
 *	Usage: var helper = new Helper('title', 'Message'[, 1000]);
 *	Thinks to create CSS styles #div_helper_container and #div_helper_content
 */
function Helper()
{
  this.helper_t = null;
  this.helper_timeout = 5000;
  this.helper_container = null;
  this.helper_content = null;

  this.show = function(title, msg, timeout) {
    if (this.helper_t) {
      window.clearTimeout(this.helper_t);
      this.helper_t = null;
    }
    this.destroy(this);
    
    if (timeout) {
      this.helper_timeout = timeout;
    };

    this.helper_container = document.createElement('div');
    this.helper_container.setAttribute('id', 'div_helper_container');
    this.helper_container.innerHTML = title;
    
    document.getElementsByTagName('body').item(0).appendChild(this.helper_container);

    this.helper_content = document.createElement('div');
    this.helper_content.setAttribute('id', 'div_helper_content');
    this.helper_content.innerHTML = msg;

    this.helper_container.appendChild(this.helper_content);
    this.helper_t = window.setTimeout(this.destroy, this.helper_timeout, this);
  };
  
  this.destroy = function(h) {
    var e = document.getElementById('div_helper_content');
    if (e) {
      e.parentNode.removeChild(e);
    }
    var e = document.getElementById('div_helper_container');
    if (e) {
      e.parentNode.removeChild(e);
    }
  };
}
var Helper = new Helper();

