//<!--settings
hideIfOpened=1; // скрывать, если раскрыт контент
curNum=0;
//settings -->
function absPosition(obj) {
      var x = y = 0;
      while(obj) {
            x += obj.offsetLeft;
            y += obj.offsetTop;
            obj = obj.offsetParent;
      }
      return {x:x, y:y};
}
//анимация открытия контекста
function slideUp(options){
				var objID=options.objID;
				obj=document.getElementById(objID);
				if(obj.innerHTML=="" || obj.innerHTML==undefined) return false; //заблокировать эффект если мышь переведена на др. иконку
				var startX=options.startX;
				var startY=options.startY;
				var stepBy=options.stepBy!=undefined?options.stepBy:4;
				var speed=options.speed!=undefined?options.speed:3;
				oHeight=obj.offsetHeight;
				oHeight+=stepBy;
				if(oHeight>options.orHeight) oHeight=options.orHeight;
				obj.style.height=oHeight+'px';
				obj.parentNode.style.left=startX;
				obj.parentNode.style.top=(startY-oHeight)+'px';
				obj.style.display="block";
				
			if(options.orHeight>oHeight) setTimeout("slideUp({'objID':'"+options.objID+"','startX':'"+options.startX+"','orHeight':'"+options.orHeight+"','startY':'"+options.startY+"','speed':'"+speed+"'})",speed);
}
//-->

function showHead(oA){
oTT=document.getElementById("toolTip");
	if(curNum!=oA.getAttribute("num") || oTT.style.display=="none"){
		head=oA.getAttribute("head");
		iB=document.getElementById("icon_border");
		iB.style.display='none';
		tTH=document.getElementById("toolTipHead");
		tTH.innerHTML=head;
		
		tTT=document.getElementById("toolTipText")
		tTT.innerHTML="";
		tTT.style.display='none';
		oTT.style.display='none'; // "обнуляем" тултип
		oTT.setAttribute("opened","0");
		tTH.style.height='auto';
		posX=absPosition(oA).x; // поз. Х елемента вызывающего тултип
		posY=absPosition(oA).y; // поз. Y елемента вызывающего тултип
		oTT.style.visibility='hidden';
		oTT.style.display="block";
		oWidth=oTT.offsetWidth;// ширина елемента тултип
		if(oWidth>=250) oTT.style.width='250px';
		else oTT.style.width='auto';
		oHeight=oTT.offsetHeight;
		errorY=0;
		oTT.style.display="none";
		oTT.style.visibility='visible';
		oTT.style.left=posX+'px';
		oTT.style.top=posY-oHeight-errorY+'px'; // здесь вычисления поз. подсказки с учетом показанного хидера
		oTT.style.display='block';
		curNum=oA.getAttribute("num");
	}
}

function showContext(oA){
		text=oA.getAttribute("text"); //text в тч может содержать HTML теги
		oTT=document.getElementById("toolTip");
		tTT=document.getElementById("toolTipText");
		tTT.style.height='auto';//ВНИМАНИЕ! данная опция необходима для динамического обновления высоты контекста. 
		tTT.innerHTML=text;
		posX=absPosition(oA).x; // поз. Х елемента вызывающего тултип
		posY=absPosition(oA).y;
		oTT.setAttribute("opened","1");// установка "не скрывать если контекст раскрыт"
		if(tTT.style.display=="none"){ 
		orHeight=null;
		//вычисление высоты контекста
			tTT.style.visibility='hidden';
			tTT.style.display='block';
			orWidth=tTT.offsetWidth;
			if(orWidth>=250) tTT.style.width='250px';
			else tTT.style.width='auto';
			orHeight=tTT.offsetHeight;
			tTT.style.display="none";
			tTT.style.visibility='visible';
		//-->
		iB=document.getElementById("icon_border");		
		imgH=oA.childNodes.item(0).offsetHeight;
		errorY=22;
		tTH=document.getElementById("toolTipHead");
			//*без анимации
			oTT.style.left=posX+'px';
			oTT.style.top=(posY-orHeight-imgH-tTH.offsetHeight+errorY)+'px';
			iB.style.left=posX+'px';
			iB.style.top=posY+'px';
			iB.style.display="block";
			tTT.style.display="block";
			//*/
			//с анимацией, проверено - багов нет
			//slideUp({"objID":"toolTipText","startX":posX,"startY":posY-oA.offsetHeight-errorY,"orHeight":orHeight,"speed":5});
		}
	return false;
}

function hideTip(obj){

oTT=document.getElementById("toolTip");
if(oTT.getAttribute("opened")!=1 || oTT.getAttribute("opened")==undefined || (hideIfOpened && obj!=undefined)){
	tTT=document.getElementById("toolTipText");
	iB=document.getElementById("icon_border");
	tTT.innerHTML="";
	tTT.style.display='none';
	oTT.style.display='none';
	iB.style.display='none';
}
}

