

////////////////  GLOBAL TOOPTIP CONFIGURATION  /////////////////////
var tiBgColor      = "#fffcf4";
var tiBgImg        = "";           // path to background image;
var tiBorderColor  = "#767676";
var tiBorderWidth  = 1;
var tiDelay        = 100;          // time span until tooltip shows up [milliseconds]
var tiFontColor    = "#767676";
var tiFontFace     = "arial,helvetica,sans-serif";
var tiFontSize     = "11px";
var tiFontWeight   = "normal";     // alternative is "bold";
var tiOffsetX      = 12;            // horizontal offset of left-top corner from mousepointer
var tiOffsetY      = 15;           // vertical offset                   "
var tiPadding      = 3;            // spacing between border and content
var tiShadowColor  = "#e3e3e3";
var tiShadowWidth  = 0;
var tiTemp         = 0;            // time span after which the tooltip disappears; 0 (zero) means "infinite timespan"
var tiTextAlign    = "top";
var tiTitleColor   = "#ffffff";    // color of caption text
var tiWidth        = 190;
////////////////////  END OF TOOLTIP CONFIG  ////////////////////////



//////////////  TAGS WITH TOOLTIP FUNCTIONALITY  ////////////////////
// List may be extended or shortened:
var tti_tags = new Array("input","textarea");
/////////////////////////////////////////////////////////////////////



///////// DON'T CHANGE ANYTHING BELOW THIS LINE /////////////////////
var tti_obj,                // current tooltip
tti_objW = 0, tti_objH = 0,  // width and height of tti_obj
tti_objX = 0, tti_objY = 0,
tti_offX = 0, tti_offY = 0,
xlim = 0, ylim = 0,        // right and bottom borders of visible client area
tti_sup = false,            // true if T_ABOVE cmd
tti_sticky = false,         // tti_obj sticky?
tti_wait = false,
tti_vis = false,            // tooltip visibility flag
tti_sub = false,            // true while tooltip below mousepointer
tti_u = "undefined",
tti_inputs = new Array(),   // drop-down-boxes to be hidden in IE
// Opera: disable href when hovering <a>
tti_tag = null;             // stores hovered dom node, href and previous statusbar txt


var tti_db = (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body? document.body : null,
tti_n = navigator.userAgent.toLowerCase();

// Browser flags
var tti_op = !!(window.opera && document.getElementById),
tti_op6 = tti_op && !document.defaultView,
tti_op7 = tti_op && !tti_op6,
tti_ie = tti_n.indexOf("msie") != -1 && document.all && tti_db && !tti_op,
tti_n4 = (document.layers && typeof document.classes != tti_u),
tti_n6 = (!tti_op && document.defaultView && typeof document.defaultView.getComputedStyle != tti_u),
tti_w3c = !tti_ie && !tti_n6 && !tti_op && document.getElementById;

tti_n = "";


function tti_Int(t_x)
{
	var t_y;
	return isNaN(t_y = parseInt(t_x))? 0 : t_y;
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function wzReplace(t_x, t_y)
{
	var t_ret = "",
	t_str = this,
	t_xI;
	while((t_xI = t_str.indexOf(t_x)) != -1)
	{
		t_ret += t_str.substring(0, t_xI) + t_y;
		t_str = t_str.substring(t_xI + t_x.length);
	}
	return t_ret+t_str;
}
String.prototype.wzReplace = wzReplace;

function tti_N4Tags(tagtyp, t_d, t_y)
{
	t_d = t_d || document;
	t_y = t_y || new Array();
	var t_x = (tagtyp=="a")? t_d.links : t_d.layers;
	for(var z = t_x.length; z--;) t_y[t_y.length] = t_x[z];
	for(var z = t_d.layers.length; z--;) t_y = tti_N4Tags(tagtyp, t_d.layers[z].document, t_y);
	return t_y;
}

function tti_GetSelects()
{
	if (!tti_op6 && !tti_ie) return;
	var t_s = tti_op6? "input" : "select";
	if (document.all)
	{
		var t_i = document.all.tags(t_s).length; while(t_i--)
			tti_inputs[t_i] = document.all.tags(t_s)[t_i];
	}
	else if (document.getElementsByTagName)
	{
		var t_i = document.getElementsByTagName(t_s).length; while(t_i--)
			tti_inputs[t_i] = document.getElementsByTagName(t_s)[t_i];
	}
	var t_i = tti_inputs.length; while(t_i--)
	{
		tti_inputs[t_i].x = 0;
		tti_inputs[t_i].y = 0;
		var t_o = tti_inputs[t_i];
		while(t_o)
		{
			tti_inputs[t_i].x += t_o.offsetLeft || 0;
			tti_inputs[t_i].y += t_o.offsetTop|| 0;
			t_o = t_o.offsetParent;
		}
	}
}

function tti_Htm(tt, t_id, txt)
{
	var t_bgc = (typeof tt.T_BGCOLOR != tti_u)? tt.T_BGCOLOR : tiBgColor,
	t_bgimg   = (typeof tt.T_BGIMG != tti_u)? tt.T_BGIMG : tiBgImg,
	t_bc      = (typeof tt.T_BORDERCOLOR != tti_u)? tt.T_BORDERCOLOR : tiBorderColor,
	t_bw      = (typeof tt.T_BORDERWIDTH != tti_u)? tt.T_BORDERWIDTH : tiBorderWidth,
	t_ff      = (typeof tt.T_FONTFACE != tti_u)? tt.T_FONTFACE : tiFontFace,
	t_fc      = (typeof tt.T_FONTCOLOR != tti_u)? tt.T_FONTCOLOR : tiFontColor,
	t_fsz     = (typeof tt.T_FONTSIZE != tti_u)? tt.T_FONTSIZE : tiFontSize,
	t_fwght   = (typeof tt.T_FONTWEIGHT != tti_u)? tt.T_FONTWEIGHT : tiFontWeight,
	t_padd    = (typeof tt.T_PADDING != tti_u)? tt.T_PADDING : tiPadding,
	t_shc     = (typeof tt.T_SHADOWCOLOR != tti_u)? tt.T_SHADOWCOLOR : (tiShadowColor || 0),
	t_shw     = (typeof tt.T_SHADOWWIDTH != tti_u)? tt.T_SHADOWWIDTH : (tiShadowWidth || 0),
	t_algn    = (typeof tt.T_TEXTALIGN != tti_u)? tt.T_TEXTALIGN : tiTextAlign,
	t_tit     = (typeof tt.T_TITLE != tti_u)? tt.T_TITLE : "",
	t_titc    = (typeof tt.T_TITLECOLOR != tti_u)? tt.T_TITLECOLOR : tiTitleColor,
	t_w       = (typeof tt.T_WIDTH != tti_u)? tt.T_WIDTH  : tiWidth;
	if (t_shc || t_shw)
	{
		t_shc = t_shc || "#cccccc";
		t_shw = t_shw || 5;
	}
	if (tti_n4 && (t_fsz == "10px" || t_fsz == "11px")) t_fsz = "12px";


	var t_y = '<div id="'+t_id+'" style="position:absolute;z-index:9999;';
	t_y += 'left:0px;top:0px;width:'+(t_w+t_shw)+'px;visibility:'+(tti_n4? 'hide' : 'hidden')+';">' +
		'<table border="0" cellpadding="0" cellspacing="0"'+(t_bc? (' bgcolor="'+t_bc+'"') : '')+' width="'+t_w+'"  >';
	if (t_tit)
	{
		t_y += '<tr><td style="padding-left:3px;padding-right:3px;" align="'+t_algn+'"><font color="'+t_titc+'" face="'+t_ff+'" ' +
			'style="color:'+t_titc+';font-family:'+t_ff+';font-size:'+t_fsz+';"><b>' +
			(tti_n4? '&nbsp;' : '')+t_tit+'<\/b><\/font><\/td><\/tr>';
	}
	t_y += '<tr><td><table border="0" cellpadding="'+t_padd+'" cellspacing="'+t_bw+'" width="100%"  >' +
		'<tr><td'+(t_bgc? (' bgcolor="'+t_bgc+'"') : '')+(t_bgimg? ' background="'+t_bgimg+'"' : '');
	if (tti_n6) t_y += ' style="padding:'+t_padd+'px;"';
	t_y += ' align="'+t_algn+'"><font color="'+t_fc+'" face="'+t_ff+'"' +
		' style="color:'+t_fc+';font-family:'+t_ff+';font-size:'+t_fsz+';font-weight:'+t_fwght+';">';
	if (t_fwght == 'bold') t_y += '<b>';
	t_y += txt;
	if (t_fwght == 'bold') t_y += '<\/b>';
	t_y += '<\/font><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	if (t_shw)
	{
		var t_spct = Math.round(t_shw*1.3);
		if (tti_n4)
		{
			t_y += '<layer bgcolor="'+t_shc+'" left="'+t_w+'" top="'+t_spct+'" width="'+t_shw+'" height="0"><\/layer>' +
				'<layer bgcolor="'+t_shc+'" left="'+t_spct+'" align="bottom" width="'+(t_w-t_spct)+'" height="'+t_shw+'"><\/layer>';
		}
		else
		{
			var t_opa = tti_n6? '-moz-opacity:0.85;' : tti_ie? 'filter:Alpha(opacity=85);' : '';
			t_y += '<div id="'+t_id+'R" style="position:absolute;background:'+t_shc+';left:'+t_w+'px;top:'+t_spct+'px;width:'+t_shw+'px;height:1px;overflow:hidden;'+t_opa+'"><\/div>' +
				'<div style="position:relative;background:'+t_shc+';left:'+t_spct+'px;top:0px;width:'+(t_w-t_spct)+'px;height:'+t_shw+'px;overflow:hidden;'+t_opa+'"><\/div>';
		}
	}
	t_y += '<\/div>';
	return t_y;
}

function tti_Init()
{
	if (!(tti_op || tti_n4 || tti_n6 || tti_ie || tti_w3c)) return;

	var htm = tti_n4? '<div style="position:absolute;"><\/div>' : '',
	tags,
	t_tj,
	over,
	esc = 'return escape(';
	var i = tti_tags.length; while(i--)
	{
		tags = tti_ie? (document.all.tags(tti_tags[i]) || 1)
			: document.getElementsByTagName? (document.getElementsByTagName(tti_tags[i]) || 1)
			: (!tti_n4 && tti_tags[i]=="a")? document.links
			: 1;
		if (tti_n4 && (tti_tags[i] == "a" || tti_tags[i] == "layer")) tags = tti_N4Tags(tti_tags[i]);
		var j = tags.length; while(j--)
		{
			if (typeof (t_tj = tags[j]).onfocus == "function" && t_tj.onfocus.toString().indexOf(esc) != -1 && !tti_n6 || tti_n6 && (over = t_tj.getAttribute("onfocus")) && over.indexOf(esc) != -1)
			{
				if (over) t_tj.onfocus = new Function(over);
				var txt = unescape(t_tj.onfocus());
				htm += tti_Htm(
					t_tj,
					"tOoLtIp"+i+""+j,
					txt.wzReplace("& ","&")
				);

				t_tj.onfocus = new Function('e',
					'tti_Show(this,'+
					'"tOoLtIp' +i+''+j+ '",'+
					(typeof t_tj.T_ABOVE != tti_u)+','+
					((typeof t_tj.T_DELAY != tti_u)? t_tj.T_DELAY : tiDelay)+','+
					((typeof t_tj.T_FIX != tti_u)? '"'+t_tj.T_FIX+'"' : '""')+','+
					(typeof t_tj.T_LEFT != tti_u)+','+
					((typeof t_tj.T_OFFSETX != tti_u)? t_tj.T_OFFSETX : tiOffsetX)+','+
					((typeof t_tj.T_OFFSETY != tti_u)? t_tj.T_OFFSETY : tiOffsetY)+','+
					(typeof t_tj.T_STATIC != tti_u)+','+
					(typeof t_tj.T_STICKY != tti_u)+','+
					((typeof t_tj.T_TEMP != tti_u)? t_tj.T_TEMP : tiTemp)+
					');'
				);
				t_tj.onblur = tti_Hide;
				if (t_tj.alt) t_tj.alt = "";
				if (t_tj.title) t_tj.title = "";
			}
		}
	}
	document.write(htm);
}



function tti_HideInput()
{
	if (!(tti_ie || tti_op6) || !tti_inputs) return;
	var t_o;
	var t_i = tti_inputs.length; while(t_i--)
	{
		t_o = tti_inputs[t_i];
		if (tti_vis && tti_objX+tti_objW > t_o.x && tti_objX < t_o.x+t_o.offsetWidth && tti_objY+tti_objH > t_o.y && tti_objY < t_o.y+t_o.offsetHeight)
			t_o.style.visibility = 'hidden';
		else t_o.style.visibility = 'visible';
	}
}

function tti_GetDiv(t_id)
{
	return(
		tti_n4? (document.layers[t_id] || null)
		: tti_ie? (document.all[t_id] || null)
		: (document.getElementById(t_id) || null)
	);
}

function tti_GetDivW(obj)
{
  obj = obj || tti_obj;
	return tti_Int(
		tti_n4? obj.clip.width
		: obj.style.pixelWidth? obj.style.pixelWidth
		: obj.offsetWidth
	);
}

function tti_GetDivH()
{
	return tti_Int(
		tti_n4? tti_obj.clip.height
		: tti_obj.style.pixelHeight? tti_obj.style.pixelHeight
		: tti_obj.offsetHeight
	);
}

// Compat with DragDrop Lib: Ensure that z-index of tooltip is lifted beyond toplevel dragdrop element
function tti_SetDivZ()
{
	var t_i = tti_obj.style || tti_obj;
	if (window.dd && dd.z)
		t_i.zIndex = Math.max(dd.z+1, t_i.zIndex);
}

function tti_SetDivPos(t_x, t_y)
{
	var t_i = tti_obj.style || tti_obj;
	var t_px = (tti_op6 || tti_n4)? '' : 'px';
	t_i.left = (tti_objX = t_x) + t_px;
	t_i.top = (tti_objY = t_y) + t_px;
	tti_HideInput();
	tti_CheckBottom();
}
var tti_check=false;
function tti_CheckBottom()
{
 if (tti_check) return;
 tti_check = true;
 var t_o = tti_GetDiv('bottomrow');
 if (t_o)
 {
    var t_oY = findPosY(t_o);
    var t_offset = (tti_objY+tti_objH) - t_oY;
    if (t_offset > 0 )
     tti_SetDivPos(tti_objX,tti_objY-t_offset);
 }
 tti_check = false;
}

function tti_ShowDiv(t_x)
{
	if (tti_n4) tti_obj.visibility = t_x? 'show' : 'hide';
	else tti_obj.style.visibility = t_x? 'visible' : 'hidden';
	tti_vis = t_x;
	iesf(tti_obj, t_x);
	tti_HideInput();
}

function tti_Show(t_inp, t_id, t_sup, t_delay, t_fix, t_left, t_offx, t_offy, t_static, t_sticky, t_temp)
{
	if (tti_obj) tti_Hide();
	tti_obj = tti_GetDiv(t_id);
	if (tti_obj)
	{
		tti_sub = !(tti_sup = t_sup);
		tti_sticky = t_sticky;
		tti_objW = tti_GetDivW();
		tti_objH = tti_GetDivH();
		tti_offX = t_left? -(tti_objW+t_offx) : t_offx;
		tti_offY = t_offy;
		if (tti_n4)
		{
			if (tti_obj.document.layers.length)
			{
				var t_sh = tti_obj.document.layers[0];
				t_sh.clip.height = tti_objH - Math.round(t_sh.clip.width*1.3);
			}
		}
		else
		{
			var t_sh = tti_GetDiv(t_id+'R');
			if (t_sh)
			{
				var t_h = tti_objH - tti_Int(t_sh.style.pixelTop || t_sh.style.top || 0);
				if (typeof t_sh.style.pixelHeight != tti_u) t_sh.style.pixelHeight = t_h;
				else t_sh.style.height = t_h+'px';
			}
		}

		tti_GetSelects();

		xlim = tti_Int((tti_db && tti_db.clientWidth)? tti_db.clientWidth : window.innerWidth) +
			tti_Int(window.pageXOffset || (tti_db? tti_db.scrollLeft : 0) || 0) -
			tti_objW -
			(tti_n4? 21 : 0);
		ylim = tti_Int(window.innerHeight || tti_db.clientHeight) +
			tti_Int(window.pageYOffset || (tti_db? tti_db.scrollTop : 0) || 0) -
			tti_objH - tti_offY;

		tti_SetDivZ();
		if (t_inp)
		{		  
		  tti_SetDivPos(findPosX(t_inp)+tti_GetDivW(t_inp)+20, findPosY(t_inp));
    }

		var t_txt = 'tti_ShowDiv(\'true\');';
		if (t_temp > 0) t_txt += 'window.tti_rtm = window.setTimeout(\'tti_sticky = false; tti_Hide();\','+t_temp+');';
		window.tti_rdl = window.setTimeout(t_txt, t_delay);

	
	}
}

function tti_Hide()
{
	if (window.tti_obj)
	{
		if (window.tti_rdl) window.clearTimeout(tti_rdl);
		if (!tti_sticky || !tti_vis)
		{
			if (window.tti_rtm) window.clearTimeout(tti_rtm);
			tti_ShowDiv(false);
			tti_SetDivPos(-tti_objW, -tti_objH);
			tti_obj = null;
			if (typeof window.tti_upFunc != tti_u) document.onmouseup = window.tti_upFunc;
		}
		tti_sticky = false;
		tti_HideInput();
	}
}

function iesf(show_obj, show)
{
	if (menushow && show) 
	{
		iesf1(show_obj, false)
		iesf1(show_obj, true)
	}
	else iesf1(show_obj, show)
}
	
function iesf1(show_obj, show)
{
	if (menushow && show) show = false;//return;
	//alert("show "+show);
	menushow = show;
	if (show_obj.canHaveHTML)
	{
		fuid = show_obj.id+'_iesf';
		if (show)
		{
			document.body.insertAdjacentHTML("afterBegin","<iframe scrolling=no id='"+fuid+"'style='position:absolute; top:0; left:0; visibility:hidden; z-index:1;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);' ></iframe>");
			(wobj =document.getElementById(fuid).style).left = show_obj.offsetLeft;wobj.top = show_obj.offsetTop;wobj.width = show_obj.offsetWidth;wobj.height = show_obj.offsetHeight;wobj.visibility = 'visible';
		} else document.getElementById(fuid).removeNode(true);
	}
}

menushow = false;

tti_Init();

