/* 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 configured
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 config1 = new Object();


//===================  GLOBAL TOOPTIP CONFIGURATION  =========================//
var  btt_Debug	= true		// false or true - recommended: false once you release your page to the public
var  btt_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 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)"

config1. Above			= false 	// false or true - tooltip above mousepointer?
config1. BgColor 		= '#FF901D' // Background color
config1. BgImg			= ''		// Path to background image, none if empty string ''
config1. BorderColor 	= '#EF4800'
config1. BorderStyle 	= 'solid'	// Any permitted CSS value, but I recommend 'solid', 'dotted' or 'dashed'
config1. BorderWidth 	= 1
config1. CenterMouse 	= false 	// false or true - center the tip horizontally below (or above) the mousepointer
config1. ClickClose		= false 	// false or true - close tooltip if the user clicks somewhere
config1. CloseBtn		= false 	// false or true - closebutton in titlebar
config1. CloseBtnColors	= ['#990000', '#FFFFFF', '#DD3333', '#FFFFFF']	  // [Background, text, hovered background, hovered text] - use empty strings '' to inherit title colors
config1. CloseBtnText	= '&nbsp;X&nbsp;'	// Close button text (may also be an image tag)
config1. CopyContent		= false		// When converting a HTML element to a tooltip, copy only the element's content, rather than converting the element by its own
config1. Delay			= 400		// Time span in ms until tooltip shows up
config1. Duration		= 0 		// Time span in ms after which the tooltip disappears; 0 for infinite duration
config1. FadeIn			= 400 		// Fade-in duration in ms, e.g. 400; 0 for no animation
config1. FadeOut 		= 400
config1. FadeInterval	= 30		// Duration of each fade step in ms (recommended: 30) - shorter is smoother but causes more CPU-load
config1. Fix 			= null		// Fixated position - x- an y-oordinates in brackets, e.g. [210, 480], or null for no fixation
config1. FollowMouse		= true		// false or true - tooltip follows the mouse
config1. FontColor		= '#000000'
config1. FontFace		= 'Verdana,Geneva,sans-serif'
config1. FontSize		= '10pt' 	// E.g. '9pt' or '12px' - unit is mandatory
config1. FontWeight		= 'normal'	// 'normal' or 'bold';
config1. Left			= false 	// false or true - tooltip on the left of the mouse
config1. OffsetX 		= 14		// Horizontal offset of left-top corner from mousepointer
config1. OffsetY 		= 8 		// Vertical offset
config1. Opacity 		= 100		// Integer between 0 and 100 - opacity of tooltip in percent
config1. Padding 		= 3 		// Spacing between border and content
config1. Shadow			= false 	// false or true
config1. ShadowColor 	= '#C0C0C0'
config1. ShadowWidth 	= 5
config1. Sticky			= false 	// Do NOT hide tooltip on mouseout? false or true
config1. TextAlign		= 'left'	// 'left', 'right' or 'justify'
config1. Title			= ''		// Default title text applied to all tips (no default title: empty string '')
config1. TitleAlign		= 'left'	// 'left' or 'right' - text alignment inside the title bar
config1. TitleBgColor	= ''		// If empty string '', BorderColor will be used
config1. TitleFontColor	= ''	// Color of title text - if '', BgColor (of tooltip body) will be used
config1. TitleFontFace	= ''		// If '' use FontFace (boldified)
config1. TitleFontSize	= ''		// If '' use FontSize
config1. Width			= 300 		// Tooltip width; 0 for automatic adaption to tooltip content
//=======  END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW  ==============//




//======================  PUBLIC  ============================================//
function Beta()
{
	Betatt_Tip(arguments, null);
}
function BetaTagToTip()
{
	if(TagsToTip)
	{
		var bbt2t = btt_GetElt(arguments[0]);
		if(bbt2t)
			Betatt_Tip(arguments, bbt2t);
	}
}

//==================  PUBLIC EXTENSION API	==================================//
// Extension eventhandlers currently supported:
// OnLoadConfig, OnCreateContentString, OnSubDivsCreated, OnShow, OnMoveBefore,
// OnMoveAfter, OnHideInit, OnHide, OnKill

var btt_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
btt_aV = new Array(),	// Caches and enumerates config data for currently active tooltip
btt_sContent,			// Inner tooltip text or HTML
btt_scrlX = 0, btt_scrlY = 0,
btt_musX, btt_musY,
btt_over,
btt_x, btt_y, btt_w, btt_h; // Position, width and height of currently displayed tooltip

function btt_Extension()
{
	btt_ExtCmdEnum();
	btt_aExt[btt_aExt.length] = this;
	return this;
}
function btt_SetTipPos(x, y)
{
	var css = btt_aElt[0].style;

	btt_x = x;
	btt_y = y;
	css.left = x + "px";
	css.top = y + "px";
	if(btt_ie56)
	{
		var ifrm = btt_aElt[btt_aElt.length - 1];
		if(ifrm)
		{
			ifrm.style.left = css.left;
			ifrm.style.top = css.top;
		}
	}
}
function btt_Hide()
{
	if(btt_db && btt_iState)
	{
		if(btt_iState & 0x2)
		{
			btt_aElt[0].style.visibility = "hidden";
			btt_ExtCallFncs(0, "Hide");
		}
		btt_tShow.EndTimer();
		btt_tHide.EndTimer();
		btt_tDurt.EndTimer();
		btt_tFade.EndTimer();
		if(!btt_op && !btt_ie)
		{
			btt_tWaitMov.EndTimer();
			btt_bWait = false;
		}
		if(btt_aV[CLICKCLOSE])
			btt_RemEvtFnc(document, "mouseup", btt_HideInit);
		btt_AddRemOutFnc(false);
		btt_ExtCallFncs(0, "Kill");
		// In case of a TagToTip tooltip, hide converted DOM node and
		// re-insert it into document
		if(btt_bbt2t && !btt_aV[COPYCONTENT])
		{
			btt_bbt2t.style.display = "none";
			btt_MovDomNode(btt_bbt2t, btt_aElt[6], btt_bbt2tDad);
		}
		btt_iState = 0;
		btt_over = null;
		btt_ResetMainDiv();
		if(btt_aElt[btt_aElt.length - 1])
			btt_aElt[btt_aElt.length - 1].style.display = "none";
	}
}
function btt_GetElt(id)
{
	return(document.getElementById ? document.getElementById(id)
			: document.all ? document.all[id]
			: null);
}
function btt_GetDivW(el)
{
	return(el ? (el.offsetWidth || el.style.pixelWidth || 0) : 0);
}
function btt_GetDivH(el)
{
	return(el ? (el.offsetHeight || el.style.pixelHeight || 0) : 0);
}
function btt_GetScrollX()
{
	return(window.pageXOffset || (btt_db ? (btt_db.scrollLeft || 0) : 0));
}
function btt_GetScrollY()
{
	return(window.pageYOffset || (btt_db ? (btt_db.scrollTop || 0) : 0));
}
function btt_GetClientW()
{
	return(document.body && (typeof(document.body.clientWidth) != btt_u) ? document.body.clientWidth
			: (typeof(window.innerWidth) != btt_u) ? window.innerWidth
			: btt_db ? (btt_db.clientWidth || 0)
			: 0);
}
function btt_GetClientH()
{
	// Exactly this order seems to yield correct values in all major browsers
	return(document.body && (typeof(document.body.clientHeight) != btt_u) ? document.body.clientHeight
			: (typeof(window.innerHeight) != btt_u) ? window.innerHeight
			: btt_db ? (btt_db.clientHeight || 0)
			: 0);
}
function btt_GetEvtX(e)
{
	return (e ? ((typeof(e.pageX) != btt_u) ? e.pageX : (e.clientX + btt_scrlX)) : 0);
}
function btt_GetEvtY(e)
{
	return (e ? ((typeof(e.pageY) != btt_u) ? e.pageY : (e.clientY + btt_scrlY)) : 0);
}
function btt_AddEvtFnc(el, sEvt, PFnc)
{
	if(el)
	{
		if(el.addEventListener)
			el.addEventListener(sEvt, PFnc, false);
		else
			el.attachEvent("on" + sEvt, PFnc);
	}
}
function btt_RemEvtFnc(el, sEvt, PFnc)
{
	if(el)
	{
		if(el.removeEventListener)
			el.removeEventListener(sEvt, PFnc, false);
		else
			el.detachEvent("on" + sEvt, PFnc);
	}
}

//======================  PRIVATE  ===========================================//
var btt_aExt = new Array(),	// Array of extension objects

btt_db, btt_op, btt_ie, btt_ie56, btt_bBoxOld,	// Browser flags
btt_body,
btt_flagOpa, 			// Opacity support: 1=IE, 2=Khtml, 3=KHTML, 4=Moz, 5=W3C
btt_maxPosX, btt_maxPosY,
btt_iState = 0,			// Tooltip active |= 1, shown |= 2, move with mouse |= 4
btt_opa, 				// Currently applied opacity
btt_bJmpVert,			// Tip above mouse (or ABOVE tip below mouse)
btt_bbt2t, btt_bbt2tDad,		// Tag converted to tip, and its parent element in the document
btt_elDeHref,			// The tag from which Opera has removed the href attribute
// Timer
btt_tShow = new Number(0), btt_tHide = new Number(0), btt_tDurt = new Number(0),
btt_tFade = new Number(0), btt_tWaitMov = new Number(0),
btt_bWait = false,
btt_u = "undefined";


function btt_Init()
{
	btt_MkCmdEnum();
	// Send old browsers instantly to hell
	if(!btt_Browser() || !btt_MkMainDiv())
		return;
	btt_IsW3cBox();
	btt_OpaSupport();
	btt_AddEvtFnc(document, "mousemove", btt_Move);
	// 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 || btt_Debug)
		btt_SetOnloadFnc();
	btt_AddEvtFnc(window, "scroll",
		function()
		{
			btt_scrlX = btt_GetScrollX();
			btt_scrlY = btt_GetScrollY();
			if(btt_iState && !(btt_aV[STICKY] && (btt_iState & 2)))
				btt_HideInit();
		} );
	// Ensure the tip be hidden when the page unloads
	btt_AddEvtFnc(window, "unload", btt_Hide);
	btt_Hide();
}
// Creates command names by translating config variable names to upper case
function btt_MkCmdEnum()
{
	var n = 0;
	for(var i in config1)
		eval("window." + i.toString().toUpperCase() + " = " + n++);
	btt_aV.length = n;
}
function btt_Browser()
{
	var n, nv, n6, w3c;

	n = navigator.userAgent.toLowerCase(),
	nv = navigator.appVersion;
	btt_op = (document.defaultView && typeof(eval("w" + "indow" + "." + "o" + "p" + "er" + "a")) != btt_u);
	btt_ie = n.indexOf("msie") != -1 && document.all && !btt_op;
	if(btt_ie)
	{
		var ieOld = (!document.compatMode || document.compatMode == "BackCompat");
		btt_db = !ieOld ? document.documentElement : (document.body || null);
		if(btt_db)
			btt_ie56 = parseFloat(nv.substring(nv.indexOf("MSIE") + 5)) >= 5.5
					&& typeof document.body.style.maxHeight == btt_u;
	}
	else
	{
		btt_db = document.documentElement || document.body ||
				(document.getElementsByTagName ? document.getElementsByTagName("body")[0]
				: null);
		if(!btt_op)
		{
			n6 = document.defaultView && typeof document.defaultView.getComputedStyle != btt_u;
			w3c = !n6 && document.getElementById;
		}
	}
	btt_body = (document.getElementsByTagName ? document.getElementsByTagName("body")[0]
				: (document.body || null));
	if(btt_ie || n6 || btt_op || w3c)
	{
		if(btt_body && btt_db)
		{
			if(document.attachEvent || document.addEventListener)
				return true;
		}
		else
			btt_Err("wz_tooltip.js must be included INSIDE the body section,"
					+ " immediately after the opening <body> tag.");
	}
	btt_db = null;
	return false;
}
function btt_MkMainDiv()
{
	// Create the tooltip DIV
	if(btt_body.insertAdjacentHTML)
		btt_body.insertAdjacentHTML("afterBegin", btt_MkMainDivHtm());
	else if(typeof btt_body.innerHTML != btt_u && document.createElement && btt_body.appendChild)
		btt_body.appendChild(btt_MkMainDivDom());
	// FireFox Alzheimer bug
	if(window.btt_GetMainDivRefs && btt_GetMainDivRefs())
		return true;
	btt_db = null;
	return false;
}
function btt_MkMainDivHtm()
{
	return('<div id="WzTtDiV"></div>' +
			(btt_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 btt_MkMainDivDom()
{
	var el = document.createElement("div");
	if(el)
		el.id = "WzTtDiV";
	return el;
}
function btt_GetMainDivRefs()
{
	btt_aElt[0] = btt_GetElt("WzTtDiV");
	if(btt_ie56 && btt_aElt[0])
	{
		btt_aElt[btt_aElt.length - 1] = btt_GetElt("WzTtIfRm");
		if(!btt_aElt[btt_aElt.length - 1])
			btt_aElt[0] = null;
	}
	if(btt_aElt[0])
	{
		var css = btt_aElt[0].style;

		css.visibility = "hidden";
		css.position = "absolute";
		css.overflow = "hidden";
		return true;
	}
	return false;
}
function btt_ResetMainDiv()
{
	var w = (window.screen && screen.width) ? screen.width : 10000;

	btt_SetTipPos(-w, 0);
	btt_aElt[0].innerHTML = "";
	btt_aElt[0].style.width = (w - 1) + "px";
}
function btt_IsW3cBox()
{
	var css = btt_aElt[0].style;

	css.padding = "10px";
	css.width = "40px";
	btt_bBoxOld = (btt_GetDivW(btt_aElt[0]) == 40);
	css.padding = "0px";
	btt_ResetMainDiv();
}
function btt_OpaSupport()
{
	var css = btt_body.style;

	btt_flagOpa = (typeof(css.filter) != btt_u) ? 1
				: (typeof(css.KhtmlOpacity) != btt_u) ? 2
				: (typeof(css.KHTMLOpacity) != btt_u) ? 3
				: (typeof(css.MozOpacity) != btt_u) ? 4
				: (typeof(css.opacity) != btt_u) ? 5
				: 0;
}
// Ported from http://dean.edwards.name/weblog/2006/06/again/
// (Dean Edwards et al.)
function btt_SetOnloadFnc()
{
	btt_AddEvtFnc(document, "DOMContentLoaded", btt_HideSrcTags);
	btt_AddEvtFnc(window, "load", btt_HideSrcTags);
	if(btt_body.attachEvent)
		btt_body.attachEvent("onreadystatechange",
			function() {
				if(btt_body.readyState == "complete")
					btt_HideSrcTags();
			} );
	if(/WebKit|KHTML/i.test(navigator.userAgent))
	{
		var t = setInterval(function() {
					if(/loaded|complete/.test(document.readyState))
					{
						clearInterval(t);
						btt_HideSrcTags();
					}
				}, 10);
	}
}
function btt_HideSrcTags()
{
	if(!window.btt_HideSrcTags || window.btt_HideSrcTags.done)
		return;
	window.btt_HideSrcTags.done = true;
	if(!btt_HideSrcTagsRecurs(btt_body))
		btt_Err("To enable the capability to convert HTML elements to tooltips,"
				+ " you must set TagsToTip in the global tooltip configuration"
				+ " to true.");
}
function btt_HideSrcTagsRecurs(dad)
{
	var a, ovr, asbbt2t;

	// 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(!btt_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 && asbt2t.length)
			{
				if(!btt_HideSrcTag(asbt2t[0]))
					return false;
			}
		}
	}
	return true;
}
function btt_HideSrcTag(sbt2t)
{
	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 = sbt2t.replace(/.+'([^'.]+)'.+/, "$1");
	el = btt_GetElt(id);
	if(el)
	{
		if(btt_Debug && !TagsToTip)
			return false;
		else
			el.style.display = "none";
	}
	else
		btt_Err("Invalid ID\n'" + id + "'\npassed to TagToTip()."
				+ " There exists no HTML element with that ID.");
	return true;
}
function Betatt_Tip(arg, bt2t)
{
	if(!btt_db)
		return;
	if(btt_iState)
		btt_Hide();
	if(!btt_Enabled)
		return;
	btt_bt2t = bt2t;
	if(!btt_ReadCmds(arg))
		return;
	btt_iState = 0x1 | 0x4;
	btt_AdaptConfig1();
	btt_MkTipContent(arg);
	btt_MkTipSubDivs();
	btt_FormatTip();
	btt_bJmpVert = false;
	btt_maxPosX = btt_GetClientW() + btt_scrlX - btt_w - 1;
	btt_maxPosY = btt_GetClientH() + btt_scrlY - btt_h - 1;
	btt_AdaptConfig2();
	// We must fake the first mousemove in order to ensure the tip
	// be immediately shown and positioned
	btt_Move();
	btt_ShowInit();
}
function btt_ReadCmds(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 config1)
		btt_aV[i++] = config1[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)
			btt_aV[a[i - 1]] = a[i];
		return true;
	}
	btt_Err("Incorrect call of Tip() or TagToTip().\n"
			+ "Each command must be followed by a value.");
	return false;
}
function btt_AdaptConfig1()
{
	btt_ExtCallFncs(0, "LoadConfig");
	// Inherit unspecified title formattings from body
	if(!btt_aV[TITLEBGCOLOR].length)
		btt_aV[TITLEBGCOLOR] = btt_aV[BORDERCOLOR];
	if(!btt_aV[TITLEFONTCOLOR].length)
		btt_aV[TITLEFONTCOLOR] = btt_aV[BGCOLOR];
	if(!btt_aV[TITLEFONTFACE].length)
		btt_aV[TITLEFONTFACE] = btt_aV[FONTFACE];
	if(!btt_aV[TITLEFONTSIZE].length)
		btt_aV[TITLEFONTSIZE] = btt_aV[FONTSIZE];
	if(btt_aV[CLOSEBTN])
	{
		// Use title colors for non-specified closebutton colors
		if(!btt_aV[CLOSEBTNCOLORS])
			btt_aV[CLOSEBTNCOLORS] = new Array("", "", "", "");
		for(var i = 4; i;)
		{--i;
			if(!btt_aV[CLOSEBTNCOLORS][i].length)
				btt_aV[CLOSEBTNCOLORS][i] = (i & 1) ? btt_aV[TITLEFONTCOLOR] : btt_aV[TITLEBGCOLOR];
		}
		// Enforce titlebar be shown
		if(!btt_aV[TITLE].length)
			btt_aV[TITLE] = " ";
	}
	// Circumvents broken display of images and fade-in flicker in Geckos < 1.8
	if(btt_aV[OPACITY] == 100 && typeof btt_aElt[0].style.MozOpacity != btt_u && !Array.every)
		btt_aV[OPACITY] = 99;
	// Smartly shorten the delay for fade-in tooltips
	if(btt_aV[FADEIN] && btt_flagOpa && btt_aV[DELAY] > 100)
		btt_aV[DELAY] = Math.max(btt_aV[DELAY] - btt_aV[FADEIN], 100);
}
function btt_AdaptConfig2()
{
	if(btt_aV[CENTERMOUSE])
		btt_aV[OFFSETX] -= ((btt_w - (btt_aV[SHADOW] ? btt_aV[SHADOWWIDTH] : 0)) >> 1);
}
// Expose content globally so extensions can modify it
function btt_MkTipContent(a)
{
	if(btt_bt2t)
	{
		if(btt_aV[COPYCONTENT])
			btt_sContent = btt_bt2t.innerHTML;
		else
			btt_sContent = "";
	}
	else
		btt_sContent = a[0];
	btt_ExtCallFncs(0, "CreateContentString");
}
function btt_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 ';

	btt_aElt[0].innerHTML =
		(''
		+ (btt_aV[TITLE].length ?
			('<div id="WzTiTl" style="position:relative;z-index:1;">'
			+ '<table id="WzTiTlTb"' + sTbTrTd + 'id="WzTiTlI" style="' + sCss + '">'
			+ btt_aV[TITLE]
			+ '</td>'
			+ (btt_aV[CLOSEBTN] ?
				('<td align="right" style="' + sCss
				+ 'text-align:right;">'
				+ '<span id="WzClOsE" style="padding-left:2px;padding-right:2px;'
				+ 'cursor:' + (btt_ie ? 'hand' : 'pointer')
				+ ';" onmouseover="btt_OnCloseBtnOver(1)" onmouseout="btt_OnCloseBtnOver(0)" onclick="btt_HideInit()">'
				+ btt_aV[CLOSEBTNTEXT]
				+ '</span></td>')
				: '')
			+ '</tr></tbody></table></div>')
			: '')
		+ '<div id="WzBoDy" style="position:relative;z-index:0;">'
		+ '<table' + sTbTrTd + 'id="WzBoDyI" style="' + sCss + '">'
		+ btt_sContent
		+ '</td></tr></tbody></table></div>'
		+ (btt_aV[SHADOW]
			? ('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>'
				+ '<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>')
			: '')
		);
	btt_GetSubDivRefs();
	// Convert DOM node to tip
	if(btt_bt2t && !btt_aV[COPYCONTENT])
	{
		// Store the tag's parent element so we can restore that DOM branch
		// once the tooltip is hidden
		btt_bt2tDad = btt_bt2t.parentNode || btt_bt2t.parentElement || btt_bt2t.offsetParent || null;
		if(btt_bt2tDad)
		{
			btt_MovDomNode(btt_bt2t, btt_bt2tDad, btt_aElt[6]);
			btt_bt2t.style.display = "block";
		}
	}
	btt_ExtCallFncs(0, "SubDivsCreated");
}
function btt_GetSubDivRefs()
{
	var aId = new Array("WzTiTl", "WzTiTlTb", "WzTiTlI", "WzClOsE", "WzBoDy", "WzBoDyI", "WzTtShDwB", "WzTtShDwR");

	for(var i = aId.length; i; --i)
		btt_aElt[i] = btt_GetElt(aId[i - 1]);
}
function btt_FormatTip()
{
	var css, w, iOffY, iOffSh;

	//--------- Title DIV ----------
	if(btt_aV[TITLE].length)
	{
		css = btt_aElt[1].style;
		css.background = btt_aV[TITLEBGCOLOR];
		css.paddingTop = (btt_aV[CLOSEBTN] ? 2 : 0) + "px";
		css.paddingBottom = "1px";
		css.paddingLeft = css.paddingRight = btt_aV[PADDING] + "px";
		css = btt_aElt[3].style;
		css.color = btt_aV[TITLEFONTCOLOR];
		css.fontFamily = btt_aV[TITLEFONTFACE];
		css.fontSize = btt_aV[TITLEFONTSIZE];
		css.fontWeight = "bold";
		css.textAlign = btt_aV[TITLEALIGN];
		// Close button DIV
		if(btt_aElt[4])
		{
			css.paddingRight = (btt_aV[PADDING] << 1) + "px";
			css = btt_aElt[4].style;
			css.background = btt_aV[CLOSEBTNCOLORS][0];
			css.color = btt_aV[CLOSEBTNCOLORS][1];
			css.fontFamily = btt_aV[TITLEFONTFACE];
			css.fontSize = btt_aV[TITLEFONTSIZE];
			css.fontWeight = "bold";
		}
		if(btt_aV[WIDTH] > 0)
			btt_w = btt_aV[WIDTH] + ((btt_aV[PADDING] + btt_aV[BORDERWIDTH]) << 1);
		else
		{
			btt_w = btt_GetDivW(btt_aElt[3]) + btt_GetDivW(btt_aElt[4]);
			// Some spacing between title DIV and closebutton
			if(btt_aElt[4])
				btt_w += btt_aV[PADDING];
		}
		// Ensure the top border of the body DIV be covered by the title DIV
		iOffY = -btt_aV[BORDERWIDTH];
	}
	else
	{
		btt_w = 0;
		iOffY = 0;
	}

	//-------- Body DIV ------------
	css = btt_aElt[5].style;
	css.top = iOffY + "px";
	if(btt_aV[BORDERWIDTH])
	{
		css.borderColor = btt_aV[BORDERCOLOR];
		css.borderStyle = btt_aV[BORDERSTYLE];
		css.borderWidth = btt_aV[BORDERWIDTH] + "px";
	}
	if(btt_aV[BGCOLOR].length)
		css.background = btt_aV[BGCOLOR];
	if(btt_aV[BGIMG].length)
		css.backgroundImage = "url(" + btt_aV[BGIMG] + ")";
	css.padding = btt_aV[PADDING] + "px";
	css.textAlign = btt_aV[TEXTALIGN];
	// TD inside body DIV
	css = btt_aElt[6].style;
	css.color = btt_aV[FONTCOLOR];
	css.fontFamily = btt_aV[FONTFACE];
	css.fontSize = btt_aV[FONTSIZE];
	css.fontWeight = btt_aV[FONTWEIGHT];
	css.background = "";
	css.textAlign = btt_aV[TEXTALIGN];
	if(btt_aV[WIDTH] > 0)
		w = btt_aV[WIDTH] + ((btt_aV[PADDING] + btt_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 = btt_GetDivW(btt_aElt[6]) + ((btt_aV[PADDING] + btt_aV[BORDERWIDTH]) << 1);
	if(w > btt_w)
		btt_w = w;

	//--------- Shadow DIVs ------------
	if(btt_aV[SHADOW])
	{
		btt_w += btt_aV[SHADOWWIDTH];
		iOffSh = Math.floor((btt_aV[SHADOWWIDTH] * 4) / 3);
		// Bottom shadow
		css = btt_aElt[7].style;
		css.top = iOffY + "px";
		css.left = iOffSh + "px";
		css.width = (btt_w - iOffSh - btt_aV[SHADOWWIDTH]) + "px";
		css.height = btt_aV[SHADOWWIDTH] + "px";
		css.background = btt_aV[SHADOWCOLOR];
		// Right shadow
		css = btt_aElt[8].style;
		css.top = iOffSh + "px";
		css.left = (btt_w - btt_aV[SHADOWWIDTH]) + "px";
		css.width = btt_aV[SHADOWWIDTH] + "px";
		css.background = btt_aV[SHADOWCOLOR];
	}
	else
		iOffSh = 0;

	//-------- Container DIV -------
	btt_SetTipOpa(btt_aV[FADEIN] ? 0 : btt_aV[OPACITY]);
	btt_FixSize(iOffY, iOffSh);
}
// Fixate the size so it can't dynamically change while the tooltip is moving.
function btt_FixSize(iOffY, iOffSh)
{
	var wIn, wOut, i;

	btt_aElt[0].style.width = btt_w + "px";
	btt_aElt[0].style.pixelWidth = btt_w;
	wOut = btt_w - ((btt_aV[SHADOW]) ? btt_aV[SHADOWWIDTH] : 0);
	// Body
	wIn = wOut;
	if(!btt_bBoxOld)
		wIn -= ((btt_aV[PADDING] + btt_aV[BORDERWIDTH]) << 1);
	btt_aElt[5].style.width = wIn + "px";
	// Title
	if(btt_aElt[1])
	{
		wIn = wOut - (btt_aV[PADDING] << 1);
		if(!btt_bBoxOld)
			wOut = wIn;
		btt_aElt[1].style.width = wOut + "px";
		btt_aElt[2].style.width = wIn + "px";
	}
	btt_h = btt_GetDivH(btt_aElt[0]) + iOffY;
	// Right shadow
	if(btt_aElt[8])
		btt_aElt[8].style.height = (btt_h - iOffSh) + "px";
	i = btt_aElt.length - 1;
	if(btt_aElt[i])
	{
		btt_aElt[i].style.width = btt_w + "px";
		btt_aElt[i].style.height = btt_h + "px";
	}
}
function btt_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;)
			btt_DeAlt(aKid[--i]);
	}
}
// This hack removes the annoying native tooltips over links in Opera
function btt_OpDeHref(el)
{
	if(!btt_op)
		return;
	if(btt_elDeHref)
		btt_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";
			btt_AddEvtFnc(el, "mousedown", btt_OpReHref);
			window.status = el.t_href;
			btt_elDeHref = el;
			break;
		}
		el = el.parentElement;
	}
}
function btt_ShowInit()
{
	btt_tShow.Timer("btt_Show()", btt_aV[DELAY], true);
	if(btt_aV[CLICKCLOSE])
		btt_AddEvtFnc(document, "mouseup", btt_HideInit);
}
function btt_OverInit(e)
{
	btt_over = e.target || e.srcElement;
	btt_DeAlt(btt_over);
	btt_OpDeHref(btt_over);
	btt_AddRemOutFnc(true);
}
function btt_Show()
{
	var css = btt_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(btt_aV[STICKY] || !btt_aV[FOLLOWMOUSE])
		btt_iState &= ~0x4;
	if(btt_aV[DURATION] > 0)
		btt_tDurt.Timer("btt_HideInit()", btt_aV[DURATION], true);
	btt_ExtCallFncs(0, "Show")
	css.visibility = "visible";
	btt_iState |= 0x2;
	if(btt_aV[FADEIN])
		btt_Fade(0, 0, btt_aV[OPACITY], Math.round(btt_aV[FADEIN] / btt_aV[FADEINTERVAL]));
	btt_ShowIfrm();
}
function btt_ShowIfrm()
{
	if(btt_ie56)
	{
		var ifrm = btt_aElt[btt_aElt.length - 1];
		if(ifrm)
		{
			var css = ifrm.style;
			css.zIndex = btt_aElt[0].style.zIndex - 1;
			css.display = "block";
		}
	}
}
function btt_Move(e)
{
	e = window.event || e;
	if(e)
	{
		btt_musX = btt_GetEvtX(e);
		btt_musY = btt_GetEvtY(e);
	}
	if(btt_iState)
	{
		if(!btt_over && e)
			btt_OverInit(e);
		if(btt_iState & 0x4)
		{
			// Protect some browsers against jam of mousemove events
			if(!btt_op && !btt_ie)
			{
				if(btt_bWait)
					return;
				btt_bWait = true;
				btt_tWaitMov.Timer("btt_bWait = false;", 1, true);
			}
			if(btt_aV[FIX])
			{
				btt_iState &= ~0x4;
				btt_SetTipPos(btt_aV[FIX][0], btt_aV[FIX][1]);
			}
			else if(!btt_ExtCallFncs(e, "MoveBefore"))
				btt_SetTipPos(btt_PosX(), btt_PosY());
			btt_ExtCallFncs([btt_musX, btt_musY], "MoveAfter")
		}
	}
}
function btt_PosX()
{
	var x;

	x = btt_musX;
	if(btt_aV[LEFT])
		x -= btt_w + btt_aV[OFFSETX] - (btt_aV[SHADOW] ? btt_aV[SHADOWWIDTH] : 0);
	else
		x += btt_aV[OFFSETX];
	// Prevent tip from extending past right/left clientarea boundary
	if(x > btt_maxPosX)
		x = btt_maxPosX;
	return((x < btt_scrlX) ? btt_scrlX : x);
}
function btt_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(btt_aV[ABOVE] && (!btt_bJmpVert || btt_CalcPosYAbove() >= btt_scrlY + 16))
		y = btt_DoPosYAbove();
	else if(!btt_aV[ABOVE] && btt_bJmpVert && btt_CalcPosYBelow() > btt_maxPosY - 16)
		y = btt_DoPosYAbove();
	else
		y = btt_DoPosYBelow();
	// Snap to other side of mouse if tip would extend past window boundary
	if(y > btt_maxPosY)
		y = btt_DoPosYAbove();
	if(y < btt_scrlY)
		y = btt_DoPosYBelow();
	return y;
}
function btt_DoPosYBelow()
{
	btt_bJmpVert = btt_aV[ABOVE];
	return btt_CalcPosYBelow();
}
function btt_DoPosYAbove()
{
	btt_bJmpVert = !btt_aV[ABOVE];
	return btt_CalcPosYAbove();
}
function btt_CalcPosYBelow()
{
	return(btt_musY + btt_aV[OFFSETY]);
}
function btt_CalcPosYAbove()
{
	var dy = btt_aV[OFFSETY] - (btt_aV[SHADOW] ? btt_aV[SHADOWWIDTH] : 0);
	if(btt_aV[OFFSETY] > 0 && dy <= 0)
		dy = 1;
	return(btt_musY - btt_h - dy);
}
function btt_OnOut()
{
	btt_AddRemOutFnc(false);
	if(!(btt_aV[STICKY] && (btt_iState & 0x2)))
		btt_HideInit();
}
function btt_HideInit()
{
	btt_ExtCallFncs(0, "HideInit");
	btt_iState &= ~0x4;
	if(btt_flagOpa && btt_aV[FADEOUT])
	{
		btt_tFade.EndTimer();
		if(btt_opa)
		{
			var n = Math.round(btt_aV[FADEOUT] / (btt_aV[FADEINTERVAL] * (btt_aV[OPACITY] / btt_opa)));
			btt_Fade(btt_opa, btt_opa, 0, n);
			return;
		}
	}
	btt_tHide.Timer("btt_Hide();", 1, false);
}
function btt_OpReHref()
{
	if(btt_elDeHref)
	{
		btt_elDeHref.setAttribute("href", btt_elDeHref.t_href);
		btt_RemEvtFnc(btt_elDeHref, "mousedown", btt_OpReHref);
		window.status = btt_elDeHref.t_stats;
		btt_elDeHref = null;
	}
}
function btt_Fade(a, now, z, n)
{
	if(n)
	{
		now += Math.round((z - now) / n);
		if((z > a) ? (now >= z) : (now <= z))
			now = z;
		else
			btt_tFade.Timer("btt_Fade("
							+ a + "," + now + "," + z + "," + (n - 1)
							+ ")",
							btt_aV[FADEINTERVAL],
							true);
	}
	now ? btt_SetTipOpa(now) : btt_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 btt_SetTipOpa(opa)
{
	btt_SetOpa(btt_aElt[5].style, opa);
	if(btt_aElt[1])
		btt_SetOpa(btt_aElt[1].style, opa);
	if(btt_aV[SHADOW])
	{
		opa = Math.round(opa * 0.8);
		btt_SetOpa(btt_aElt[7].style, opa);
		btt_SetOpa(btt_aElt[8].style, opa);
	}
}
function btt_OnCloseBtnOver(iOver)
{
	var css = btt_aElt[4].style;

	iOver <<= 1;
	css.background = btt_aV[CLOSEBTNCOLORS][iOver];
	css.color = btt_aV[CLOSEBTNCOLORS][iOver + 1];
}
function btt_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 btt_AddRemOutFnc(bAdd)
{
	var PSet = bAdd ? btt_AddEvtFnc : btt_RemEvtFnc;

	if(bAdd != btt_AddRemOutFnc.bOn)
	{
		PSet(btt_over, "mouseout", btt_OnOut);
		btt_AddRemOutFnc.bOn = bAdd;
		if(!bAdd)
			btt_OpReHref();
	}
}
btt_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 btt_SetOpa(css, opa)
{
	btt_opa = opa;
	if(btt_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(btt_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 btt_MovDomNode(el, dadFrom, dadTo)
{
	if(dadFrom)
		dadFrom.removeChild(el);
	if(dadTo)
		dadTo.appendChild(el);
}
function btt_Err(sErr)
{
	if(btt_Debug)
		alert("Tooltip Script Error Message:\n\n" + sErr);
}

//===========  DEALING WITH EXTENSIONS	==============//
function btt_ExtCmdEnum()
{
	var s;

	// Add new command(s) to the commands enum
	for(var i in config1)
	{
		s = "window." + i.toString().toUpperCase();
		if(eval("typeof(" + s + ") == btt_u"))
		{
			eval(s + " = " + btt_aV.length);
			btt_aV[btt_aV.length] = null;
		}
	}
}
function btt_ExtCallFncs(arg, sFnc)
{
	var b = false;
	for(var i = btt_aExt.length; i;)
	{--i;
		var fnc = btt_aExt[i]["On" + sFnc];
		// Call the method the extension has defined for this event
		if(fnc && fnc(arg))
			b = true;
	}
	return b;
}

btt_Init();
