var tip = Class.create();
tip.prototype = {
    initialize: function (element, p) {
        this.p = p || {};
        if (element === null)
            return;
        this.element = $(element);
        this.toolTip = p.toolTip || 'dvTip';

        this.text = this.element.readAttribute('title');
        this.element.writeAttribute('title', '');
        this.className = p.className || '';
        this.factorV = p.factorV || 0;
        this.factorH = p.factorH || 0;
        this.isFixed = p.isFixed || false;
        this.defaultClass = p.defaultClass || 'tip-basic';
        Event.observe(this.element, "mouseover", this.show.bindAsEventListener(this));
        Event.observe(this.element, "mouseout", this.hide.bindAsEventListener(this));
    }, show: function () {
        if ($(this.toolTip) === null)
            return;
        $(this.toolTip).className = '';
        $(this.toolTip).addClassName(this.defaultClass).addClassName(this.className);
        $(this.toolTip).show();
        $(this.toolTip).innerHTML = this.text;
        setPos(this.element, $(this.toolTip), { h: this.p.h, v: this.p.v, factorV: this.factorV, factorH: this.factorH, isFixed: this.isFixed });
    }, hide: function (tip) {
        if ($(this.toolTip) === null)
            return;
        $(this.toolTip).hide();
    }
};
