var config = new Object();


//===================  GLOBAL TOOPTIP CONFIGURATION  =========================//
var  toolDebug	= true		// false or true - recommended: false once you release your page to the public
var  toolEnabled	= true		// Allows to (temporarily) suppress tooltips, e.g. by providing the user with a button that sets this global variable to false
var  TagsToTip	= true		// false or true - if true, HTML elements to be converted to tooltips via TagToTip() are automatically hidden;
							// if false, you should hide those HTML elements yourself

// For each of the following config variables there exists a command, which is
// just the variablename in uppercase, to be passed to Tip() or TagToTip() to
// configure tooltips individually. Individual commands override global
// configuration. Order of commands is arbitrary.
// Example: onmouseover="Tip('Tooltip text', LEFT, true, BGCOLOR, '#FF9900', FADEIN, 400)"

config. Above			= true 	// false or true - tooltip above mousepointer
config. BgColor 		= '#ffd884' // Background colour (HTML colour value, in quotes)
config. BgImg			= ''		// Path to background image, none if empty string ''
config. BorderColor		= '#ffd884'
config. BorderStyle		= 'solid'	// Any permitted CSS value, but I recommend 'solid', 'dotted' or 'dashed'
config. BorderWidth		= 1
config. CenterMouse		= false 	// false or true - center the tip horizontally below (or above) the mousepointer
config. ClickClose		= false 	// false or true - close tooltip if the user clicks somewhere
config. ClickSticky		= false		// false or true - make tooltip sticky if user left-clicks on the hovered element while the tooltip is active
config. CloseBtn		= false 	// false or true - closebutton in titlebar
config. CloseBtnColors	= ['#990000', '#FFFFFF', '#DD3333', '#FFFFFF']	  // [Background, text, hovered background, hovered text] - use empty strings '' to inherit title colours
config. CloseBtnText	= '&nbsp;X&nbsp;'	// Close button text (may also be an image tag)
config. CopyContent		= true		// When converting a HTML element to a tooltip, copy only the element's content, rather than converting the element by its own
config. Delay			= 400		// Time span in ms until tooltip shows up
config. Duration		= 0 		// Time span in ms after which the tooltip disappears; 0 for infinite duration, < 0 for delay in ms _after_ the onmouseout until the tooltip disappears
config. FadeIn			= 400 		// Fade-in duration in ms, e.g. 400; 0 for no animation
config. FadeOut			= 0
config. FadeInterval	= 30		// Duration of each fade step in ms (recommended: 30) - shorter is smoother but causes more CPU-load
config. Fix				= null		// Fixated position - x- an y-oordinates in brackets, e.g. [210, 480], or null for no fixation
config. FollowMouse		= true		// false or true - tooltip follows the mouse
config. FontColor		= '#b83102'
config. FontFace		= 'ms sans serif,verdana'
config. FontSize		= '12px' 	// E.g. '9pt' or '12px' - unit is mandatory
config. FontWeight		= 'bold'	// 'normal' or 'bold';
config. Height			= 0 		// Tooltip height; 0 for automatic adaption to tooltip content, < 0 (e.g. -100) for a maximum for automatic adaption
config. JumpHorz		= false		// false or true - jump horizontally to other side of mouse if tooltip would extend past clientarea boundary
config. JumpVert		= true		// false or true - jump vertically		"
config. Left			= false 	// false or true - tooltip on the left of the mouse
config. OffsetX			= 10		// Horizontal offset of left-top corner from mousepointer
config. OffsetY			= -5		// Vertical offset 
config. Opacity			= 100		// Integer between 0 and 100 - opacity of tooltip in percent
config. Padding			= 5 		// Spacing between border and content
config. Shadow			= true 	// false or true
config. ShadowColor		= '#cc6600'
config. ShadowWidth		= 2
config. Sticky			= false 	// false or true - fixate tip, ie. don't follow the mouse and don't hide on mouseout
config. TextAlign		= 'left'	// 'left', 'right' or 'justify'
config. Title			= ''		// Default title text applied to all tips (no default title: empty string '')
config. TitleAlign		= 'left'	// 'left' or 'right' - text alignment inside the title bar
config. TitleBgColor	= ''		// If empty string '', BorderColor will be used
config. TitleFontColor	= '#FFFFFF'	// Color of title text - if '', BgColor (of tooltip body) will be used
config. TitleFontFace	= ''		// If '' use FontFace (boldified)
config. TitleFontSize	= ''		// If '' use FontSize
config. Width			= 0 		// Tooltip width; 0 for automatic adaption to tooltip content; < -1 (e.g. -240) for a maximum width for that automatic adaption;
									// -1: tooltip width confined to the width required for the titlebar
//=======  END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW  ==============//




//=====================  PUBLIC  =============================================//
function Tip()
{
	toolTip(arguments, null);
}
function TagToTip()
{
	var t2t = toolGetElt(arguments[0]);
	if(t2t)
		toolTip(arguments, t2t);
}
function UnTip()
{
	toolOpReHref();
	if(toolaV[DURATION] < 0)
		tooltDurt.Timer("toolHideInit()", -toolaV[DURATION], true);
	else if(!(toolaV[STICKY] && (tooliState & 0x2)))
		toolHideInit();
}

//==================  PUBLIC PLUGIN API	 =====================================//
// Extension eventhandlers currently supported:
// OnLoadConfig, OnCreateContentString, OnSubDivsCreated, OnShow, OnMoveBefore,
// OnMoveAfter, OnHideInit, OnHide, OnKill

var toolaElt = new Array(10), // Container DIV, outer title & body DIVs, inner title & body TDs, closebutton SPAN, shadow DIVs, and IFRAME to cover windowed elements in IE
toolaV = new Array(),	// Caches and enumerates config data for currently active tooltip
toolsContent,			// Inner tooltip text or HTML
toolscrlX = 0, toolscrlY = 0,
toolmusX, toolmusY,
toolover,
toolx, tooly, toolw, toolh; // Position, width and height of currently displayed tooltip

function toolExtension()
{
	toolExtCmdEnum();
	toolaExt[toolaExt.length] = this;
	return this;
}
function toolSetTipPos(x, y)
{
	var css = toolaElt[0].style;

	toolx = x;
	tooly = y;
	css.left = x + "px";
	css.top = y + "px";
	if(toolie56)
	{
		var ifrm = toolaElt[toolaElt.length - 1];
		if(ifrm)
		{
			ifrm.style.left = css.left;
			ifrm.style.top = css.top;
		}
	}
}
function toolHideInit()
{
	if(tooliState)
	{
		toolExtCallFncs(0, "HideInit");
		tooliState &= ~0x4;
		if(toolflagOpa && toolaV[FADEOUT])
		{
			tooltFade.EndTimer();
			if(toolopa)
			{
				var n = Math.round(toolaV[FADEOUT] / (toolaV[FADEINTERVAL] * (toolaV[OPACITY] / toolopa)));
				toolFade(toolopa, toolopa, 0, n);
				return;
			}
		}
		tooltHide.Timer("toolHide();", 1, false);
	}
}
function toolHide()
{
	if(tooldb && tooliState)
	{
		toolOpReHref();
		if(tooliState & 0x2)
		{
			toolaElt[0].style.visibility = "hidden";
			toolExtCallFncs(0, "Hide");
		}
		tooltShow.EndTimer();
		tooltHide.EndTimer();
		tooltDurt.EndTimer();
		tooltFade.EndTimer();
		if(!toolop && !toolie)
		{
			tooltWaitMov.EndTimer();
			toolbWait = false;
		}
		if(toolaV[CLICKCLOSE] || toolaV[CLICKSTICKY])
			toolRemEvtFnc(document, "mouseup", toolOnLClick);
		toolExtCallFncs(0, "Kill");
		// In case of a TagToTip tooltip, hide converted DOM node and
		// re-insert it into document
		if(toolt2t && !toolaV[COPYCONTENT])
		{
			toolt2t.style.display = "none";
			toolMovDomNode(toolt2t, toolaElt[6], toolt2tDad);
		}
		tooliState = 0;
		toolover = null;
		toolResetMainDiv();
		if(toolaElt[toolaElt.length - 1])
			toolaElt[toolaElt.length - 1].style.display = "none";
	}
}
function toolGetElt(id)
{
	return(document.getElementById ? document.getElementById(id)
			: document.all ? document.all[id]
			: null);
}
function toolGetDivW(el)
{
	return(el ? (el.offsetWidth || el.style.pixelWidth || 0) : 0);
}
function toolGetDivH(el)
{
	return(el ? (el.offsetHeight || el.style.pixelHeight || 0) : 0);
}
function toolGetScrollX()
{
	return(window.pageXOffset || (tooldb ? (tooldb.scrollLeft || 0) : 0));
}
function toolGetScrollY()
{
	return(window.pageYOffset || (tooldb ? (tooldb.scrollTop || 0) : 0));
}
function toolGetClientW()
{
	return(document.body && (typeof(document.body.clientWidth) != toolu) ? document.body.clientWidth
			: (typeof(window.innerWidth) != toolu) ? window.innerWidth
			: tooldb ? (tooldb.clientWidth || 0)
			: 0);
}
function toolGetClientH()
{
	// Exactly this order seems to yield correct values in all major browsers
	return(document.body && (typeof(document.body.clientHeight) != toolu) ? document.body.clientHeight
			: (typeof(window.innerHeight) != toolu) ? window.innerHeight
			: tooldb ? (tooldb.clientHeight || 0)
			: 0);
}
function toolGetEvtX(e)
{
	return (e ? ((typeof(e.pageX) != toolu) ? e.pageX : (e.clientX + toolscrlX)) : 0);
}
function toolGetEvtY(e)
{
	return (e ? ((typeof(e.pageY) != toolu) ? e.pageY : (e.clientY + toolscrlY)) : 0);
}
function toolAddEvtFnc(el, sEvt, PFnc)
{
	if(el)
	{
		if(el.addEventListener)
			el.addEventListener(sEvt, PFnc, false);
		else
			el.attachEvent("on" + sEvt, PFnc);
	}
}
function toolRemEvtFnc(el, sEvt, PFnc)
{
	if(el)
	{
		if(el.removeEventListener)
			el.removeEventListener(sEvt, PFnc, false);
		else
			el.detachEvent("on" + sEvt, PFnc);
	}
}

//======================  PRIVATE  ===========================================//
var toolaExt = new Array(),	// Array of extension objects

tooldb, toolop, toolie, toolie56, toolbBoxOld,	// Browser flags
toolbody,
toolovr_,				// HTML element the mouse is currently over
toolflagOpa, 			// Opacity support: 1=IE, 2=Khtml, 3=KHTML, 4=Moz, 5=W3C
toolmaxPosX, toolmaxPosY,
tooliState = 0,			// Tooltip active |= 1, shown |= 2, move with mouse |= 4
toolopa, 				// Currently applied opacity
toolbJmpVert, toolbJmpHorz,// Tip temporarily on other side of mouse
toolt2t, toolt2tDad,		// Tag converted to tip, and its parent element in the document
toolelDeHref,			// The tag from which we've removed the href attribute
// Timer
tooltShow = new Number(0), tooltHide = new Number(0), tooltDurt = new Number(0),
tooltFade = new Number(0), tooltWaitMov = new Number(0),
toolbWait = false,
toolu = "undefined";


function toolInit()
{
	toolMkCmdEnum();
	// Send old browsers instantly to hell
	if(!toolBrowser() || !toolMkMainDiv())
		return;
	toolIsW3cBox();
	toolOpaSupport();
	toolAddEvtFnc(window, "scroll", toolOnScrl);
	// IE doesn't fire onscroll event when switching to fullscreen;
	// fix suggested by Yoav Karpeles 14.2.2008
	toolAddEvtFnc(window, "resize", toolOnScrl);
	toolAddEvtFnc(document, "mousemove", toolMove);
	// In Debug mode we search for TagToTip() calls in order to notify
	// the user if they've forgotten to set the TagsToTip config flag
	if(TagsToTip || toolDebug)
		toolSetOnloadFnc();
	// Ensure the tip be hidden when the page unloads
	toolAddEvtFnc(window, "unload", toolHide);
}
// Creates command names by translating config variable names to upper case
function toolMkCmdEnum()
{
	var n = 0;
	for(var i in config)
		eval("window." + i.toString().toUpperCase() + " = " + n++);
	toolaV.length = n;
}
function toolBrowser()
{
	var n, nv, n6, w3c;

	n = navigator.userAgent.toLowerCase(),
	nv = navigator.appVersion;
	toolop = (document.defaultView && typeof(eval("w" + "indow" + "." + "o" + "p" + "er" + "a")) != toolu);
	toolie = n.indexOf("msie") != -1 && document.all && !toolop;
	if(toolie)
	{
		var ieOld = (!document.compatMode || document.compatMode == "BackCompat");
		tooldb = !ieOld ? document.documentElement : (document.body || null);
		if(tooldb)
			toolie56 = parseFloat(nv.substring(nv.indexOf("MSIE") + 5)) >= 5.5
					&& typeof document.body.style.maxHeight == toolu;
	}
	else
	{
		tooldb = document.documentElement || document.body ||
				(document.getElementsByTagName ? document.getElementsByTagName("body")[0]
				: null);
		if(!toolop)
		{
			n6 = document.defaultView && typeof document.defaultView.getComputedStyle != toolu;
			w3c = !n6 && document.getElementById;
		}
	}
	toolbody = (document.getElementsByTagName ? document.getElementsByTagName("body")[0]
				: (document.body || null));
	if(toolie || n6 || toolop || w3c)
	{
		if(toolbody && tooldb)
		{
			if(document.attachEvent || document.addEventListener)
				return true;
		}
		else
			toolErr("wz_tooltip.js must be included INSIDE the body section,"
					+ " immediately after the opening <body> tag.", false);
	}
	tooldb = null;
	return false;
}
function toolMkMainDiv()
{
	// Create the tooltip DIV
	if(toolbody.insertAdjacentHTML)
		toolbody.insertAdjacentHTML("afterBegin", toolMkMainDivHtm());
	else if(typeof toolbody.innerHTML != toolu && document.createElement && toolbody.appendChild)
		toolbody.appendChild(toolMkMainDivDom());
	if(window.toolGetMainDivRefs /* FireFox Alzheimer */ && toolGetMainDivRefs())
		return true;
	tooldb = null;
	return false;
}
function toolMkMainDivHtm()
{
	return('<div id="WzTtDiV"></div>' +
			(toolie56 ? ('<iframe id="WzTtIfRm" src="javascript:false" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:none;"></iframe>')
			: ''));
}
function toolMkMainDivDom()
{
	var el = document.createElement("div");
	if(el)
		el.id = "WzTtDiV";
	return el;
}
function toolGetMainDivRefs()
{
	toolaElt[0] = toolGetElt("WzTtDiV");
	if(toolie56 && toolaElt[0])
	{
		toolaElt[toolaElt.length - 1] = toolGetElt("WzTtIfRm");
		if(!toolaElt[toolaElt.length - 1])
			toolaElt[0] = null;
	}
	if(toolaElt[0])
	{
		var css = toolaElt[0].style;

		css.visibility = "hidden";
		css.position = "absolute";
		css.overflow = "hidden";
		return true;
	}
	return false;
}
function toolResetMainDiv()
{
	var w = (window.screen && screen.width) ? screen.width : 10000;

	toolSetTipPos(-w, 0);
	toolaElt[0].innerHTML = "";
	toolaElt[0].style.width = (w - 1) + "px";
	toolh = 0;
}
function toolIsW3cBox()
{
	var css = toolaElt[0].style;

	css.padding = "10px";
	css.width = "40px";
	toolbBoxOld = (toolGetDivW(toolaElt[0]) == 40);
	css.padding = "0px";
	toolResetMainDiv();
}
function toolOpaSupport()
{
	var css = toolbody.style;

	toolflagOpa = (typeof(css.filter) != toolu) ? 1
				: (typeof(css.KhtmlOpacity) != toolu) ? 2
				: (typeof(css.KHTMLOpacity) != toolu) ? 3
				: (typeof(css.MozOpacity) != toolu) ? 4
				: (typeof(css.opacity) != toolu) ? 5
				: 0;
}
// Ported from http://dean.edwards.name/weblog/2006/06/again/
// (Dean Edwards et al.)
function toolSetOnloadFnc()
{
	toolAddEvtFnc(document, "DOMContentLoaded", toolHideSrcTags);
	toolAddEvtFnc(window, "load", toolHideSrcTags);
	if(toolbody.attachEvent)
		toolbody.attachEvent("onreadystatechange",
			function() {
				if(toolbody.readyState == "complete")
					toolHideSrcTags();
			} );
	if(/WebKit|KHTML/i.test(navigator.userAgent))
	{
		var t = setInterval(function() {
					if(/loaded|complete/.test(document.readyState))
					{
						clearInterval(t);
						toolHideSrcTags();
					}
				}, 10);
	}
}
function toolHideSrcTags()
{
	if(!window.toolHideSrcTags || window.toolHideSrcTags.done)
		return;
	window.toolHideSrcTags.done = true;
	if(!toolHideSrcTagsRecurs(toolbody))
		toolErr("There are HTML elements to be converted to tooltips.\nIf you"
				+ " want these HTML elements to be automatically hidden, you"
				+ " must edit wz_tooltip.js, and set TagsToTip in the global"
				+ " tooltip configuration to true.", true);
}
function toolHideSrcTagsRecurs(dad)
{
	var ovr, asT2t;
	// Walk the DOM tree for tags that have an onmouseover or onclick attribute
	// containing a TagToTip('...') call.
	// (.childNodes first since .children is bugous in Safari)
	var a = dad.childNodes || dad.children || null;

	for(var i = a ? a.length : 0; i;)
	{--i;
		if(!toolHideSrcTagsRecurs(a[i]))
			return false;
		ovr = a[i].getAttribute ? (a[i].getAttribute("onmouseover") || a[i].getAttribute("onclick"))
				: (typeof a[i].onmouseover == "function") ? (a[i].onmouseover || a[i].onclick)
				: null;
		if(ovr)
		{
			asT2t = ovr.toString().match(/TagToTip\s*\(\s*'[^'.]+'\s*[\),]/);
			if(asT2t && asT2t.length)
			{
				if(!toolHideSrcTag(asT2t[0]))
					return false;
			}
		}
	}
	return true;
}
function toolHideSrcTag(sT2t)
{
	var id, el;

	// The ID passed to the found TagToTip() call identifies an HTML element
	// to be converted to a tooltip, so hide that element
	id = sT2t.replace(/.+'([^'.]+)'.+/, "$1");
	el = toolGetElt(id);
	if(el)
	{
		if(toolDebug && !TagsToTip)
			return false;
		else
			el.style.display = "none";
	}
	else
		toolErr("Invalid ID\n'" + id + "'\npassed to TagToTip()."
				+ " There exists no HTML element with that ID.", true);
	return true;
}
function toolTip(arg, t2t)
{
	if(!tooldb)
		return;
	if(tooliState)
		toolHide();
	if(!toolEnabled)
		return;
	toolt2t = t2t;
	if(!toolReadCmds(arg))
		return;
	tooliState = 0x1 | 0x4;
	toolAdaptConfig1();
	toolMkTipContent(arg);
	toolMkTipSubDivs();
	toolFormatTip();
	toolbJmpVert = false;
	toolbJmpHorz = false;
	toolmaxPosX = toolGetClientW() + toolscrlX - toolw - 1;
	toolmaxPosY = toolGetClientH() + toolscrlY - toolh - 1;
	toolAdaptConfig2();
	// Ensure the tip be shown and positioned before the first onmousemove
	toolOverInit();
	toolShowInit();
	toolMove();
}
function toolReadCmds(a)
{
	var i;

	// First load the global config values, to initialize also values
	// for which no command has been passed
	i = 0;
	for(var j in config)
		toolaV[i++] = config[j];
	// Then replace each cached config value for which a command has been
	// passed (ensure the # of command args plus value args be even)
	if(a.length & 1)
	{
		for(i = a.length - 1; i > 0; i -= 2)
			toolaV[a[i - 1]] = a[i];
		return true;
	}
	toolErr("Incorrect call of Tip() or TagToTip().\n"
			+ "Each command must be followed by a value.", true);
	return false;
}
function toolAdaptConfig1()
{
	toolExtCallFncs(0, "LoadConfig");
	// Inherit unspecified title formattings from body
	if(!toolaV[TITLEBGCOLOR].length)
		toolaV[TITLEBGCOLOR] = toolaV[BORDERCOLOR];
	if(!toolaV[TITLEFONTCOLOR].length)
		toolaV[TITLEFONTCOLOR] = toolaV[BGCOLOR];
	if(!toolaV[TITLEFONTFACE].length)
		toolaV[TITLEFONTFACE] = toolaV[FONTFACE];
	if(!toolaV[TITLEFONTSIZE].length)
		toolaV[TITLEFONTSIZE] = toolaV[FONTSIZE];
	if(toolaV[CLOSEBTN])
	{
		// Use title colours for non-specified closebutton colours
		if(!toolaV[CLOSEBTNCOLORS])
			toolaV[CLOSEBTNCOLORS] = new Array("", "", "", "");
		for(var i = 4; i;)
		{--i;
			if(!toolaV[CLOSEBTNCOLORS][i].length)
				toolaV[CLOSEBTNCOLORS][i] = (i & 1) ? toolaV[TITLEFONTCOLOR] : toolaV[TITLEBGCOLOR];
		}
		// Enforce titlebar be shown
		if(!toolaV[TITLE].length)
			toolaV[TITLE] = " ";
	}
	// Circumvents broken display of images and fade-in flicker in Geckos < 1.8
	if(toolaV[OPACITY] == 100 && typeof toolaElt[0].style.MozOpacity != toolu && !Array.every)
		toolaV[OPACITY] = 99;
	// Smartly shorten the delay for fade-in tooltips
	if(toolaV[FADEIN] && toolflagOpa && toolaV[DELAY] > 100)
		toolaV[DELAY] = Math.max(toolaV[DELAY] - toolaV[FADEIN], 100);
}
function toolAdaptConfig2()
{
	if(toolaV[CENTERMOUSE])
	{
		toolaV[OFFSETX] -= ((toolw - (toolaV[SHADOW] ? toolaV[SHADOWWIDTH] : 0)) >> 1);
		toolaV[JUMPHORZ] = false;
	}
}
// Expose content globally so extensions can modify it
function toolMkTipContent(a)
{
	if(toolt2t)
	{
		if(toolaV[COPYCONTENT])
			toolsContent = toolt2t.innerHTML;
		else
			toolsContent = "";
	}
	else
		toolsContent = a[0];
	toolExtCallFncs(0, "CreateContentString");
}
function toolMkTipSubDivs()
{
	var sCss = 'position:relative;margin:0px;padding:0px;border-width:0px;left:0px;top:0px;line-height:normal;width:auto;',
	sTbTrTd = ' cellspacing=0 cellpadding=0 border=0 style="' + sCss + '"><tbody style="' + sCss + '"><tr><td ';

	toolaElt[0].innerHTML =
		(''
		+ (toolaV[TITLE].length ?
			('<div id="WzTiTl" style="position:relative;z-index:1;">'
			+ '<table id="WzTiTlTb"' + sTbTrTd + 'id="WzTiTlI" style="' + sCss + '">'
			+ toolaV[TITLE]
			+ '</td>'
			+ (toolaV[CLOSEBTN] ?
				('<td align="right" style="' + sCss
				+ 'text-align:right;">'
				+ '<span id="WzClOsE" style="padding-left:2px;padding-right:2px;'
				+ 'cursor:' + (toolie ? 'hand' : 'pointer')
				+ ';" onmouseover="toolOnCloseBtnOver(1)" onmouseout="toolOnCloseBtnOver(0)" onclick="toolHideInit()">'
				+ toolaV[CLOSEBTNTEXT]
				+ '</span></td>')
				: '')
			+ '</tr></tbody></table></div>')
			: '')
		+ '<div id="WzBoDy" style="position:relative;z-index:0;">'
		+ '<table' + sTbTrTd + 'id="WzBoDyI" style="' + sCss + '">'
		+ toolsContent
		+ '</td></tr></tbody></table></div>'
		+ (toolaV[SHADOW]
			? ('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>'
				+ '<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>')
			: '')
		);
	toolGetSubDivRefs();
	// Convert DOM node to tip
	if(toolt2t && !toolaV[COPYCONTENT])
	{
		// Store the tag's parent element so we can restore that DOM branch
		// once the tooltip is hidden
		toolt2tDad = toolt2t.parentNode || toolt2t.parentElement || toolt2t.offsetParent || null;
		if(toolt2tDad)
		{
			toolMovDomNode(toolt2t, toolt2tDad, toolaElt[6]);
			toolt2t.style.display = "block";
		}
	}
	toolExtCallFncs(0, "SubDivsCreated");
}
function toolGetSubDivRefs()
{
	var aId = new Array("WzTiTl", "WzTiTlTb", "WzTiTlI", "WzClOsE", "WzBoDy", "WzBoDyI", "WzTtShDwB", "WzTtShDwR");

	for(var i = aId.length; i; --i)
		toolaElt[i] = toolGetElt(aId[i - 1]);
}
function toolFormatTip()
{
	var css, w, h, iOffY, iOffSh,
	iAdd = (toolaV[PADDING] + toolaV[BORDERWIDTH]) << 1;
	
	//--------- Title DIV ----------
	if(toolaV[TITLE].length)
	{
		css = toolaElt[1].style;
		css.background = toolaV[TITLEBGCOLOR];
		css.paddingTop = (toolaV[CLOSEBTN] ? 2 : 0) + "px";
		css.paddingBottom = "1px";
		css.paddingLeft = css.paddingRight = toolaV[PADDING] + "px";
		css = toolaElt[3].style;
		css.color = toolaV[TITLEFONTCOLOR];
		css.whiteSpace = "nowrap";
		css.fontFamily = toolaV[TITLEFONTFACE];
		css.fontSize = toolaV[TITLEFONTSIZE];
		css.fontWeight = "bold";
		css.textAlign = toolaV[TITLEALIGN];
		// Close button DIV
		if(toolaElt[4])
		{
			css.paddingRight = (toolaV[PADDING] << 1) + "px";
			css = toolaElt[4].style;
			css.background = toolaV[CLOSEBTNCOLORS][0];
			css.color = toolaV[CLOSEBTNCOLORS][1];
			css.fontFamily = toolaV[TITLEFONTFACE];
			css.fontSize = toolaV[TITLEFONTSIZE];
			css.fontWeight = "bold";
		}
		if(toolaV[WIDTH] > 0)
			toolw = toolaV[WIDTH];
		else
		{
			toolw = toolGetDivW(toolaElt[3]) + toolGetDivW(toolaElt[4]);
			// Some spacing between title DIV and closebutton
			if(toolaElt[4])
				toolw += toolaV[PADDING];
			// Restrict auto width to max width
			if(toolaV[WIDTH] < -1 && toolw > -toolaV[WIDTH])
				toolw = -toolaV[WIDTH];
		}
		// Ensure the top border of the body DIV be covered by the title DIV
		iOffY = -toolaV[BORDERWIDTH];
	}
	else
	{
		toolw = 0;
		iOffY = 0;
	}

	//-------- Body DIV ------------
	css = toolaElt[5].style;
	css.top = iOffY + "px";
	if(toolaV[BORDERWIDTH])
	{
		css.borderColor = toolaV[BORDERCOLOR];
		css.borderStyle = toolaV[BORDERSTYLE];
		css.borderWidth = toolaV[BORDERWIDTH] + "px";
	}
	if(toolaV[BGCOLOR].length)
		css.background = toolaV[BGCOLOR];
	if(toolaV[BGIMG].length)
		css.backgroundImage = "url(" + toolaV[BGIMG] + ")";
	css.padding = toolaV[PADDING] + "px";
	css.textAlign = toolaV[TEXTALIGN];
	if(toolaV[HEIGHT])
	{
		css.overflow = "auto";
		if(toolaV[HEIGHT] > 0)
			css.height = (toolaV[HEIGHT] + iAdd) + "px";
		else
			toolh = iAdd - toolaV[HEIGHT];
	}
	// TD inside body DIV
	css = toolaElt[6].style;
	css.color = toolaV[FONTCOLOR];
	css.fontFamily = toolaV[FONTFACE];
	css.fontSize = toolaV[FONTSIZE];
	css.fontWeight = toolaV[FONTWEIGHT];
	css.background = "";
	css.textAlign = toolaV[TEXTALIGN];
	if(toolaV[WIDTH] > 0)
		w = toolaV[WIDTH];
	// Width like title (if existent)
	else if(toolaV[WIDTH] == -1 && toolw)
		w = toolw;
	else
	{
		// Measure width of the body's inner TD, as some browsers would expand
		// the container and outer body DIV to 100%
		w = toolGetDivW(toolaElt[6]);
		// Restrict auto width to max width
		if(toolaV[WIDTH] < -1 && w > -toolaV[WIDTH])
			w = -toolaV[WIDTH];
	}
	if(w > toolw)
		toolw = w;
	toolw += iAdd;

	//--------- Shadow DIVs ------------
	if(toolaV[SHADOW])
	{
		toolw += toolaV[SHADOWWIDTH];
		iOffSh = Math.floor((toolaV[SHADOWWIDTH] * 4) / 3);
		// Bottom shadow
		css = toolaElt[7].style;
		css.top = iOffY + "px";
		css.left = iOffSh + "px";
		css.width = (toolw - iOffSh - toolaV[SHADOWWIDTH]) + "px";
		css.height = toolaV[SHADOWWIDTH] + "px";
		css.background = toolaV[SHADOWCOLOR];
		// Right shadow
		css = toolaElt[8].style;
		css.top = iOffSh + "px";
		css.left = (toolw - toolaV[SHADOWWIDTH]) + "px";
		css.width = toolaV[SHADOWWIDTH] + "px";
		css.background = toolaV[SHADOWCOLOR];
	}
	else
		iOffSh = 0;

	//-------- Container DIV -------
	toolSetTipOpa(toolaV[FADEIN] ? 0 : toolaV[OPACITY]);
	toolFixSize(iOffY, iOffSh);
}
// Fixate the size so it can't dynamically change while the tooltip is moving.
function toolFixSize(iOffY, iOffSh)
{
	var wIn, wOut, h, add, i;

	toolaElt[0].style.width = toolw + "px";
	toolaElt[0].style.pixelWidth = toolw;
	wOut = toolw - ((toolaV[SHADOW]) ? toolaV[SHADOWWIDTH] : 0);
	// Body
	wIn = wOut;
	if(!toolbBoxOld)
		wIn -= (toolaV[PADDING] + toolaV[BORDERWIDTH]) << 1;
	toolaElt[5].style.width = wIn + "px";
	// Title
	if(toolaElt[1])
	{
		wIn = wOut - (toolaV[PADDING] << 1);
		if(!toolbBoxOld)
			wOut = wIn;
		toolaElt[1].style.width = wOut + "px";
		toolaElt[2].style.width = wIn + "px";
	}
	// Max height specified
	if(toolh)
	{
		h = toolGetDivH(toolaElt[5]);
		if(h > toolh)
		{
			if(!toolbBoxOld)
				toolh -= (toolaV[PADDING] + toolaV[BORDERWIDTH]) << 1;
			toolaElt[5].style.height = toolh + "px";
		}
	}
	toolh = toolGetDivH(toolaElt[0]) + iOffY;
	// Right shadow
	if(toolaElt[8])
		toolaElt[8].style.height = (toolh - iOffSh) + "px";
	i = toolaElt.length - 1;
	if(toolaElt[i])
	{
		toolaElt[i].style.width = toolw + "px";
		toolaElt[i].style.height = toolh + "px";
	}
}
function toolDeAlt(el)
{
	var aKid;

	if(el)
	{
		if(el.alt)
			el.alt = "";
		if(el.title)
			el.title = "";
		aKid = el.childNodes || el.children || null;
		if(aKid)
		{
			for(var i = aKid.length; i;)
				toolDeAlt(aKid[--i]);
		}
	}
}
// This hack removes the native tooltips over links in Opera
function toolOpDeHref(el)
{
	if(!toolop)
		return;
	if(toolelDeHref)
		toolOpReHref();
	while(el)
	{
		if(el.hasAttribute("href"))
		{
			el.t_href = el.getAttribute("href");
			el.t_stats = window.status;
			el.removeAttribute("href");
			el.style.cursor = "hand";
			toolAddEvtFnc(el, "mousedown", toolOpReHref);
			window.status = el.t_href;
			toolelDeHref = el;
			break;
		}
		el = el.parentElement;
	}
}
function toolOpReHref()
{
	if(toolelDeHref)
	{
		toolelDeHref.setAttribute("href", toolelDeHref.t_href);
		toolRemEvtFnc(toolelDeHref, "mousedown", toolOpReHref);
		window.status = toolelDeHref.t_stats;
		toolelDeHref = null;
	}
}
function toolOverInit()
{
	if(window.event)
		toolover = window.event.target || window.event.srcElement;
	else
		toolover = toolovr_;
	toolDeAlt(toolover);
	toolOpDeHref(toolover);
}
function toolShowInit()
{
	tooltShow.Timer("toolShow()", toolaV[DELAY], true);
	if(toolaV[CLICKCLOSE] || toolaV[CLICKSTICKY])
		toolAddEvtFnc(document, "mouseup", toolOnLClick);
}
function toolShow()
{
	var css = toolaElt[0].style;

	// Override the z-index of the topmost wz_dragdrop.js D&D item
	css.zIndex = Math.max((window.dd && dd.z) ? (dd.z + 2) : 0, 1010);
	if(toolaV[STICKY] || !toolaV[FOLLOWMOUSE])
		tooliState &= ~0x4;
	if(toolaV[DURATION] > 0)
		tooltDurt.Timer("toolHideInit()", toolaV[DURATION], true);
	toolExtCallFncs(0, "Show")
	css.visibility = "visible";
	tooliState |= 0x2;
	if(toolaV[FADEIN])
		toolFade(0, 0, toolaV[OPACITY], Math.round(toolaV[FADEIN] / toolaV[FADEINTERVAL]));
	toolShowIfrm();
}
function toolShowIfrm()
{
	if(toolie56)
	{
		var ifrm = toolaElt[toolaElt.length - 1];
		if(ifrm)
		{
			var css = ifrm.style;
			css.zIndex = toolaElt[0].style.zIndex - 1;
			css.display = "block";
		}
	}
}
function toolMove(e)
{
	if(e)
		toolovr_ = e.target || e.srcElement;
	e = e || window.event;
	if(e)
	{
		toolmusX = toolGetEvtX(e);
		toolmusY = toolGetEvtY(e);
	}
	if(tooliState & 0x04)
	{
		// Prevent jam of mousemove events
		if(!toolop && !toolie)
		{
			if(toolbWait)
				return;
			toolbWait = true;
			tooltWaitMov.Timer("toolbWait = false;", 1, true);
		}
		if(toolaV[FIX])
		{
			var iY = toolaV[FIX][1];
			// For a fixed tip to be positioned above the mouse, use the
			// bottom edge as anchor
			// (recommended by Christophe Rebeschini, 31.1.2008)
			if(toolaV[ABOVE])
				iY -= toolh;
			tooliState &= ~0x4;
			toolSetTipPos(toolaV[FIX][0], toolaV[FIX][1]);
		}
		else if(!toolExtCallFncs(e, "MoveBefore"))
			toolSetTipPos(toolPos(0), toolPos(1));
		toolExtCallFncs([toolmusX, toolmusY], "MoveAfter")
	}
}
function toolPos(iDim)
{
	var iX, bJmpMode, cmdAlt, cmdOff, cx, iMax, iScrl, iMus, bJmp;

	// Map values according to dimension to calculate
	if(iDim)
	{
		bJmpMode = toolaV[JUMPVERT];
		cmdAlt = ABOVE;
		cmdOff = OFFSETY;
		cx = toolh;
		iMax = toolmaxPosY;
		iScrl = toolscrlY;
		iMus = toolmusY;
		bJmp = toolbJmpVert;
	}
	else
	{
		bJmpMode = toolaV[JUMPHORZ];
		cmdAlt = LEFT;
		cmdOff = OFFSETX;
		cx = toolw;
		iMax = toolmaxPosX;
		iScrl = toolscrlX;
		iMus = toolmusX;
		bJmp = toolbJmpHorz;
	}
	if(bJmpMode)
	{
		if(toolaV[cmdAlt] && (!bJmp || toolCalcPosAlt(iDim) >= iScrl + 16))
			iX = toolPosAlt(iDim);
		else if(!toolaV[cmdAlt] && bJmp && toolCalcPosDef(iDim) > iMax - 16)
			iX = toolPosAlt(iDim);
		else
			iX = toolPosDef(iDim);
	}
	else
	{
		iX = iMus;
		if(toolaV[cmdAlt])
			iX -= cx + toolaV[cmdOff] - (toolaV[SHADOW] ? toolaV[SHADOWWIDTH] : 0);
		else
			iX += toolaV[cmdOff];
	}
	// Prevent tip from extending past clientarea boundary
	if(iX > iMax)
		iX = bJmpMode ? toolPosAlt(iDim) : iMax;
	// In case of insufficient space on both sides, ensure the left/upper part
	// of the tip be visible
	if(iX < iScrl)
		iX = bJmpMode ? toolPosDef(iDim) : iScrl;
	return iX;
}
function toolPosDef(iDim)
{
	if(iDim)
		toolbJmpVert = toolaV[ABOVE];
	else
		toolbJmpHorz = toolaV[LEFT];
	return toolCalcPosDef(iDim);
}
function toolPosAlt(iDim)
{
	if(iDim)
		toolbJmpVert = !toolaV[ABOVE];
	else
		toolbJmpHorz = !toolaV[LEFT];
	return toolCalcPosAlt(iDim);
}
function toolCalcPosDef(iDim)
{
	return iDim ? (toolmusY + toolaV[OFFSETY]) : (toolmusX + toolaV[OFFSETX]);
}
function toolCalcPosAlt(iDim)
{
	var cmdOff = iDim ? OFFSETY : OFFSETX;
	var dx = toolaV[cmdOff] - (toolaV[SHADOW] ? toolaV[SHADOWWIDTH] : 0);
	if(toolaV[cmdOff] > 0 && dx <= 0)
		dx = 1;
	return((iDim ? (toolmusY - toolh) : (toolmusX - toolw)) - dx);
}
function toolFade(a, now, z, n)
{
	if(n)
	{
		now += Math.round((z - now) / n);
		if((z > a) ? (now >= z) : (now <= z))
			now = z;
		else
			tooltFade.Timer("toolFade("
							+ a + "," + now + "," + z + "," + (n - 1)
							+ ")",
							toolaV[FADEINTERVAL],
							true);
	}
	now ? toolSetTipOpa(now) : toolHide();
}
function toolSetTipOpa(opa)
{
	// To circumvent the opacity nesting flaws of IE, we set the opacity
	// for each sub-DIV separately, rather than for the container DIV.
	toolSetOpa(toolaElt[5], opa);
	if(toolaElt[1])
		toolSetOpa(toolaElt[1], opa);
	if(toolaV[SHADOW])
	{
		opa = Math.round(opa * 0.8);
		toolSetOpa(toolaElt[7], opa);
		toolSetOpa(toolaElt[8], opa);
	}
}
function toolOnScrl()
{
	toolscrlX = toolGetScrollX();
	toolscrlY = toolGetScrollY();
}
function toolOnCloseBtnOver(iOver)
{
	var css = toolaElt[4].style;

	iOver <<= 1;
	css.background = toolaV[CLOSEBTNCOLORS][iOver];
	css.color = toolaV[CLOSEBTNCOLORS][iOver + 1];
}
function toolOnLClick(e)
{
	//  Ignore right-clicks
	e = e || window.event;
	if(!((e.button && e.button & 2) || (e.which && e.which == 3)))
	{
		if(toolaV[CLICKSTICKY] && (tooliState & 0x4))
		{
			toolaV[STICKY] = true;
			tooliState &= ~0x4;
		}
		else if(toolaV[CLICKCLOSE])
			toolHideInit();
	}
}
function toolInt(x)
{
	var y;

	return(isNaN(y = parseInt(x)) ? 0 : y);
}
Number.prototype.Timer = function(s, iT, bUrge)
{
	if(!this.value || bUrge)
		this.value = window.setTimeout(s, iT);
}
Number.prototype.EndTimer = function()
{
	if(this.value)
	{
		window.clearTimeout(this.value);
		this.value = 0;
	}
}
function toolSetOpa(el, opa)
{
	var css = el.style;

	toolopa = opa;
	if(toolflagOpa == 1)
	{
		if(opa < 100)
		{
			// Hacks for bugs of IE:
			// 1.) Once a CSS filter has been applied, fonts are no longer
			// anti-aliased, so we store the previous 'non-filter' to be
			// able to restore it
			if(typeof(el.filtNo) == toolu)
				el.filtNo = css.filter;
			// 2.) A DIV cannot be made visible in a single step if an
			// opacity < 100 has been applied while the DIV was hidden
			var bVis = css.visibility != "hidden";
			// 3.) In IE6, applying an opacity < 100 has no effect if the
			//	   element has no layout (position, size, zoom, ...)
			css.zoom = "100%";
			if(!bVis)
				css.visibility = "visible";
			css.filter = "alpha(opacity=" + opa + ")";
			if(!bVis)
				css.visibility = "hidden";
		}
		else if(typeof(el.filtNo) != toolu)
			// Restore 'non-filter'
			css.filter = el.filtNo;
	}
	else
	{
		opa /= 100.0;
		switch(toolflagOpa)
		{
		case 2:
			css.KhtmlOpacity = opa; break;
		case 3:
			css.KHTMLOpacity = opa; break;
		case 4:
			css.MozOpacity = opa; break;
		case 5:
			css.opacity = opa; break;
		}
	}
}
function toolMovDomNode(el, dadFrom, dadTo)
{
	if(dadFrom)
		dadFrom.removeChild(el);
	if(dadTo)
		dadTo.appendChild(el);
}
function toolErr(sErr, bIfDebug)
{
	if(toolDebug || !bIfDebug)
		alert("Tooltip Script Error Message:\n\n" + sErr);
}

//============  EXTENSION (PLUGIN) MANAGER  ===============//
function toolExtCmdEnum()
{
	var s;

	// Add new command(s) to the commands enum
	for(var i in config)
	{
		s = "window." + i.toString().toUpperCase();
		if(eval("typeof(" + s + ") == toolu"))
		{
			eval(s + " = " + toolaV.length);
			toolaV[toolaV.length] = null;
		}
	}
}
function toolExtCallFncs(arg, sFnc)
{
	var b = false;
	for(var i = toolaExt.length; i;)
	{--i;
		var fnc = toolaExt[i]["On" + sFnc];
		// Call the method the extension has defined for this event
		if(fnc && fnc(arg))
			b = true;
	}
	return b;
}

toolInit();