/* beginning of tooltips 
	(C) www.htmlgoodies.com, October 2005
	
	This is a script from www.htmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Updated:	
		March, 11th, 2006 - Fixed positioning of tooltip when displayed near the right edge of the browser.
		April, 6th 2006, Using iframe in IE in order to make the tooltip cover select boxes.
		
    */
	var ttip_tooltip = false;
	var ttip_tooltipShadow = false;
	var ttip_shadowSize = 4;
	var ttip_tooltipMaxWidth = 400;
	var ttip_tooltipMinWidth = 100;
	var ttip_iframe = false;
	var tooltip_is_msie = (navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('opera')==-1 && document.all)?true:false;
	function showTooltip(e,tooltipTxt)
	{
		
		var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;
	
		if(!ttip_tooltip){
			ttip_tooltip = document.createElement('DIV');
			ttip_tooltip.id = 'ttip_tooltip';
			ttip_tooltipShadow = document.createElement('DIV');
			ttip_tooltipShadow.id = 'ttip_tooltipShadow';
			
			document.body.appendChild(ttip_tooltip);
			document.body.appendChild(ttip_tooltipShadow);	
			
			if(tooltip_is_msie){
				ttip_iframe = document.createElement('IFRAME');
				ttip_iframe.frameborder='5';
				ttip_iframe.style.backgroundColor='#FFFFFF';
				ttip_iframe.src = '#'; 	
				ttip_iframe.style.zIndex = 100;
				ttip_iframe.style.position = 'absolute';
				document.body.appendChild(ttip_iframe);
			}
			
		}
		
		ttip_tooltip.style.display='block';
		ttip_tooltipShadow.style.display='block';
		if(tooltip_is_msie)ttip_iframe.style.display='block';
		
		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
		var leftPos = e.clientX + 10;
		
		ttip_tooltip.style.width = null;	// Reset style width if it's set 
		ttip_tooltip.innerHTML = tooltipTxt;
		ttip_tooltip.style.left = leftPos + 'px';
		ttip_tooltip.style.top = e.clientY + 10 + st + 'px';

		
		ttip_tooltipShadow.style.left =  leftPos + ttip_shadowSize + 'px';
		ttip_tooltipShadow.style.top = e.clientY + 10 + st + ttip_shadowSize + 'px';
		
		if(ttip_tooltip.offsetWidth>ttip_tooltipMaxWidth){	/* Exceeding max width of tooltip ? */
			ttip_tooltip.style.width = ttip_tooltipMaxWidth + 'px';
		}
		
		var tooltipWidth = ttip_tooltip.offsetWidth;		
		if(tooltipWidth<ttip_tooltipMinWidth)tooltipWidth = ttip_tooltipMinWidth;
		
		
		ttip_tooltip.style.width = tooltipWidth + 'px';
		ttip_tooltipShadow.style.width = ttip_tooltip.offsetWidth + 'px';
		ttip_tooltipShadow.style.height = ttip_tooltip.offsetHeight + 'px';		
		
		if((leftPos + tooltipWidth)>bodyWidth){
			ttip_tooltip.style.left = (ttip_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth)) + 'px';
			ttip_tooltipShadow.style.left = (ttip_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth) + ttip_shadowSize) + 'px';
		}
		
		if(tooltip_is_msie){
			ttip_iframe.style.left = ttip_tooltip.style.left;
			ttip_iframe.style.top = ttip_tooltip.style.top;
			ttip_iframe.style.width = ttip_tooltip.offsetWidth + 'px';
			ttip_iframe.style.height = ttip_tooltip.offsetHeight + 'px';
		
		}
				
	}
	
	function hideTooltip()
	{
		ttip_tooltip.style.display='none';
		ttip_tooltipShadow.style.display='none';		
		if(tooltip_is_msie)ttip_iframe.style.display='none';		
	}
/* end of ttips */	