var IE = document.all?true:false
		
var posX = 0;
var posY = 0;

var currTtp;
var showTtp=false;


if (!IE) document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove = getMouseXY;
	
function getMouseXY(e)
{
	if (IE) 
	{ 		
	posX = event.clientX + document.documentElement.scrollLeft
	posY = event.clientY + document.documentElement.scrollTop
	} 
	else 
	{ 
	posX = e.pageX
	posY = e.pageY
	}  
	
	if (posX < 0){posX = 0}
	if (posY < 0){posY = 0} 				
	
	
	
	if(showTtp)
	{				
			currTtp.style.left=(posX)+"px";
			currTtp.style.top=(posY+22)+"px";
			
			
	}
	
	
	return true
}




function createToolTip(divid)
{
	currTtp=document.getElementById(divid);
	
	//currTtp.style.display="none";
	currTtp.style.position='absolute';
}



function showBox(str)
{		
	showTtp=true;	
	str=str.replace('%nl%','<br/>');
	str=str.replace('%nl%','<br/>');	
	
	
	currTtp.innerHTML=str;		
	ttpfadeIn(currTtp.id,50);
	//currTtp.style.display="none";
}

function hideBox()
{
	showTtp=false;
	ttpfadeOut(currTtp.id,10);	
	//currTtp.style.display="none";
}



function ttpfadeOut(thisId,speed) 
{
 
	var obj = document.getElementById(thisId);
    //obj.style.zoom = 1; //needed for IE
    speed = speed/20;
    var i = 100;
    var intervalId = setInterval(function() {
		if(showTtp)	clearInterval(intervalId);										  
										  
        if(i>=0) 
		{
			obj.style.opacity = (i / 100);
			obj.style.MozOpacity = (i / 100);
			obj.styleKhtmlOpacity = (i / 100);
			obj.style.filter = "alpha(opacity=" + i + ")";			
			
			//document.getElementById('info').innerHTML=i;
            i -= 5;						
        } 
		else 
		{
            setTimeout(function() {obj.style.display = "none";}, speed);
            clearInterval(intervalId);			
            return false;
        }
    }, speed);
}

function ttpfadeIn(thisId,speed) 
{	

    var obj = document.getElementById(thisId);
    obj.style.display = "block";
    //obj.style.zoom = 1; //needed for IE
    obj.style.opacity = 0;
    obj.style.filter = "alpha(opacity = 0)";
    speed = speed/20;
    var i = 0;
    var intervalId = setInterval(function() 
	{
        if(i <= 100) 
		{
			obj.style.opacity = (i / 100);
			obj.style.MozOpacity = (i / 100);
			obj.styleKhtmlOpacity = (i / 100);
			obj.style.filter = "alpha(opacity=" + i + ")";
			//document.getElementById('info').innerHTML=i;
            i += 5;
        } 
		else {
			//setTimeout(function() {obj.style.display = "block";}, speed);
            clearInterval(intervalId);						
            return false;
        }
    }, speed);
}
