var z;

function tst(x,x2,obj)   // x - конечное значение прозрачности, x2 - начальное
{
	var t,t2;
	this.appear = function() {
		var op = (obj.style.opacity)?parseFloat(obj.style.opacity):parseInt(obj.style.filter)/100;
		
		if(op < x) {
			clearTimeout(t2);
			op += 0.1; 
			obj.style.opacity = op;
			obj.style.filter='alpha(opacity='+op*100+')';
			t = setTimeout(arguments.callee,30);
		}
	}
	this.disappear = function() {
		var op = (obj.style.opacity)?parseFloat(obj.style.opacity):parseInt(obj.style.filter)/100;
		
		if(op > x2) {
			clearTimeout(t);
			op -= 0.05;
			obj.style.opacity = op;
			obj.style.filter='alpha(opacity='+op*100+')';
			t2 = setTimeout(arguments.callee,60);
		}
	}
}
    <!--
    
    $(function () {
	
        // find the div.fade elements and hook the hover event
        $('div.fade').hover(function() {
            // on hovering over find the element we want to fade *up*
            var fade = $('> div', this);
 
            // if the element is currently being animated (to fadeOut)...
            if (fade.is(':animated')) {
                // ...stop the current animation, and fade it to 1 from current position
                fade.stop().fadeTo(250, 1);
            } else {
                fade.fadeIn(250);
            }
        }, function () {
            var fade = $('> div', this);
            if (fade.is(':animated')) {
                fade.stop().fadeTo(950, 0);
            } else {
                fade.fadeOut(950);
            }
        });
    });
    
    //-->
