/**
* MyToolTip 
* author: Roman Matena (www.romanmatena.cz)
* (c) 2008
* inspired by Bubble Tooltips by Alessandro Fulciniti, BoxOver By Oliver Bryant with help of Matthew Tagg and Mootols tips
* Must be set css classname .ToolTip.
**/
var MyToolTip={tipBox:null,LSE:null,LBE:null,CBE:null,fixSelects:false,mouseOffset:{x:10,y:10},boxMove:false,init:function(){if(!document.getElementById||!document.getElementsByTagName)return false;var a=document.createElement("div");a.className="ToolTip";a.style.position="absolute";a.style.visibility="hidden";document.body.appendChild(a);MyToolTip.tipBox=a},hide:function(e){MyToolTip.tipBox.style.visibility='hidden'},showSelects:function(){var a=document.getElementsByTagName("select");for(i=0;i<a.length;i++){a[i].style.visibility='visible'}},hideSelects:function(){var a=document.getElementsByTagName("select");for(i=0;i<a.length;i++){a[i].style.visibility='hidden'}},checkToolTipElement:function(a){if(!a||typeof(a)!='string')return false;if((a.indexOf('header')>-1)&&(a.indexOf('body')>-1)&&(a.indexOf('[')>-1)&&(a.indexOf('[')>-1))return true;else return false},getParam:function(a,b){var c=new RegExp('([^a-zA-Z]'+a+'|^'+a+')\\s*=\\s*\\[\\s*(((\\[\\[)|(\\]\\])|([^\\]\\[]))*)\\s*\\]');var d=c.exec(b);var e;if(d)return d[2].replace('[[','[').replace(']]',']');else return''},left:function(a){var x=0;if(a.calcLeft)return a.calcLeft;var b=a;while(a){if((a.currentStyle)&&(!isNaN(parseInt(a.currentStyle.borderLeftWidth)))&&(x!=0))x+=parseInt(a.currentStyle.borderLeftWidth);x+=a.offsetLeft;a=a.offsetParent}b.calcLeft=x;return x},top:function(a){var x=0;if(a.calcTop)return a.calcTop;var b=a;while(a){if((a.currentStyle)&&(!isNaN(parseInt(a.currentStyle.borderTopWidth)))&&(x!=0))x+=parseInt(a.currentStyle.borderTopWidth);x+=a.offsetTop;a=a.offsetParent}b.calcTop=x;return x},moveMouse:function(e){var a;e?a=e:a=event;el=a.target?a.target:a.srcElement;if(!el.tooltip&&el.title){if(MyToolTip.checkToolTipElement(el.title))el.tooltip='<div class="HDR">&raquo;&nbsp;'+MyToolTip.getParam('header',el.title)+'</div><div class="BDY">'+MyToolTip.getParam('body',el.title)+'</div>';else el.tooltip='<div class="BDY">'+el.title+'</div>';el.title=''}if(el!=MyToolTip.LSE){if(el&&el.tooltip){MyToolTip.LBE=MyToolTip.CBE;MyToolTip.CBE=el;if(MyToolTip.CBE!=MyToolTip.LBE){MyToolTip.tipBox.innerHTML=MyToolTip.CBE.tooltip;MyToolTip.tipBox.style.visibility='visible';if(MyToolTip.fixSelects)MyToolTip.hideSelects();MyToolTip.boxMove=true}}else if(MyToolTip.boxMove){if(el.tagName!='TABLE'){MyToolTip.CBE=null;MyToolTip.hide();if(MyToolTip.fixSelects)MyToolTip.showSelects()}}MyToolTip.LSE=el}if(MyToolTip.boxMove&&MyToolTip.CBE){var b=document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;var c=document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;var d=a.pageX?a.pageX-c:a.clientX-document.body.clientLeft;var f=a.pageY?a.pageY-b:a.clientY-document.body.clientTop;var g=MyToolTip.docW();var h=MyToolTip.docH();var i=c+d+MyToolTip.mouseOffset.x;var j=b+f+MyToolTip.mouseOffset.y;var k=MyToolTip.tipBox.offsetWidth;var l=MyToolTip.tipBox.offsetHeight;MyToolTip.tipBox.style.left=d+k>g?i-(k+MyToolTip.mouseOffset.x)+"px":i+"px";MyToolTip.tipBox.style.top=f+l>h?j-(l+MyToolTip.mouseOffset.y)+"px":j+"px";window.status="mouseY:"+f+"mY:"+j+"--sT:"+MyToolTip.tipBox.style.top+"--tW:"+k+"--tH:"+l+"--bW:"+g+"--bH:"+h}},docW:function(){if(window.innerWidth)return window.innerWidth;else if(document.documentElement&&document.documentElement.clientWidth)return document.documentElement.clientWidth;else if(document.body&&document.body.clientWidth)return document.body.clientWidth;else return null},docH:function(){if(window.innerHeight)return window.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)return document.documentElement.clientHeight;else if(document.body&&document.body.clientHeight)return document.body.clientHeight;else return null}};if(typeof(document.attachEvent)!='undefined'){window.attachEvent('onload',MyToolTip.init);document.attachEvent('onmousemove',MyToolTip.moveMouse)}else{window.addEventListener('load',MyToolTip.init,false);document.addEventListener('mousemove',MyToolTip.moveMouse,false)}
