running=0
timer=null
elementID="mytip"
moz=document.getElementById&&!document.all

function showTip(str){
	if(!document.getElementById(elementID)){
		tipElement = document.createElement('div')
		tipElement.setAttribute("id","mytip")
		tipElement.setAttribute((document.all?"className":"class"),"mytiprule")
		document.body.appendChild(tipElement)
	}

	tipDisplay=document.getElementById("mytip")

	tipDisplay.innerHTML=str
	opac=0
	opacStep=100/10

	running=1
	animate()
}

function showTipNoBorder(str){
	if(!document.getElementById(elementID)){
		tipElement = document.createElement('div')
		tipElement.setAttribute("id","mytip")
		tipElement.setAttribute((document.all?"className":"class"),"mytiprulenoborder")
		document.body.appendChild(tipElement)
	}

	tipDisplay=document.getElementById("mytip")

	tipDisplay.innerHTML=str
	opac=0
	opacStep=100/10

	running=1
	animate()
}

function animate(){

	opac+=opacStep
	timer=setTimeout("animate()",60)

	if(opac>100-opacStep){
		opac=100
		clearTimeout(timer)
	}

	if(!moz){tipDisplay.filters.alpha.opacity=opac}
	else{tipDisplay.style.MozOpacity=(opac/100)-0.01}
}

function fadeStop(){
	opac=0
	running=0
	clearTimeout(timer)
	tipDisplay.style.display="none"
}

function CurPos(e){
	cursorX=(!e?event.clientX:e.clientX)+document.body.scrollLeft
	cursorY=(!e?event.clientY:e.clientY)+document.body.scrollTop
	followMouse()
}

function followMouse(){
	if(running==0){return}

	if(cursorX>document.body.clientWidth-(tipDisplay.offsetWidth/2)){
		tipDisplay.style.left=cursorX-tipDisplay.offsetWidth
	}		
	else  if(cursorX<tipDisplay.offsetWidth/2){
		tipDisplay.style.left=cursorX
	}
	else{
		tipDisplay.style.left=cursorX-(tipDisplay.offsetWidth/2)
	}

	if(cursorY>document.body.clientHeight-tipDisplay.offsetHeight){
		tipDisplay.style.top=cursorY-tipDisplay.offsetHeight
	}
	else{
		tipDisplay.style.top=cursorY+20
	}

	tipDisplay.style.display="block"
}

document.onmousemove=CurPos
