/**
 * Inside ToolTip
 * (c) 2005-2006 Marek Bedkowski <marek@bedkowski.pl>
 *
 * Permission to use, modify, copy and distribute this software
 * for any purpose with or without fee is hereby granted for both
 * non-commercial and commercial use, provided that the above copyright notice
 * and this permission notice appear in all copies. You can use this
 * software in commercial projects after contacting author and
 * buying licence.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
 * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 *
 * Except as contained in this notice, the name of a copyright holder shall
 * not be used in advertising or otherwise to promote the sale, use or other
 * dealings in this Software without prior written authorization of the
 * copyright holder.
 *
 */

_fadeSpeed = .035

/************************************************************************/
/************************************************************************/
/************ DO NOT CHANGE ANYTHING BEYOND THIS LINE *******************/
/************************************************************************/
/************************************************************************/
/************************************************************************/

_s = 'style'; 

_fadeSpeed *= 1000;
// define tooltip properties in here
/**/
document.write( '<'+'style t'+'ype="text/c'+'ss">'+
'#InsideTooltip{'+
'text-align: left; '+
'position: absolute; '+
'padding: 3px; '+
'z-index: 2000; '+
'top:-1000px;'+
'color:#fff;'+
'font:normal 9px Verdana;'+
'border:1px solid #000;'+
'background:#b08500;'+
'width:180px;'+
'opacity:0;'+(_isIE?'filter:alpha(opacity=0)':'-moz-opacity:0')+';'+
'}'+
'</s'+'tyle>' );
/**/

function showInsideTooltip(e,S,T,W, d,E,b ) {
  d=document;E=d.documentElement;b=d.body;if(!E)return;
  //check if hintBox appears somwhere in code
  if( ! ( S.h=document.getElementById( 'InsideTooltip' ) ) ) {
  	//if not create new element
  	S.h=d.createElement('div');
  	//and add some looks
  	S.h.id='InsideTooltip';
  } //here's IE bug fix - if hintBox appears within table tag it won't
  //accept table as inner html, so to preserve user defined formatting we clone node and add it in
  //the beginning of document
 	//do not remove !!!!
	else S.h=S.h.cloneNode(true);
	//if T string was not sent look for title tag and if it's not found give it default string
	S.h.innerHTML = !T ? (S.title?S.title:'&nbsp;value not defined&nbsp;'):unescape( T );
	//set properties essential for div positioning

	// add div to the document
	b.appendChild(S.h);
	
	//add hiding
	S.onmouseout=function(){
		with( this ) {
	  		if(h)b.removeChild( h );
	  		//stop catching mouse position
			onmousemove=h=null;
		}
		return!1;
	}
	
	S.h.visible();
	S.h.fadeIn(40);

	//the heart of the script - enable onmousemove event
	S.onmousemove=function(e,l,t,mX, mY,c,h,w){
		e=e||event;
		mX = e.clientX+( E.scrollLeft || b.scrollLeft)
		mY = e.clientY+( E.scrollTop  || b.scrollTop)

		with( this.h.style ) {
		
			var di=15; friction=.3;
		
			//show div
			c = clientSize();
			l=parseInt(left),	t=parseInt(top),	h=this.h.offsetHeight,	w=this.h.offsetWidth
			if( c[0]-mX-w < di )
				left=(l > mX-di-w?(l+(mX-di-w-l)*friction):mX-di-w)+'px';
			else
				left=(l > mX-di-w && l < mX+di?(l+(mX+di-l)*friction): mX+di)+'px';

			if( c[1]-mY-h < di )
				top=(t>mY-di-h?(t+(mY-di-h-t)*friction):mY-di-h)+'px';
			else
				top=(t>mY-di-h && t < mY+di?(t+(mY+di-t)*friction):mY+di)+'px';
		} return!1;
	}
}