function hints() {
    this._el = null;
    this._target = null;
}

hints.prototype.show = function(_elem) {
    this._target = _elem;
    this._show();
}

hints.prototype.hide = function() {
    this._reset();
    this._hide();
}

hints.prototype._reset = function() {
    this._msg = null;
    this._target = null;
}

hints.prototype._create = function() {
    this._el = document.createElement('P');
    this._el.id = 'hints';
    this._el.style.position = 'absolute';
    this._el.style.display = 'none';
    document.body.appendChild(this._el);
}

hints.prototype._show = function() {
    if (this._el === null) {
        this._create();
    }
    
    this._el.innerHTML = this._setMsg();
    this._el.style.display = 'block';
    this._position();
}

hints.prototype._hide = function() {
    this._el.style.display = 'none';
}

hints.prototype._position = function() {
    this._el.style.left = this._posx() + 20 + 'px';
    this._el.style.top = this._posy() + 22 + 'px';
}

hints.prototype._setMsg = function() {
    var _col = this._target.parentNode.getElementsByTagName('INPUT');
    
    if (_col.length == 0) {
        _col = this._target.parentNode.getElementsByTagName('SELECT');
    }
    
    for (var i = 0; i <= _col.length; i++) {
        if (typeof _col[i] != 'undefined') {
            return _col[i].title;
        }
    }
}

hints.prototype._posx = function() {
	var _l = 0;
	
    var _obj = this._target;
    while (_obj.offsetParent) {
		_l += _obj.offsetLeft;
		_obj = _obj.offsetParent;
	}

	return _l;
}

hints.prototype._posy = function() {
	var _t = 0;
	
    var _obj = this._target;
    while (_obj.offsetParent) {
		_t += _obj.offsetTop;
		_obj = _obj.offsetParent;
	}
	
	return _t;
}


h = new hints();
