//(c) Mihai Kelemen 2010. All Rights Reserved.
//version 1.3

$tooltip=function(obj){var up,left,maxW,maxH,ie,speed,tt,ct,dataType,tt_img_path;ie=window.ActiveXObject?true:false;tt_img_path='assets/';speed=20;$Utils.createE('div','body','','',['id'],['tt']);$Utils.createE('div','tt','','',['id'],['ct']);tt=document.getElementById('tt');ct=document.getElementById('ct');show=function(){dataType=obj.rel?true:false;if(dataType&&(obj.rel.indexOf('-img')!=-1)){ct.innerHTML='<img src="'+tt_img_path+obj.rel.substring(0,obj.rel.length-4)+'.png"/>';}else{ct.style.fontSize=10+'px';ct.style.color="#333";ct.style.backgroundColor="#FFFFCC";ct.style.fontFamily="Verdana, sans-serif";ct.innerHTML=obj.rel||obj.alt;}
tt.style.padding=3+'px';tt.style.border="solid 1px #999";tt.style.backgroundColor="#FFF";tt.style.opacity=0;tt.style.filter='alpha(opacity='+0+')';tt.style.display='block';}()
fadeIn=function(){if(speed===100){clearInterval(i);}
tt.style.filter='alpha(opacity='+speed+')';tt.style.opacity=speed/100;speed++;}
drag=function(ev){up=ie?event.clientY+document.documentElement.scrollTop:ev.pageY;left=ie?event.clientX+document.documentElement.scrollLeft:ev.pageX;maxW=ie?document.body.offsetWidth:window.innerWidth;maxH=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);if((left+tt.offsetWidth)>=(maxW-30)){tt.style.left=left-(tt.offsetWidth+5)+'px';}else{tt.style.left=left+10+'px'}
if(maxH-(up+tt.offsetHeight)>=30){tt.style.top=up+20+'px';}else{tt.style.top=up-(tt.offsetHeight)+'px';}}
hide=function(){try{document.body.removeChild(tt);}catch(e){tt=document.getElementById('tt');document.body.removeChild(tt);}}
var i=setInterval('this.fadeIn()',speed);obj.onmouseout=hide;document.onmousemove=this.drag;}
