/***********************************************
 * Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
 * This notice MUST stay intact for legal use
 * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
 ***********************************************/

	var TipBox = {};
	
	TipBox.Storage = {
		OffSetPoint_X: -60,
		OffSetPoint_Y: 15
	}
	
	TipBox.Settings = {
		IE: document.all,
		NS6 : document.getElementById && !document.all,
		EnableTip: false,
		ContainerId: 'dhtmltooltip'
	}
	
	if (TipBox.Settings.IE || TipBox.Settings.NS6) 
	    var TipElementObj = document.all ? document.all[TipBox.Settings.ContainerId] : document.getElementById ? document.getElementById(TipBox.Settings.ContainerId) : ""
	
	
	
	TipBox.IETrueBody = function(){
	    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
	}
	
	TipBox.RunTip = function(thetext, theCssClass){
		TipBox.AddTipElement();
		TipElementObj = document.getElementById(TipBox.Settings.ContainerId); 
	    if (TipBox.Settings.NS6 || TipBox.Settings.IE) {
	        if (typeof theCssClass != "undefined") 
	            TipElementObj.className = theCssClass
	        TipElementObj.innerHTML = thetext
	        TipBox.Settings.EnableTip = true
	        return false
	    }
	}
	
	TipBox.PositionTip = function(e){
	    if (TipBox.Settings.EnableTip) {
	        var curX = (TipBox.Settings.NS6) ? e.pageX : event.clientX + TipBox.IETrueBody().scrollLeft;
	        var curY = (TipBox.Settings.NS6) ? e.pageY : event.clientY + TipBox.IETrueBody().scrollTop;
	        //Find out how close the mouse is to the corner of the window
	        var rightedge = TipBox.Settings.IE && !window.opera ? TipBox.IETrueBody().clientWidth - event.clientX - TipBox.Storage.OffSetPoint_X : window.innerWidth - e.clientX - TipBox.Storage.OffSetPoint_X - 20
	        var bottomedge = TipBox.Settings.IE && !window.opera ? TipBox.IETrueBody().clientHeight - event.clientY - TipBox.Storage.OffSetPoint_Y : window.innerHeight - e.clientY - TipBox.Storage.OffSetPoint_Y - 20
	        
	        var leftedge = (TipBox.Storage.OffSetPoint_X < 0) ? TipBox.Storage.OffSetPoint_X * (-1) : -1000
	        
	        //if the horizontal distance isn't enough to accomodate the width of the context menu
	        if (rightedge < TipElementObj.offsetWidth) 
	            //move the horizontal position of the menu to the left by it's width
	            TipElementObj.style.left = TipBox.Settings.IE ? TipBox.IETrueBody().scrollLeft + event.clientX - TipElementObj.offsetWidth + "px" : window.pageXOffset + e.clientX - TipElementObj.offsetWidth + "px"
	        else 
	            if (curX < leftedge) 
	                TipElementObj.style.left = "5px"
	            else 
	                //position the horizontal position of the menu where the mouse is positioned
	                TipElementObj.style.left = curX + TipBox.Storage.OffSetPoint_X + "px"
	        
	        //same concept with the vertical position
	        if (bottomedge < TipElementObj.offsetHeight) 
	            TipElementObj.style.top = TipBox.Settings.IE ? TipBox.IETrueBody().scrollTop + event.clientY - TipElementObj.offsetHeight - TipBox.Storage.OffSetPoint_Y + "px" : window.pageYOffset + e.clientY - TipElementObj.offsetHeight - TipBox.Storage.OffSetPoint_Y + "px"
	        else 
	            TipElementObj.style.top = curY + TipBox.Storage.OffSetPoint_Y + "px"
	        TipElementObj.style.visibility = "visible"
	    }
	}
	
	TipBox.HideTip = function(){
	    if (TipBox.Settings.NS6 || TipBox.Settings.IE) {
	        TipBox.Settings.EnableTip = false;
			if(!TipElementObj) return;
	        TipElementObj.style.visibility = "hidden";
	        /*TipElementObj.style.left = "-1000px"*/
	        TipElementObj.className = '';
	    }
	}
	
	
	TipBox.TipByHiddenContentId = function(ElementId, theCssClass, innerCss){
		var ElementData = document.getElementById(ElementId);
		innerStyle = (innerCss) ? innerCss : '';
		if(ElementData){
			HTMLData = "<div class='"+innerStyle+"'>"+ElementData.innerHTML+"</div>";
			TipBox.RunTip(HTMLData, theCssClass);
		}
	}
	
	
	TipBox.AddTipElement = function() {
		var TipElementObj = document.getElementById(TipBox.Settings.ContainerId);
		
		if(!TipElementObj){
			var TipDiv = document.createElement('div');
			TipDiv.setAttribute('id',TipBox.Settings.ContainerId);
			document.body.appendChild(TipDiv);
		}else{
			return;
		}
	}
	
	document.onmousemove = TipBox.PositionTip

