//ToolTip.js version 1.2
var ToolTip_set = new Array;
var ToolTip_arr = new Array;
var ToolTip_fading = true;
var defaultToolTip = null;
var ToolTip_maxIndex = 100;
var ToolTip_showWait = 800;
var ToolTip_hideWait = 1000000;
var current_ToolTip = null;
var ToolTip_showBelow = true;
function setToolTipDelay(ms)
{
	ToolTip_showWait = ms;
}
function setToolTipDisplay(ms)
{
	ToolTip_hideWait = ms;
}
function ToolTip(text,id)
{
	this.text = text;
	if (id)
	{
		ToolTip_set[id] = this;
		ToolTip_arr[ToolTip_arr.length] = this;
		this.id = id;
	}else
	{
		if (defaultToolTip != null)
			defaultToolTip.hide();
		defaultToolTip = this;
		this.id = null;
	}
}
function ToolTip_setText(text)
{
	this.text = text;
	if (this.div!=null)
		this.div.innerHTML = text;
}
function ToolTip_getText()
{
	return this.div.innerHTML;
}
function ToolTip_show()
{
	if (document.readyState != "complete")
		return;
	if (this.div == null)
	{
		this.div = document.createElement("div");
		this.div.innerHTML = this.text;
		this.div.style.position = "absolute";
		this.div.style.backgroundColor = "#ffffdd";
		this.div.style.color = "#000000";
		this.div.style.fontSize = "8pt";
		this.div.style.fontFamily = "Arial";
		this.div.style.borderTop = "solid 1px #aaaa00";
		this.div.style.borderLeft = "solid 1px #aaaa00";
		this.div.style.borderBottom = "outset 1px #aaaa00";
		this.div.style.borderRight = "outset 1px #aaaa00";
		this.div.style.display = "none";
		this.div.style.width = "";
		this.div.style.height = "";
		this.div.style.paddingLeft = "2px";
		this.div.style.paddingRight = "2px";
		this.div.style.clear = "right";
		document.body.appendChild(this.div);
		this.opacity = 0;
		this.div.onmousedown = hideByRef;
	}
	if (this.timer)
		clearTimeout(this.timer);
	this.timer = null;
	this.div.style.zIndex = ++ToolTip_maxIndex;
	if (current_ToolTip != null && current_ToolTip!=this)
		current_ToolTip.hide();
	current_ToolTip = this;
	positionCurrentToolTip();
	this.timer = setTimeout("getToolTipById('"+this.id+"').doShow()",ToolTip_showWait);
}
function Point(x,y)
{
	this.x = x;
	this.y = y;
}
function ToolTip_doShow()
{
	if (ToolTip_fading)
	{
		if (this.opacity<=100)
		{
			this.div.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+this.opacity+")";
			this.div.style.display = "inline";
			this.move();
			this.opacity+=10;
			this.timer = setTimeout("getToolTipById('"+this.id+"').doShow()",1);
			return;
		}
	}else
	{
		this.div.style.display = "inline";
		this.move();
	}
	if (this.id == null)
		this.timer = setTimeout("getToolTipById(null).hide()",ToolTip_hideWait);
	else
	{
		if (this.displayWait != null)
		{
			if (this.displayWait>0)
				this.timer = setTimeout("getToolTipById('"+this.id+"').hide()",ToolTip_hideWait);
		}
		else
			this.timer = setTimeout("getToolTipById('"+this.id+"').hide()",ToolTip_hideWait);
	}
	try{
		showHideSelects(this.div);//this function is implemented in file 'SelectDetect.js'
	}catch (showHideSelectsNotImported){}
}
function ToolTip_move()
{
	if (this.position==null)
		return;
	if (ToolTip_showBelow)
		this.div.style.top = this.position.y+18;
	else
		this.div.style.top = this.position.y-(this.div.offsetHeight+5);
		
	
	var onleft = (this.position.x>(3*document.body.offsetWidth/4));
	this.div.style.left = this.position.x -((onleft)?this.div.offsetWidth:0);
}
function ToolTip_hide()
{
	if (event && event.toElement == this.div)
	{
		return;
	}	
	if (current_ToolTip == this)
		current_ToolTip = null;
	if (this.div == null)
		return;
	if (this.timer)
		clearTimeout(this.timer);
	this.timer = null;
	this.div.style.display = "none";
	this.opacity = 0;
	this.position = null;
	try{
		showHideSelects(this.div);//this function is implemented in file 'SelectDetect.js'
	}catch (showHideSelectsNotImported){}
	if (this.id == null)
	{
		document.body.removeChild(this.div);
		defaultToolTip = null;
	}
}
function getToolTipById(id)
{
	var tt = ToolTip_set[id];
	if (tt!=null)
		return tt;
	if (defaultToolTip==null)
		defaultToolTip = new ToolTip("[tool tip]",id);
	return defaultToolTip;
}
function getToolTipByRef(div)
{
	if (defaultToolTip!=null)
		if (defaultToolTip.div == div)
			return defaultToolTip;
	for (var i=0;i<ToolTip_arr.length;i++)
	{
		if (ToolTip_arr[i].div == div)
			return ToolTip_arr[i];
	}
	return getToolTipByRef(div.parentElement);
}
function hideDefault()
{
	if (defaultToolTip!=null)
		defaultToolTip.hide();
}
function setEnableToolTipFading(bool)
{
	ToolTip_fading = bool;
}
function hideByRef()
{
	var div = event.srcElement;
	var tt = getToolTipByRef(div);
	tt.hide();
}
ToolTip.prototype.show = ToolTip_show;
ToolTip.prototype.doShow = ToolTip_doShow;
ToolTip.prototype.hide = ToolTip_hide;
ToolTip.prototype.move = ToolTip_move;
ToolTip.prototype.setText = ToolTip_setText;
ToolTip.prototype.getText = ToolTip_getText;
if (navigator.appName.indexOf("IE ")>-1)
{
	ToolTip_fading = false;
}
function positionCurrentToolTip()
{
	if (current_ToolTip == null)
		return;
	current_ToolTip.position = new Point(document.body.scrollLeft+event.clientX,document.body.scrollTop+event.clientY);
	current_ToolTip.move();
}
document.body.onmousemove = positionCurrentToolTip;

function hideTT()
{
	var t = event.srcElement.getAttribute("tooltip");
	if (t)
		getToolTipById(t).hide();
}
function showTT()
{
	var t = event.srcElement.getAttribute("tooltip");
	if (t)
		getToolTipById(t).show();
}