﻿var tooltipwhite = function() {
    var id = 'ttwhite';
    var top = 3;
    var left = 3;
    var maxw = 500;
    var speed = 100;
    var timer = 0;
    var endalpha = 95;
    var alpha = 0;
    var ttwhite, t, c, b, h;
    var ie = document.all ? true : false;
    return {
        show: function(v, w) {
            if (ttwhite == null) {
                ttwhite = document.createElement('div');
                ttwhite.setAttribute('id', id);
                t = document.createElement('div');
                t.setAttribute('id', id + 'top');
                c = document.createElement('div');
                c.setAttribute('id', id + 'cont');
                b = document.createElement('div');
                b.setAttribute('id', id + 'bot');
                ttwhite.appendChild(t);
                ttwhite.appendChild(c);
                ttwhite.appendChild(b);
                document.body.appendChild(ttwhite);
                ttwhite.style.opacity = 0;
                ttwhite.style.filter = 'alpha(opacity=0)';
                document.onmousemove = this.pos;
            }
            ttwhite.style.display = 'block';
            c.innerHTML = v;
            ttwhite.style.width = w ? w + 'px' : 'auto';
            if (!w && ie) {
                t.style.display = 'none';
                b.style.display = 'none';
                ttwhite.style.width = ttwhite.offsetWidth;
                t.style.display = 'block';
                b.style.display = 'block';
            }
            if (ttwhite.offsetWidth > maxw) { ttwhite.style.width = maxw + 'px' }
            h = parseInt(ttwhite.offsetHeight) + top;
            clearInterval(ttwhite.timer);
            ttwhite.timer = setInterval(function() { tooltipwhite.fade(1) }, timer);
        },
        pos: function(e) {
            var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
            var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
            ttwhite.style.top = (u - h) + 'px';
            ttwhite.style.left = (l + left) + 'px';
        },
        fade: function(d) {
            var a = alpha;
            if ((a != endalpha && d == 1) || (a != 0 && d == -1)) {
                var i = speed;
                if (endalpha - a < speed && d == 1) {
                    i = endalpha - a;
                } else if (alpha < speed && d == -1) {
                    i = a;
                }
                alpha = a + (i * d);
                ttwhite.style.opacity = alpha * .01;
                ttwhite.style.filter = 'alpha(opacity=' + alpha + ')';
            } else {
                clearInterval(ttwhite.timer);
                if (d == -1) { ttwhite.style.display = 'none' }
            }
        },
        hide: function() {
            clearInterval(ttwhite.timer);
            ttwhite.timer = setInterval(function() { tooltipwhite.fade(-1) }, timer);
        }
    };
} ();

function tooltip_white2_over(divName) {
	var divId = document.getElementById(divName);
	divId.style.display  = "block";
	divId.style.zIndex  = 100;
}
function tooltip_white2_out(divName) {
	var divId = document.getElementById(divName);
	divId.style.display  = "none";
	divId.style.zIndex  = 0;
}