
//===================  GLOBAL Hint CONFIGURATION  =========================//
config. Hint = false
config. HintImgPath = "images/rollover_effect/"
// Sizes of hint images
config. HintEdgeSize = 10
config. HintStemWidth = 39
config. HintStemHeight = 45


var hint = new tt_Extension();

hint.OnLoadConfig = function()
{
	if(tt_aV[HINT])
	{
		hint.padding = Math.max(tt_aV[PADDING] - tt_aV[HINTEDGESIZE], 0);
		hint.width = tt_aV[WIDTH];
		tt_aV[BORDERWIDTH] = 0;
		tt_aV[WIDTH] = 0;
		tt_aV[PADDING] = 0;
		tt_aV[BGCOLOR] = "";
		tt_aV[BGIMG] = "";
		tt_aV[SHADOW] = false;
		if(tt_aV[HINTIMGPATH].charAt(tt_aV[HINTIMGPATH].length - 1) != '/')
			tt_aV[HINTIMGPATH] += "/";
		return true;
	}
	return false;
};
hint.OnCreateContentString = function()
{
	if(!tt_aV[HINT])
		return false;
		
	var aImg, sImgZ, sCssCrn, sCssImg;

	if(tt_aV[HINTIMGPATH] == config.HintImgPath)
		aImg = hint.aDefImg;
	else
		aImg = Hint_CacheImgs(tt_aV[HINTIMGPATH]);
	sCssCrn = ' style="position:relative;width:' + tt_aV[HINTEDGESIZE] + 'px;padding:0px;margin:0px;overflow:hidden;line-height:0px;"';
	sCssImg = 'padding:0px;margin:0px;border:0px;';
	sImgZ = '" style="' + sCssImg + '" />';
	
	tt_sContent = '<table border="0" cellpadding="5" cellspacing="0" style="width:auto;padding:0px;margin:0px;left:0px;top:0px;"><tr>'
				+ '<td' + sCssCrn + ' valign="bottom">'
				+ '<img src="' + aImg[1].src + '" width="' + tt_aV[HINTEDGESIZE] + '" height="' + tt_aV[HINTEDGESIZE] + sImgZ
				+ '</td>'
				+ '<td valign="bottom" style="position:relative;padding:0px;margin:0px;overflow:hidden;">'
				+ '<img id="bALlOOnT" style="position:relative;top:1px;z-index:1;display:none;' + sCssImg + '" src="' + aImg[9].src + '" width="' + tt_aV[HINTSTEMWIDTH] + '" height="' + tt_aV[HINTSTEMHEIGHT] + '" />'
				+ '<div style="position:relative;z-index:0;padding:0px;margin:0px;overflow:hidden;width:auto;height:' + tt_aV[HINTEDGESIZE] + 'px;background-image:url(' + aImg[2].src + ');">'
				+ '</div>'
				+ '</td>'
				+ '<td' + sCssCrn + ' valign="bottom">'
				+ '<img src="' + aImg[3].src + '" width="' + tt_aV[HINTEDGESIZE] + '" height="' + tt_aV[HINTEDGESIZE] + sImgZ
				+ '</td>'
				+ '</tr><tr>'
				+ '<td style="position:relative;padding:0px;margin:0px;width:' + tt_aV[HINTEDGESIZE] + 'px;overflow:hidden;background-image:url(' + aImg[8].src + ');">'
				+ '<img width="' + tt_aV[HINTEDGESIZE] + '" height="100%" src="' + aImg[8].src + sImgZ
				+ '</td>'
				+ '<td style="position:relative;line-height:normal;'
				+ ';background-image:url(' + aImg[0].src + ')'
				+ ';color:' + tt_aV[FONTCOLOR]
				+ ';font-family:' + tt_aV[FONTFACE]
				+ ';font-size:' + tt_aV[FONTSIZE]
				+ ';font-weight:' + tt_aV[FONTWEIGHT]
				+ ';text-align:' + tt_aV[TEXTALIGN]
				+ ';padding:' + hint.padding
				+ ';width:' + (hint.width ? (hint.width + 'px') : 'auto')
				+ ';">' + tt_sContent + '</td>'
				+ '<td style="position:relative;padding:0px;margin:0px;width:' + tt_aV[HINTEDGESIZE] + 'px;overflow:hidden;background-image:url(' + aImg[4].src + ');">'
				+ '<img width="' + tt_aV[HINTEDGESIZE] + '" height="100%" src="' + aImg[4].src + sImgZ
				+ '</td>'
				+ '</tr><tr>'
				+ '<td valign="top"' + sCssCrn + '>'
				+ '<img src="' + aImg[7].src + '" width="' + tt_aV[HINTEDGESIZE] + '" height="' + tt_aV[HINTEDGESIZE] + sImgZ
				+ '</td>'
				+ '<td valign="top" style="position:relative;padding:0px;margin:0px;overflow:hidden;">'
				+ '<div style="position:relative;left:0px;top:0px;padding:0px;margin:0px;overflow:hidden;width:auto;height:' + tt_aV[HINTEDGESIZE] + 'px;background-image:url(' + aImg[6].src + ');"></div>'
				+ '<img id="bALlOOnB" style="position:relative;top:-1px;left:2px;z-index:1;display:none;' + sCssImg + '" src="' + aImg[10].src + '" width="' + tt_aV[HINTSTEMWIDTH] + '" height="' + tt_aV[HINTSTEMHEIGHT] + '" />'
				+ '</td>'
				+ '<td valign="top"' + sCssCrn + '>'
				+ '<img src="' + aImg[5].src + '" width="' + tt_aV[HINTEDGESIZE] + '" height="' + tt_aV[HINTEDGESIZE] + sImgZ
				+ '</td>'
				+ '</tr></table>';
	return true;
};
hint.OnSubDivsCreated = function()
{
	if(tt_aV[HINT])
	{
		hint.iStem = tt_aV[ABOVE] * 1;
		hint.stem = [tt_GetElt("bALlOOnT"), tt_GetElt("bALlOOnB")];
		hint.stem[hint.iStem].style.display = "inline";
		return true;
	}
	return false;
};
hint.OnMoveAfter = function()
{
	if(tt_aV[HINT])
	{
		var iStem = (tt_aV[ABOVE] != tt_bJmpVert) * 1;

		if(iStem != hint.iStem)
		{
			hint.stem[hint.iStem].style.display = "none";
			hint.stem[iStem].style.display = "inline";
			hint.iStem = iStem;
		}
		
		hint.stem[iStem].style.left = Hint_CalcStemX() + "px";
		return true;
	}
	return false;
};
function Hint_CalcStemX()
{
	var x = tt_musX - tt_x;
	return Math.max(Math.min(x, tt_w - tt_aV[HINTSTEMWIDTH] - (tt_aV[HINTEDGESIZE] << 1) - 2), 2);
}
function Hint_CacheImgs(sPath)
{
	var asImg = ["background", "lt", "t", "rt", "r", "rb", "b", "lb", "l", "stemt", "stemb"],
	n = asImg.length,
	aImg = new Array(n),
	img;

	while(n)
	{--n;
		img = aImg[n] = new Image();
		img.src = sPath + asImg[n] + ".gif";
	}
	return aImg;
}
function Hint_PreCacheDefImgs()
{
	if(config.HintImgPath.charAt(config.HintImgPath.length - 1) != '/')
		config.HintImgPath += "/";
	hint.aDefImg = Hint_CacheImgs(config.HintImgPath);
}
Hint_PreCacheDefImgs();
