function hint_box()
{	
	this.prepare=prepare;
	this.createaBox=createaBox;
	this.show=show;
	this.hide=hide;
	this.getEvent=getEvent;
	this.boxLayer=null;
	this.timeObject=null;
	this.className='hint_box';
	this.objectPositionX=true;
	this.objectPositionY=true;
	this.positionX=10;
	this.positionY=10;
	this.inWindow=true;
	function prepare(tag_name,parent)
	{
		if(is_ie()) return false;
		if(!parent) parent=document;
		var _objects=parent.getElementsByTagName(tag_name);
		var this_instance=this;
		for(i=0;_objects.length>i;i++)
		{
			if(this.className=='' || _objects[i].className.indexOf(this.className)!=-1)
			{
				if(is_ie())
				{
					_objects[i].onmousemove=function(){this_instance.show(this,event,eval('t'+i));};
					_objects[i].onmouseout=function(){this_instance.hide();};
				}
				else
				{
					_objects[i].onmousemove=eval('function(event){this_instance.show(this,event,\''+_objects[i].title+'\');};');
					_objects[i].onmouseout=function(){this_instance.hide();};
				}
				_objects[i].title='';
			}
		}
		this.createaBox(parent);
	}
	function createaBox(parent)
	{
		if(!this.boxLayer)
		{
			var d=new Date();
			this.boxLayer=document.createElement('div');
			this.boxLayer.setAttribute('id','hint_box_'+d.getUTCMilliseconds()+d.getUTCSeconds());
			this.boxLayer.setAttribute('className','hint_box_layer');
			this.boxLayer.setAttribute('class','hint_box_layer');
			parent.appendChild(this.boxLayer);
		}
	}
	function show(obj,e,hint)
	{
		clearTimeout(this.timeObject);
		this.boxLayer.style.visibility='hidden';
		var e=getEvent(obj,e);
		this.boxLayer.innerHTML=hint;
		if(this.objectPositionX)
		{
			if((e[0]+this.positionX+this.boxLayer.offsetWidth)>e[6])
			{
				this.boxLayer.style.left=(e[0]-this.positionX-this.boxLayer.offsetWidth)+'px';
			}
			else this.boxLayer.style.left=(e[0]+this.positionX)+'px';
		}
		else
		{
			this.boxLayer.style.left=this.positionX+'px';
		}

		if(this.objectPositionY)
		{
			if((e[1]+this.positionY+this.boxLayer.offsetHeight)>e[7])
			{
				this.boxLayer.style.top=(e[1]-this.positionY-this.boxLayer.offsetHeight)+'px';
			}
			else this.boxLayer.style.top=(e[1]+this.positionY)+'px';
		}
		else
		{
			this.boxLayer.style.marginTop=this.positionY+'px';
		}
		this.boxLayer.style.visibility='visible';
	}
	function hide()
	{
		this.timeObject=setTimeout('document.getElementById(\''+this.boxLayer.id+'\').style.visibility=\'hidden\';',100);
	}
	function is_ie()
	{
		if(navigator.userAgent.indexOf('MSIE')!=-1) return true; else return false;
	}
	function getEvent(obj,e)
	{
		if(is_ie())
		{
			var _v= new Array(e.clientX+document.documentElement.scrollLeft,e.clientY+document.documentElement.scrollTop);
			_v[2]=_v[0]-obj.offsetLeft;
			_v[3]=_v[1]-obj.offsetTop;
			_v[4]=document.documentElement.offsetWidth;
			_v[5]=document.documentElement.offsetHeight;
			_v[6]=document.body.clientWidth;
			_v[7]=document.body.clientHeight;
			return _v;
		}
		else 
		{
			return new Array(e.pageX,e.pageY,e.pageX-obj.offsetLeft,e.pageY-obj.offsetTop,document.documentElement.offsetWidth,window.innerHeight,document.documentElement.offsetWidth,document.documentElement.offsetHeight);
		}
	}
}
