
function fh_helper_class(tcID,tcClass)
{this.hid=(tcID)?tcID:'form_helper_div';this.className=(tcClass)?tcClass:'';var _fh_hinter=_fh_Create.call(this);var _fh_titles=[];this.marginTop=-5;this.marginLeft=-5;this.hinter_width=300;this.position='b';var __this=this;this.form_runner=function(taTargets)
{if(taTargets.constructor!=Array)
{alert('fh_helper.form_runner\nПолучен не массив!');return false;}
for(var i=0;i<taTargets.length;i++)
{_fh_titles.push(taTargets[i]);var loObj=id(taTargets[i][0]);if(loObj)
{if(addEvent)
{addEvent(loObj,'focus',function(e){_fh_show.call(this,e);});addEvent(loObj,'blur',_fh_hide);}
else
{loObj.onfocus=function(e){_fh_show.call(this,e);};;loObj.onblur=_fh_hide;}}}
return true;}
this.hover_runner=function(taTargets)
{if(taTargets.constructor!=Array)
{alert('fh_helper.hover_runner\nПолучен не массив!');return false;}
for(var i=0;i<taTargets.length;i++)
{_fh_titles.push(taTargets[i]);var loObj=id(taTargets[i][0]);if(loObj)
{if(addEvent)
{addEvent(loObj,'mouseover',function(e){_fh_show.call(this,e);});addEvent(loObj,'mouseout',_fh_hide);}
else
{loObj.onmouseover=function(e){_fh_show.call(this,e);};loObj.onmouseout=_fh_hide;}}}
return true;}
function _fh_show(e)
{e=e||window.event;var loTarget=e.target||e.srcElement;if(loTarget.readOnly||loTarget.disabled)return false;var lcHelp=_fh_getHelp.call(this,loTarget.id);if(lcHelp=='')return false;_fh_hinter.innerHTML=lcHelp;_fh_hinter.style.width=__this.hinter_width+'px';var laPos=_fh_getPos(loTarget);setXY(_fh_hinter,laPos[0],laPos[1]);_fh_hinter.style.display='block';return true;}
function _fh_getPos(toTarget)
{var laPos=KL_getPageOffset(toTarget);var lnLeft=0,lnTop=0;var lnHeight=toTarget.offsetHeight;var lnWidth=toTarget.offsetWidth;switch(__this.position)
{case't':lnTop=laPos[1]-_fh_hinter.offsetHeight-__this.marginTop;lnLeft=laPos[0]+__this.marginLeft;break;case'r':lnTop=laPos[1];lnLeft=laPos[0]+lnWidth+__this.marginLeft;if((lnLeft+__this.hinter_width+__this.marginLeft*3)>=pageWidth())
{var lnMargin=(__this.marginLeft<0)?__this.marginLeft*-1:__this.marginLeft;lnLeft=lnLeft+toTarget.offsetWidth-__this.hinter_width-lnMargin*2;}
break;case"l":var lnTMargin=(__this.marginTop<0)?__this.marginTop*-1:__this.marginTop;lnTop=laPos[1]+lnTMargin;var lnLMargin=(__this.marginLeft<0)?__this.marginLeft*-1:__this.marginLeft;lnLeft=laPos[0]-__this.hinter_width-lnLMargin*2;break;case'b':lnTop=(laPos[1]+lnHeight+__this.marginTop);lnLeft=laPos[0];if((lnLeft+__this.hinter_width+__this.marginLeft*3)>=pageWidth())
{var lnMargin=(__this.marginLeft<0)?__this.marginLeft*-1:__this.marginLeft;lnLeft=lnLeft+toTarget.offsetWidth-__this.hinter_width-lnMargin*2;}
else lnLeft+=__this.marginLeft;}
return[lnLeft,lnTop];}
function _fh_Create()
{var loElem=id(this.hid);if(!loElem)
{loElem=dce('div');loElem.id=this.hid;if(this.className!='')loElem.className=__this.className;dbac(loElem);}
return loElem;}
function _fh_getHelp(tcID)
{for(var i=0;i<_fh_titles.length;i++)if(_fh_titles[i][0]==tcID)return _fh_titles[i][1];return'';}
function _fh_hide(e)
{_fh_hinter.style.display='none';}}
