function fadeOut(id, time) 
	{
	target = document.getElementById(id);
	alpha = 100;
	timer = (time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha <= 0)
					{
					clearInterval(i);
					document.getElementById('IdTool').style.top = "-40px";
					}
				setAlpha(target, alpha);
				alpha -= 2;
			}, timer);
	}

function fadeIn(id, time) 
	{
	target = document.getElementById(id);
	alpha = 0;
	timer = (time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha >= 100)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha += 2;
			}, timer);
	}

function setAlpha(target, alpha) 
	{
	target.style.filter = "alpha(opacity="+ alpha +")";
	target.style.opacity = alpha/100;
	}

var lastY, currentY;

function recordbeginvalues()
	{
	if (document.getElementById&&!document.all)
		{
		lastY=window.pageYOffset;
		}else{
		lastY=document.documentElement.scrollTop;
		}
	startPolling();
	}

function startPolling()
	{
	setInterval("poll()",100)
	}
	
function poll()
	{
	if (document.getElementById&&!document.all)
		{
		currentY=window.pageYOffset;
		}else{
		currentY=document.documentElement.scrollTop;
		}
		
	if ((currentY >= 300)&&(lastY < 300))
		{
		document.getElementById('IdTool').style.top = "0px";
		fadeIn('IdTool', 0.1);
		} else
	if ((currentY < 300)&&(lastY >= 300))
		{
		fadeOut('IdTool', 0.1);
		}
	
	lastY=currentY;
	}

setInterval("poll()",1000);
