	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, September 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/
function showToolTip(e,text) {

	if(document.all) e = event;

	// Set all of the vars
	var bt_obj = document.getElementById('bubble_tooltip');
	var bt_obj2 = document.getElementById('bubble_tooltip_content');
	var bt_objTop = document.getElementById('bubble_tooltip_top');
	var bt_objMiddle = document.getElementById('bubble_tooltip_middle');
	var bt_objBottom = document.getElementById('bubble_tooltip_bottom');

	bt_obj2.innerHTML = text;
	bt_obj.style.display = 'block';
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	
	// Get the initial top and lefts
	var leftPos = e.clientX - 100;
	var topPos = e.clientY - bt_obj.offsetHeight - 5;
	
	// Check to see if the left pos is too small (need to flip it)
	if(leftPos < 0) {
		
		// reset the left to 0
		leftPos = 0;
		
		// Check if its off the page top wise (need to flip top to bottom)
		if (topPos <= 0) {
			
			// Reset the top pos
			topPos = e.clientY + 10 + st;
			bt_objTop.className = 'ul_top';
			bt_objMiddle.className = 'middle_flip';
			bt_objBottom.className = 'ul_bottom';
			
		} else {
			
			// Reset the top pos again
			topPos = topPos + st - 5;
			bt_objTop.className = 'll_top';
			bt_objMiddle.className = 'middle_flip';
			bt_objBottom.className = 'll_bottom';
			
		} // end else
	
	// Otherwise, its normal
	} else {
		
		// Check if its off the page top wise (need to flip top to bottom)
		if (topPos <= 0) {
			
			// Reset the top pos
			topPos = e.clientY + 10 + st;
			bt_objTop.className = 'ur_top';
			bt_objMiddle.className = 'middle';
			bt_objBottom.className = 'ur_bottom';
			
		} else {
			
			// Reset the top pos again
			topPos = topPos + st - 5;
			bt_objTop.className = 'lr_top';
			bt_objMiddle.className = 'middle';
			bt_objBottom.className = 'lr_bottom';
			
		} // end else
		
	} // end else
		
	// Reposition the div
	bt_obj.style.left = leftPos + 'px';
	bt_obj.style.top =  topPos + 'px';
	
}	

function hideToolTip()
{
	document.getElementById('bubble_tooltip').style.display = 'none';
	
}

function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}

function tableToolTips() {
	var cellDataArray = getElementsByClassName(document, 'span', 'tableCellData');
	for(var i=0;i<cellDataArray.length;i++) {
		var currentCellObj = cellDataArray[i];
		
		currentCellObj.onmousemove = function( e ) {
			showToolTip(e, this.getAttribute('title'));
			return false;
		}
		currentCellObj.onmouseout = function() { hideToolTip(); }
			
	}//end for
}//end function