/* This notice must be untouched at all times.

wz_tooltip.js	 v. 4.12

The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de

Copyright (c) 2002-2007 Walter Zorn. All rights reserved.
Created 1.12.2002 by Walter Zorn (Web: http://www.walterzorn.com )
Last modified: 13.7.2007

Easy-to-use cross-browser tooltips.
Just include the script at the beginning of the <body> section, and invoke
Tip('Tooltip text') from within the desired HTML onmouseover eventhandlers.
No container DIV, no onmouseouts required.
By default, width of tooltips is automatically adapted to content.
Is even capable of dynamically converting arbitrary HTML elements to tooltips
by calling TagToTip('ID_of_HTML_element_to_be_converted') instead of Tip(),
which means you can put important, search-engine-relevant stuff into tooltips.
Appearance of tooltips can be individually con2figured
via commands passed to Tip() or TagToTip().

Tab Width: 4
LICENSE: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

For more details on the GNU Lesser General Public License,
see http://www.gnu.org/copyleft/lesser.html
*/

var con2fig = new Object();


//===================  GLOBAL TOOPTIP con2figURATION  =========================//
var  t2t_Debug	= true		// false or true - recommended: false once you release your page to the public
var  t2t_Enabled	= 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, the script is capable of converting HTML elements to tooltips

// For each of the following con2fig variables there exists a command, which is
// just the variablename in uppercase, to be passed to Tip() or TagToTip() to
// con2figure tooltips individually. Individual commands override global
// con2figuration. Order of commands is arbitrary.
// Example: onmouseover="Tip('Tooltip text', LEFT, true, BGCOLOR, '#FF9900', FADEIN, 400)"

con2fig. Above		= false 	// false or true - tooltip above mousepointer?
con2fig. BgColor 		= '#FFFFFF' // Background color
con2fig. BgImg		= ''		// Path to background image, none if empty string ''
con2fig. BorderColor 	= '#016394'
con2fig. BorderStyle 	= 'solid'	// Any permitted CSS value, but I recommend 'solid', 'dotted' or 'dashed'
con2fig. BorderWidth 	= 1
con2fig. CenterMouse 	= false 	// false or true - center the tip horizontally below (or above) the mousepointer
con2fig. ClickClose		= false 	// false or true - close tooltip if the user clicks somewhere
con2fig. CloseBtn		= false 	// false or true - closebutton in titlebar
con2fig. CloseBtnColors	= ['#990000', '#FFFFFF', '#DD3333', '#FFFFFF']	  // [Background, text, hovered background, hovered text] - use empty strings '' to inherit title colors
con2fig. CloseBtnText	= '&nbsp;X&nbsp;'	// Close button text (may also be an image tag)
con2fig. CopyContent	= true		// When converting a HTML element to a tooltip, copy only the element's content, rather than converting the element by its own
con2fig. Delay		= 400		// Time span in ms until tooltip shows up
con2fig. Duration		= 0 		// Time span in ms after which the tooltip disappears; 0 for infinite duration
con2fig. FadeIn		= 0 		// Fade-in duration in ms, e.g. 400; 0 for no animation
con2fig. FadeOut 		= 0
con2fig. FadeInterval	= 30		// Duration of each fade step in ms (recommended: 30) - shorter is smoother but causes more CPU-load
con2fig. Fix 		= null		// Fixated position - x- an y-oordinates in brackets, e.g. [210, 480], or null for no fixation
con2fig. FollowMouse	= true		// false or true - tooltip follows the mouse
con2fig. FontColor		= '#016394'
con2fig. FontFace		= 'Arial,Verdana,Geneva,sans-serif'
con2fig. FontSize		= '8pt' 	// E.g. '9pt' or '12px' - unit is mandatory
con2fig. FontWeight		= 'bold'	// 'normal' or 'bold';
con2fig. Left		= false 	// false or true - tooltip on the left of the mouse
con2fig. OffsetX 		= 14		// Horizontal offset of left-top corner from mousepointer
con2fig. OffsetY 		= 8 		// Vertical offset
con2fig. Opacity 		= 80		// Integer between 0 and 100 - opacity of tooltip in percent
con2fig. Padding 		= 5 		// Spacing between border and content
con2fig. Shadow		= true 	// false or true
con2fig. ShadowColor 	= '#5f6062'
con2fig. ShadowWidth 	= 3
con2fig. Sticky		= false 	// Do NOT hide tooltip on mouseout? false or true
con2fig. TextAlign		= 'left'	// 'left', 'right' or 'justify'
con2fig. Title		= ''		// Default title text applied to all tips (no default title: empty string '')
con2fig. TitleAlign		= 'left'	// 'left' or 'right' - text alignment inside the title bar
con2fig. TitleBgColor	= ''		// If empty string '', BorderColor will be used
con2fig. TitleFontColor	= '#ffffff'	// Color of title text - if '', BgColor (of tooltip body) will be used
con2fig. TitleFontFace	= ''		// If '' use FontFace (boldified)
con2fig. TitleFontSize	= ''		// If '' use FontSize
con2fig. Width		= 0 		// Tooltip width; 0 for automatic adaption to tooltip content
//=======  END OF TOOLTIP con2fig, DO NOT CHANGE ANYTHING BELOW  ==============//




//======================  PUBLIC  ============================================//
function T2ip()
{
	t2t_Tip(arguments, null);
}
function TagToT2ip()
{
	if(TagsToT2ip)
	{
		var t2t = t2t_GetElt(arguments[0]);
		if(t2t)
			t2t_Tip(arguments, t2t);
	}
}

//==================  PUBLIC EXTENSION API	==================================//
// Extension eventhandlers currently supported:
// OnLoadcon2fig, OnCreateContentString, OnSubDivsCreated, OnShow, OnMoveBefore,
// OnMoveAfter, OnHideInit, OnHide, OnKill

var t2t_aElt = 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
t2t_aV = new Array(),	// Caches and enumerates con2fig data for currently active tooltip
t2t_sContent,			// Inner tooltip text or HTML
t2t_scrlX = 0, t2t_scrlY = 0,
t2t_musX, t2t_musY,
t2t_over,
t2t_x, t2t_y, t2t_w, t2t_h; // Position, width and height of currently displayed tooltip

function t2t_Extension()
{
	t2t_ExtCmdEnum();
	t2t_aExt[t2t_aExt.length] = this;
	return this;
}
function t2t_SetTipPos(x, y)
{
	var css = t2t_aElt[0].style;

	t2t_x = x;
	t2t_y = y;
	css.left = x + "px";
	css.top = y + "px";
	if(t2t_ie56)
	{
		var ifrm = t2t_aElt[t2t_aElt.length - 1];
		if(ifrm)
		{
			ifrm.style.left = css.left;
			ifrm.style.top = css.top;
		}
	}
}
function t2t_Hide()
{
	if(t2t_db && t2t_iState)
	{
		if(t2t_iState & 0x2)
		{
			t2t_aElt[0].style.visibility = "hidden";
			t2t_ExtCallFncs(0, "Hide");
		}
		t2t_tShow.EndTimer();
		t2t_tHide.EndTimer();
		t2t_tDurt.EndTimer();
		t2t_tFade.EndTimer();
		if(!t2t_op && !t2t_ie)
		{
			t2t_tWaitMov.EndTimer();
			t2t_bWait = false;
		}
		if(t2t_aV[CLICKCLOSE])
			t2t_RemEvtFnc(document, "mouseup", t2t_HideInit);
		t2t_AddRemOutFnc(false);
		t2t_ExtCallFncs(0, "Kill");
		// In case of a TagToTip tooltip, hide converted DOM node and
		// re-insert it into document
		if(t2t_t2t && !t2t_aV[COPYCONTENT])
		{
			t2t_t2t.style.display = "none";
			t2t_MovDomNode(t2t_t2t, t2t_aElt[6], t2t_t2tDad);
		}
		t2t_iState = 0;
		t2t_over = null;
		t2t_ResetMainDiv();
		if(t2t_aElt[t2t_aElt.length - 1])
			t2t_aElt[t2t_aElt.length - 1].style.display = "none";
	}
}
function t2t_GetElt(id)
{
	return(document.getElementById ? document.getElementById(id)
			: document.all ? document.all[id]
			: null);
}
function t2t_GetDivW(el)
{
	return(el ? (el.offsetWidth || el.style.pixelWidth || 0) : 0);
}
function t2t_GetDivH(el)
{
	return(el ? (el.offsetHeight || el.style.pixelHeight || 0) : 0);
}
function t2t_GetScrollX()
{
	return(window.pageXOffset || (t2t_db ? (t2t_db.scrollLeft || 0) : 0));
}
function t2t_GetScrollY()
{
	return(window.pageYOffset || (t2t_db ? (t2t_db.scrollTop || 0) : 0));
}
function t2t_GetClientW()
{
	return(document.body && (typeof(document.body.clientWidth) != t2t_u) ? document.body.clientWidth
			: (typeof(window.innerWidth) != t2t_u) ? window.innerWidth
			: t2t_db ? (t2t_db.clientWidth || 0)
			: 0);
}
function t2t_GetClientH()
{
	// Exactly this order seems to yield correct values in all major browsers
	return(document.body && (typeof(document.body.clientHeight) != t2t_u) ? document.body.clientHeight
			: (typeof(window.innerHeight) != t2t_u) ? window.innerHeight
			: t2t_db ? (t2t_db.clientHeight || 0)
			: 0);
}
function t2t_GetEvtX(e)
{
	return (e ? ((typeof(e.pageX) != t2t_u) ? e.pageX : (e.clientX + t2t_scrlX)) : 0);
}
function t2t_GetEvtY(e)
{
	return (e ? ((typeof(e.pageY) != t2t_u) ? e.pageY : (e.clientY + t2t_scrlY)) : 0);
}
function t2t_AddEvtFnc(el, sEvt, PFnc)
{
	if(el)
	{
		if(el.addEventListener)
			el.addEventListener(sEvt, PFnc, false);
		else
			el.attachEvent("on" + sEvt, PFnc);
	}
}
function t2t_RemEvtFnc(el, sEvt, PFnc)
{
	if(el)
	{
		if(el.removeEventListener)
			el.removeEventListener(sEvt, PFnc, false);
		else
			el.detachEvent("on" + sEvt, PFnc);
	}
}

//======================  PRIVATE  ===========================================//
var t2t_aExt = new Array(),	// Array of extension objects

t2t_db, t2t_op, t2t_ie, t2t_ie56, t2t_bBoxOld,	// Browser flags
t2t_body,
t2t_flagOpa, 			// Opacity support: 1=IE, 2=Khtml, 3=KHTML, 4=Moz, 5=W3C
t2t_maxPosX, t2t_maxPosY,
t2t_iState = 0,			// Tooltip active |= 1, shown |= 2, move with mouse |= 4
t2t_opa, 				// Currently applied opacity
t2t_bJmpVert,			// Tip above mouse (or ABOVE tip below mouse)
t2t_t2t, t2t_t2tDad,		// Tag converted to tip, and its parent element in the document
t2t_elDeHref,			// The tag from which Opera has removed the href attribute
// Timer
t2t_tShow = new Number(0), t2t_tHide = new Number(0), t2t_tDurt = new Number(0),
t2t_tFade = new Number(0), t2t_tWaitMov = new Number(0),
t2t_bWait = false,
t2t_u = "undefined";


function t2t_Init()
{
	t2t_MkCmdEnum();
	// Send old browsers instantly to hell
	if(!t2t_Browser() || !t2t_MkMainDiv())
		return;
	t2t_IsW3cBox();
	t2t_OpaSupport();
	t2t_AddEvtFnc(document, "mousemove", t2t_Move);
	// In Debug mode we search for TagToTip() calls in order to notify
	// the user if they've forgotten to set the TagsToTip con2fig flag
	if(TagsToTip || t2t_Debug)
		t2t_SetOnloadFnc();
	t2t_AddEvtFnc(window, "scroll",
		function()
		{
			t2t_scrlX = t2t_GetScrollX();
			t2t_scrlY = t2t_GetScrollY();
			if(t2t_iState && !(t2t_aV[STICKY] && (t2t_iState & 2)))
				t2t_HideInit();
		} );
	// Ensure the tip be hidden when the page unloads
	t2t_AddEvtFnc(window, "unload", t2t_Hide);
	t2t_Hide();
}
// Creates command names by translating con2fig variable names to upper case
function t2t_MkCmdEnum()
{
	var n = 0;
	for(var i in con2fig)
		eval("window." + i.toString().toUpperCase() + " = " + n++);
	t2t_aV.length = n;
}
function t2t_Browser()
{
	var n, nv, n6, w3c;

	n = navigator.userAgent.toLowerCase(),
	nv = navigator.appVersion;
	t2t_op = (document.defaultView && typeof(eval("w" + "indow" + "." + "o" + "p" + "er" + "a")) != t2t_u);
	t2t_ie = n.indexOf("msie") != -1 && document.all && !t2t_op;
	if(t2t_ie)
	{
		var ieOld = (!document.compatMode || document.compatMode == "BackCompat");
		t2t_db = !ieOld ? document.documentElement : (document.body || null);
		if(t2t_db)
			t2t_ie56 = parseFloat(nv.substring(nv.indexOf("MSIE") + 5)) >= 5.5
					&& typeof document.body.style.maxHeight == t2t_u;
	}
	else
	{
		t2t_db = document.documentElement || document.body ||
				(document.getElementsByTagName ? document.getElementsByTagName("body")[0]
				: null);
		if(!t2t_op)
		{
			n6 = document.defaultView && typeof document.defaultView.getComputedStyle != t2t_u;
			w3c = !n6 && document.getElementById;
		}
	}
	t2t_body = (document.getElementsByTagName ? document.getElementsByTagName("body")[0]
				: (document.body || null));
	if(t2t_ie || n6 || t2t_op || w3c)
	{
		if(t2t_body && t2t_db)
		{
			if(document.attachEvent || document.addEventListener)
				return true;
		}
		else
			t2t_Err("wz_tooltip.js must be included INSIDE the body section,"
					+ " immediately after the opening <body> tag.");
	}
	t2t_db = null;
	return false;
}
function t2t_MkMainDiv()
{
	// Create the tooltip DIV
	if(t2t_body.insertAdjacentHTML)
		t2t_body.insertAdjacentHTML("afterBegin", t2t_MkMainDivHtm());
	else if(typeof t2t_body.innerHTML != t2t_u && document.createElement && t2t_body.appendChild)
		t2t_body.appendChild(t2t_MkMainDivDom());
	// FireFox Alzheimer bug
	if(window.t2t_GetMainDivRefs && t2t_GetMainDivRefs())
		return true;
	t2t_db = null;
	return false;
}
function t2t_MkMainDivHtm()
{
	return('<div id="WzTtDiV"></div>' +
			(t2t_ie56 ? ('<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 t2t_MkMainDivDom()
{
	var el = document.createElement("div");
	if(el)
		el.id = "WzTtDiV";
	return el;
}
function t2t_GetMainDivRefs()
{
	t2t_aElt[0] = t2t_GetElt("WzTtDiV");
	if(t2t_ie56 && t2t_aElt[0])
	{
		t2t_aElt[t2t_aElt.length - 1] = t2t_GetElt("WzTtIfRm");
		if(!t2t_aElt[t2t_aElt.length - 1])
			t2t_aElt[0] = null;
	}
	if(t2t_aElt[0])
	{
		var css = t2t_aElt[0].style;

		css.visibility = "hidden";
		css.position = "absolute";
		css.overflow = "hidden";
		return true;
	}
	return false;
}
function t2t_ResetMainDiv()
{
	var w = (window.screen && screen.width) ? screen.width : 10000;

	t2t_SetTipPos(-w, 0);
	t2t_aElt[0].innerHTML = "";
	t2t_aElt[0].style.width = (w - 1) + "px";
}
function t2t_IsW3cBox()
{
	var css = t2t_aElt[0].style;

	css.padding = "10px";
	css.width = "40px";
	t2t_bBoxOld = (t2t_GetDivW(t2t_aElt[0]) == 40);
	css.padding = "0px";
	t2t_ResetMainDiv();
}
function t2t_OpaSupport()
{
	var css = t2t_body.style;

	t2t_flagOpa = (typeof(css.filter) != t2t_u) ? 1
				: (typeof(css.KhtmlOpacity) != t2t_u) ? 2
				: (typeof(css.KHTMLOpacity) != t2t_u) ? 3
				: (typeof(css.MozOpacity) != t2t_u) ? 4
				: (typeof(css.opacity) != t2t_u) ? 5
				: 0;
}
// Ported from http://dean.edwards.name/weblog/2006/06/again/
// (Dean Edwards et al.)
function t2t_SetOnloadFnc()
{
	t2t_AddEvtFnc(document, "DOMContentLoaded", t2t_HideSrcTags);
	t2t_AddEvtFnc(window, "load", t2t_HideSrcTags);
	if(t2t_body.attachEvent)
		t2t_body.attachEvent("onreadystatechange",
			function() {
				if(t2t_body.readyState == "complete")
					t2t_HideSrcTags();
			} );
	if(/WebKit|KHTML/i.test(navigator.userAgent))
	{
		var t = setInterval(function() {
					if(/loaded|complete/.test(document.readyState))
					{
						clearInterval(t);
						t2t_HideSrcTags();
					}
				}, 10);
	}
}
function t2t_HideSrcTags()
{
	if(!window.t2t_HideSrcTags || window.t2t_HideSrcTags.done)
		return;
	window.t2t_HideSrcTags.done = true;
	if(!t2t_HideSrcTagsRecurs(t2t_body))
		t2t_Err("To enable the capability to convert HTML elements to tooltips,"
				+ " you must set TagsToTip in the global tooltip con2figuration"
				+ " to true.");
}
function t2t_HideSrcTagsRecurs(dad)
{
	var a, ovr, asT2t;

	// Walk the DOM tree for tags that have an onmouseover attribute
	// containing a TagToTip('...') call.
	// (.childNodes first since .children is bugous in Safari)
	a = dad.childNodes || dad.children || null;
	for(var i = a ? a.length : 0; i;)
	{--i;
		if(!t2t_HideSrcTagsRecurs(a[i]))
			return false;
		ovr = a[i].getAttribute ? a[i].getAttribute("onmouseover")
				: (typeof a[i].onmouseover == "function") ? a[i].onmouseover
				: null;
		if(ovr)
		{
			asT2t = ovr.toString().match(/TagToTip\s*\(\s*'[^'.]+'\s*[\),]/);
			if(asT2t && asT2t.length)
			{
				if(!t2t_HideSrcTag(asT2t[0]))
					return false;
			}
		}
	}
	return true;
}
function t2t_HideSrcTag(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 = t2t_GetElt(id);
	if(el)
	{
		if(t2t_Debug && !TagsToTip)
			return false;
		else
			el.style.display = "none";
	}
	else
		t2t_Err("Invalid ID\n'" + id + "'\npassed to TagToTip()."
				+ " There exists no HTML element with that ID.");
	return true;
}
function t2t_Tip(arg, t2t)
{
	if(!t2t_db)
		return;
	if(t2t_iState)
		t2t_Hide();
	if(!t2t_Enabled)
		return;
	t2t_t2t = t2t;
	if(!t2t_ReadCmds(arg))
		return;
	t2t_iState = 0x1 | 0x4;
	t2t_Adaptcon2fig1();
	t2t_MkTipContent(arg);
	t2t_MkTipSubDivs();
	t2t_FormatTip();
	t2t_bJmpVert = false;
	t2t_maxPosX = t2t_GetClientW() + t2t_scrlX - t2t_w - 1;
	t2t_maxPosY = t2t_GetClientH() + t2t_scrlY - t2t_h - 1;
	t2t_Adaptcon2fig2();
	// We must fake the first mousemove in order to ensure the tip
	// be immediately shown and positioned
	t2t_Move();
	t2t_ShowInit();
}
function t2t_ReadCmds(a)
{
	var i;

	// First load the global con2fig values, to initialize also values
	// for which no command has been passed
	i = 0;
	for(var j in con2fig)
		t2t_aV[i++] = con2fig[j];
	// Then replace each cached con2fig 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)
			t2t_aV[a[i - 1]] = a[i];
		return true;
	}
	t2t_Err("Incorrect call of Tip() or TagToTip().\n"
			+ "Each command must be followed by a value.");
	return false;
}
function t2t_Adaptcon2fig1()
{
	t2t_ExtCallFncs(0, "Loadcon2fig");
	// Inherit unspecified title formattings from body
	if(!t2t_aV[TITLEBGCOLOR].length)
		t2t_aV[TITLEBGCOLOR] = t2t_aV[BORDERCOLOR];
	if(!t2t_aV[TITLEFONTCOLOR].length)
		t2t_aV[TITLEFONTCOLOR] = t2t_aV[BGCOLOR];
	if(!t2t_aV[TITLEFONTFACE].length)
		t2t_aV[TITLEFONTFACE] = t2t_aV[FONTFACE];
	if(!t2t_aV[TITLEFONTSIZE].length)
		t2t_aV[TITLEFONTSIZE] = t2t_aV[FONTSIZE];
	if(t2t_aV[CLOSEBTN])
	{
		// Use title colors for non-specified closebutton colors
		if(!t2t_aV[CLOSEBTNCOLORS])
			t2t_aV[CLOSEBTNCOLORS] = new Array("", "", "", "");
		for(var i = 4; i;)
		{--i;
			if(!t2t_aV[CLOSEBTNCOLORS][i].length)
				t2t_aV[CLOSEBTNCOLORS][i] = (i & 1) ? t2t_aV[TITLEFONTCOLOR] : t2t_aV[TITLEBGCOLOR];
		}
		// Enforce titlebar be shown
		if(!t2t_aV[TITLE].length)
			t2t_aV[TITLE] = " ";
	}
	// Circumvents broken display of images and fade-in flicker in Geckos < 1.8
	if(t2t_aV[OPACITY] == 100 && typeof t2t_aElt[0].style.MozOpacity != t2t_u && !Array.every)
		t2t_aV[OPACITY] = 99;
	// Smartly shorten the delay for fade-in tooltips
	if(t2t_aV[FADEIN] && t2t_flagOpa && t2t_aV[DELAY] > 100)
		t2t_aV[DELAY] = Math.max(t2t_aV[DELAY] - t2t_aV[FADEIN], 100);
}
function t2t_Adaptcon2fig2()
{
	if(t2t_aV[CENTERMOUSE])
		t2t_aV[OFFSETX] -= ((t2t_w - (t2t_aV[SHADOW] ? t2t_aV[SHADOWWIDTH] : 0)) >> 1);
}
// Expose content globally so extensions can modify it
function t2t_MkTipContent(a)
{
	if(t2t_t2t)
	{
		if(t2t_aV[COPYCONTENT])
			t2t_sContent = t2t_t2t.innerHTML;
		else
			t2t_sContent = "";
	}
	else
		t2t_sContent = a[0];
	t2t_ExtCallFncs(0, "CreateContentString");
}
function t2t_MkTipSubDivs()
{
	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 ';

	t2t_aElt[0].innerHTML =
		(''
		+ (t2t_aV[TITLE].length ?
			('<div id="WzTiTl" style="position:relative;z-index:1;">'
			+ '<table id="WzTiTlTb"' + sTbTrTd + 'id="WzTiTlI" style="' + sCss + '">'
			+ t2t_aV[TITLE]
			+ '</td>'
			+ (t2t_aV[CLOSEBTN] ?
				('<td align="right" style="' + sCss
				+ 'text-align:right;">'
				+ '<span id="WzClOsE" style="padding-left:2px;padding-right:2px;'
				+ 'cursor:' + (t2t_ie ? 'hand' : 'pointer')
				+ ';" onmouseover="t2t_OnCloseBtnOver(1)" onmouseout="t2t_OnCloseBtnOver(0)" onclick="t2t_HideInit()">'
				+ t2t_aV[CLOSEBTNTEXT]
				+ '</span></td>')
				: '')
			+ '</tr></tbody></table></div>')
			: '')
		+ '<div id="WzBoDy" style="position:relative;z-index:0;">'
		+ '<table' + sTbTrTd + 'id="WzBoDyI" style="' + sCss + '">'
		+ t2t_sContent
		+ '</td></tr></tbody></table></div>'
		+ (t2t_aV[SHADOW]
			? ('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>'
				+ '<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>')
			: '')
		);
	t2t_GetSubDivRefs();
	// Convert DOM node to tip
	if(t2t_t2t && !t2t_aV[COPYCONTENT])
	{
		// Store the tag's parent element so we can restore that DOM branch
		// once the tooltip is hidden
		t2t_t2tDad = t2t_t2t.parentNode || t2t_t2t.parentElement || t2t_t2t.offsetParent || null;
		if(t2t_t2tDad)
		{
			t2t_MovDomNode(t2t_t2t, t2t_t2tDad, t2t_aElt[6]);
			t2t_t2t.style.display = "block";
		}
	}
	t2t_ExtCallFncs(0, "SubDivsCreated");
}
function t2t_GetSubDivRefs()
{
	var aId = new Array("WzTiTl", "WzTiTlTb", "WzTiTlI", "WzClOsE", "WzBoDy", "WzBoDyI", "WzTtShDwB", "WzTtShDwR");

	for(var i = aId.length; i; --i)
		t2t_aElt[i] = t2t_GetElt(aId[i - 1]);
}
function t2t_FormatTip()
{
	var css, w, iOffY, iOffSh;

	//--------- Title DIV ----------
	if(t2t_aV[TITLE].length)
	{
		css = t2t_aElt[1].style;
		css.background = t2t_aV[TITLEBGCOLOR];
		css.paddingTop = (t2t_aV[CLOSEBTN] ? 2 : 0) + "px";
		css.paddingBottom = "1px";
		css.paddingLeft = css.paddingRight = t2t_aV[PADDING] + "px";
		css = t2t_aElt[3].style;
		css.color = t2t_aV[TITLEFONTCOLOR];
		css.fontFamily = t2t_aV[TITLEFONTFACE];
		css.fontSize = t2t_aV[TITLEFONTSIZE];
		css.fontWeight = "bold";
		css.textAlign = t2t_aV[TITLEALIGN];
		// Close button DIV
		if(t2t_aElt[4])
		{
			css.paddingRight = (t2t_aV[PADDING] << 1) + "px";
			css = t2t_aElt[4].style;
			css.background = t2t_aV[CLOSEBTNCOLORS][0];
			css.color = t2t_aV[CLOSEBTNCOLORS][1];
			css.fontFamily = t2t_aV[TITLEFONTFACE];
			css.fontSize = t2t_aV[TITLEFONTSIZE];
			css.fontWeight = "bold";
		}
		if(t2t_aV[WIDTH] > 0)
			t2t_w = t2t_aV[WIDTH] + ((t2t_aV[PADDING] + t2t_aV[BORDERWIDTH]) << 1);
		else
		{
			t2t_w = t2t_GetDivW(t2t_aElt[3]) + t2t_GetDivW(t2t_aElt[4]);
			// Some spacing between title DIV and closebutton
			if(t2t_aElt[4])
				t2t_w += t2t_aV[PADDING];
		}
		// Ensure the top border of the body DIV be covered by the title DIV
		iOffY = -t2t_aV[BORDERWIDTH];
	}
	else
	{
		t2t_w = 0;
		iOffY = 0;
	}

	//-------- Body DIV ------------
	css = t2t_aElt[5].style;
	css.top = iOffY + "px";
	if(t2t_aV[BORDERWIDTH])
	{
		css.borderColor = t2t_aV[BORDERCOLOR];
		css.borderStyle = t2t_aV[BORDERSTYLE];
		css.borderWidth = t2t_aV[BORDERWIDTH] + "px";
	}
	if(t2t_aV[BGCOLOR].length)
		css.background = t2t_aV[BGCOLOR];
	if(t2t_aV[BGIMG].length)
		css.backgroundImage = "url(" + t2t_aV[BGIMG] + ")";
	css.padding = t2t_aV[PADDING] + "px";
	css.textAlign = t2t_aV[TEXTALIGN];
	// TD inside body DIV
	css = t2t_aElt[6].style;
	css.color = t2t_aV[FONTCOLOR];
	css.fontFamily = t2t_aV[FONTFACE];
	css.fontSize = t2t_aV[FONTSIZE];
	css.fontWeight = t2t_aV[FONTWEIGHT];
	css.background = "";
	css.textAlign = t2t_aV[TEXTALIGN];
	if(t2t_aV[WIDTH] > 0)
		w = t2t_aV[WIDTH] + ((t2t_aV[PADDING] + t2t_aV[BORDERWIDTH]) << 1);
	else
		// We measure the width of the body's inner TD, because some browsers
		// expand the width of the container and outer body DIV to 100%
		w = t2t_GetDivW(t2t_aElt[6]) + ((t2t_aV[PADDING] + t2t_aV[BORDERWIDTH]) << 1);
	if(w > t2t_w)
		t2t_w = w;

	//--------- Shadow DIVs ------------
	if(t2t_aV[SHADOW])
	{
		t2t_w += t2t_aV[SHADOWWIDTH];
		iOffSh = Math.floor((t2t_aV[SHADOWWIDTH] * 4) / 3);
		// Bottom shadow
		css = t2t_aElt[7].style;
		css.top = iOffY + "px";
		css.left = iOffSh + "px";
		css.width = (t2t_w - iOffSh - t2t_aV[SHADOWWIDTH]) + "px";
		css.height = t2t_aV[SHADOWWIDTH] + "px";
		css.background = t2t_aV[SHADOWCOLOR];
		// Right shadow
		css = t2t_aElt[8].style;
		css.top = iOffSh + "px";
		css.left = (t2t_w - t2t_aV[SHADOWWIDTH]) + "px";
		css.width = t2t_aV[SHADOWWIDTH] + "px";
		css.background = t2t_aV[SHADOWCOLOR];
	}
	else
		iOffSh = 0;

	//-------- Container DIV -------
	t2t_SetTipOpa(t2t_aV[FADEIN] ? 0 : t2t_aV[OPACITY]);
	t2t_FixSize(iOffY, iOffSh);
}
// Fixate the size so it can't dynamically change while the tooltip is moving.
function t2t_FixSize(iOffY, iOffSh)
{
	var wIn, wOut, i;

	t2t_aElt[0].style.width = t2t_w + "px";
	t2t_aElt[0].style.pixelWidth = t2t_w;
	wOut = t2t_w - ((t2t_aV[SHADOW]) ? t2t_aV[SHADOWWIDTH] : 0);
	// Body
	wIn = wOut;
	if(!t2t_bBoxOld)
		wIn -= ((t2t_aV[PADDING] + t2t_aV[BORDERWIDTH]) << 1);
	t2t_aElt[5].style.width = wIn + "px";
	// Title
	if(t2t_aElt[1])
	{
		wIn = wOut - (t2t_aV[PADDING] << 1);
		if(!t2t_bBoxOld)
			wOut = wIn;
		t2t_aElt[1].style.width = wOut + "px";
		t2t_aElt[2].style.width = wIn + "px";
	}
	t2t_h = t2t_GetDivH(t2t_aElt[0]) + iOffY;
	// Right shadow
	if(t2t_aElt[8])
		t2t_aElt[8].style.height = (t2t_h - iOffSh) + "px";
	i = t2t_aElt.length - 1;
	if(t2t_aElt[i])
	{
		t2t_aElt[i].style.width = t2t_w + "px";
		t2t_aElt[i].style.height = t2t_h + "px";
	}
}
function t2t_DeAlt(el)
{
	var aKid;

	if(el.alt)
		el.alt = "";
	if(el.title)
		el.title = "";
	aKid = el.childNodes || el.children || null;
	if(aKid)
	{
		for(var i = aKid.length; i;)
			t2t_DeAlt(aKid[--i]);
	}
}
// This hack removes the annoying native tooltips over links in Opera
function t2t_OpDeHref(el)
{
	if(!t2t_op)
		return;
	if(t2t_elDeHref)
		t2t_OpReHref();
	while(el)
	{
		if(el.hasAttribute("href"))
		{
			el.t_href = el.getAttribute("href");
			el.t_stats = window.status;
			el.removeAttribute("href");
			el.style.cursor = "hand";
			t2t_AddEvtFnc(el, "mousedown", t2t_OpReHref);
			window.status = el.t_href;
			t2t_elDeHref = el;
			break;
		}
		el = el.parentElement;
	}
}
function t2t_ShowInit()
{
	t2t_tShow.Timer("t2t_Show()", t2t_aV[DELAY], true);
	if(t2t_aV[CLICKCLOSE])
		t2t_AddEvtFnc(document, "mouseup", t2t_HideInit);
}
function t2t_OverInit(e)
{
	t2t_over = e.target || e.srcElement;
	t2t_DeAlt(t2t_over);
	t2t_OpDeHref(t2t_over);
	t2t_AddRemOutFnc(true);
}
function t2t_Show()
{
	var css = t2t_aElt[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(t2t_aV[STICKY] || !t2t_aV[FOLLOWMOUSE])
		t2t_iState &= ~0x4;
	if(t2t_aV[DURATION] > 0)
		t2t_tDurt.Timer("t2t_HideInit()", t2t_aV[DURATION], true);
	t2t_ExtCallFncs(0, "Show")
	css.visibility = "visible";
	t2t_iState |= 0x2;
	if(t2t_aV[FADEIN])
		t2t_Fade(0, 0, t2t_aV[OPACITY], Math.round(t2t_aV[FADEIN] / t2t_aV[FADEINTERVAL]));
	t2t_ShowIfrm();
}
function t2t_ShowIfrm()
{
	if(t2t_ie56)
	{
		var ifrm = t2t_aElt[t2t_aElt.length - 1];
		if(ifrm)
		{
			var css = ifrm.style;
			css.zIndex = t2t_aElt[0].style.zIndex - 1;
			css.display = "block";
		}
	}
}
function t2t_Move(e)
{
	e = window.event || e;
	if(e)
	{
		t2t_musX = t2t_GetEvtX(e);
		t2t_musY = t2t_GetEvtY(e);
	}
	if(t2t_iState)
	{
		if(!t2t_over && e)
			t2t_OverInit(e);
		if(t2t_iState & 0x4)
		{
			// Protect some browsers against jam of mousemove events
			if(!t2t_op && !t2t_ie)
			{
				if(t2t_bWait)
					return;
				t2t_bWait = true;
				t2t_tWaitMov.Timer("t2t_bWait = false;", 1, true);
			}
			if(t2t_aV[FIX])
			{
				t2t_iState &= ~0x4;
				t2t_SetTipPos(t2t_aV[FIX][0], t2t_aV[FIX][1]);
			}
			else if(!t2t_ExtCallFncs(e, "MoveBefore"))
				t2t_SetTipPos(t2t_PosX(), t2t_PosY());
			t2t_ExtCallFncs([t2t_musX, t2t_musY], "MoveAfter")
		}
	}
}
function t2t_PosX()
{
	var x;

	x = t2t_musX;
	if(t2t_aV[LEFT])
		x -= t2t_w + t2t_aV[OFFSETX] - (t2t_aV[SHADOW] ? t2t_aV[SHADOWWIDTH] : 0);
	else
		x += t2t_aV[OFFSETX];
	// Prevent tip from extending past right/left clientarea boundary
	if(x > t2t_maxPosX)
		x = t2t_maxPosX;
	return((x < t2t_scrlX) ? t2t_scrlX : x);
}
function t2t_PosY()
{
	var y;

	// Apply some hysteresis after the tip has snapped to the other side of the
	// mouse. In case of insufficient space above and below the mouse, we place
	// the tip below.
	if(t2t_aV[ABOVE] && (!t2t_bJmpVert || t2t_CalcPosYAbove() >= t2t_scrlY + 16))
		y = t2t_DoPosYAbove();
	else if(!t2t_aV[ABOVE] && t2t_bJmpVert && t2t_CalcPosYBelow() > t2t_maxPosY - 16)
		y = t2t_DoPosYAbove();
	else
		y = t2t_DoPosYBelow();
	// Snap to other side of mouse if tip would extend past window boundary
	if(y > t2t_maxPosY)
		y = t2t_DoPosYAbove();
	if(y < t2t_scrlY)
		y = t2t_DoPosYBelow();
	return y;
}
function t2t_DoPosYBelow()
{
	t2t_bJmpVert = t2t_aV[ABOVE];
	return t2t_CalcPosYBelow();
}
function t2t_DoPosYAbove()
{
	t2t_bJmpVert = !t2t_aV[ABOVE];
	return t2t_CalcPosYAbove();
}
function t2t_CalcPosYBelow()
{
	return(t2t_musY + t2t_aV[OFFSETY]);
}
function t2t_CalcPosYAbove()
{
	var dy = t2t_aV[OFFSETY] - (t2t_aV[SHADOW] ? t2t_aV[SHADOWWIDTH] : 0);
	if(t2t_aV[OFFSETY] > 0 && dy <= 0)
		dy = 1;
	return(t2t_musY - t2t_h - dy);
}
function t2t_OnOut()
{
	t2t_AddRemOutFnc(false);
	if(!(t2t_aV[STICKY] && (t2t_iState & 0x2)))
		t2t_HideInit();
}
function t2t_HideInit()
{
	t2t_ExtCallFncs(0, "HideInit");
	t2t_iState &= ~0x4;
	if(t2t_flagOpa && t2t_aV[FADEOUT])
	{
		t2t_tFade.EndTimer();
		if(t2t_opa)
		{
			var n = Math.round(t2t_aV[FADEOUT] / (t2t_aV[FADEINTERVAL] * (t2t_aV[OPACITY] / t2t_opa)));
			t2t_Fade(t2t_opa, t2t_opa, 0, n);
			return;
		}
	}
	t2t_tHide.Timer("t2t_Hide();", 1, false);
}
function t2t_OpReHref()
{
	if(t2t_elDeHref)
	{
		t2t_elDeHref.setAttribute("href", t2t_elDeHref.t_href);
		t2t_RemEvtFnc(t2t_elDeHref, "mousedown", t2t_OpReHref);
		window.status = t2t_elDeHref.t_stats;
		t2t_elDeHref = null;
	}
}
function t2t_Fade(a, now, z, n)
{
	if(n)
	{
		now += Math.round((z - now) / n);
		if((z > a) ? (now >= z) : (now <= z))
			now = z;
		else
			t2t_tFade.Timer("t2t_Fade("
							+ a + "," + now + "," + z + "," + (n - 1)
							+ ")",
							t2t_aV[FADEINTERVAL],
							true);
	}
	now ? t2t_SetTipOpa(now) : t2t_Hide();
}
// To circumvent the opacity nesting flaws of IE, we set the opacity
// for each sub-DIV separately, rather than for the container DIV.
function t2t_SetTipOpa(opa)
{
	t2t_SetOpa(t2t_aElt[5].style, opa);
	if(t2t_aElt[1])
		t2t_SetOpa(t2t_aElt[1].style, opa);
	if(t2t_aV[SHADOW])
	{
		opa = Math.round(opa * 0.8);
		t2t_SetOpa(t2t_aElt[7].style, opa);
		t2t_SetOpa(t2t_aElt[8].style, opa);
	}
}
function t2t_OnCloseBtnOver(iOver)
{
	var css = t2t_aElt[4].style;

	iOver <<= 1;
	css.background = t2t_aV[CLOSEBTNCOLORS][iOver];
	css.color = t2t_aV[CLOSEBTNCOLORS][iOver + 1];
}
function t2t_Int(x)
{
	var y;

	return(isNaN(y = parseInt(x)) ? 0 : y);
}
// Adds or removes the document.mousemove or HoveredElem.mouseout handler
// conveniently. Keeps track of those handlers to prevent them from being
// set or removed redundantly.
function t2t_AddRemOutFnc(bAdd)
{
	var PSet = bAdd ? t2t_AddEvtFnc : t2t_RemEvtFnc;

	if(bAdd != t2t_AddRemOutFnc.bOn)
	{
		PSet(t2t_over, "mouseout", t2t_OnOut);
		t2t_AddRemOutFnc.bOn = bAdd;
		if(!bAdd)
			t2t_OpReHref();
	}
}
t2t_AddRemOutFnc.bOn = false;
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 t2t_SetOpa(css, opa)
{
	t2t_opa = opa;
	if(t2t_flagOpa == 1)
	{
		// Hack for bugs of IE:
		// A DIV cannot be made visible in a single step if an opacity < 100
		// has been applied while the DIV was hidden.
		// Moreover, in IE6, applying an opacity < 100 has no effect if the
		// concerned element has no layout (position, size, zoom, ...).
		if(opa < 100)
		{
			var bVis = css.visibility != "hidden";
			css.zoom = "100%";
			if(!bVis)
				css.visibility = "visible";
			css.filter = "alpha(opacity=" + opa + ")";
			if(!bVis)
				css.visibility = "hidden";
		}
		else
			css.filter = "";
	}
	else
	{
		opa /= 100.0;
		switch(t2t_flagOpa)
		{
		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 t2t_MovDomNode(el, dadFrom, dadTo)
{
	if(dadFrom)
		dadFrom.removeChild(el);
	if(dadTo)
		dadTo.appendChild(el);
}
function t2t_Err(sErr)
{
	if(t2t_Debug)
		alert("Tooltip Script Error Message:\n\n" + sErr);
}

//===========  DEALING WITH EXTENSIONS	==============//
function t2t_ExtCmdEnum()
{
	var s;

	// Add new command(s) to the commands enum
	for(var i in con2fig)
	{
		s = "window." + i.toString().toUpperCase();
		if(eval("typeof(" + s + ") == t2t_u"))
		{
			eval(s + " = " + t2t_aV.length);
			t2t_aV[t2t_aV.length] = null;
		}
	}
}
function t2t_ExtCallFncs(arg, sFnc)
{
	var b = false;
	for(var i = t2t_aExt.length; i;)
	{--i;
		var fnc = t2t_aExt[i]["On" + sFnc];
		// Call the method the extension has defined for this event
		if(fnc && fnc(arg))
			b = true;
	}
	return b;
}

t2t_Init();
