// |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 
// Coded by Travis Beckham
// http://www.squidfingers.com | http://www.podlob.com
// If want to use this code, feel free to do so, but please leave this message intact.
// If you do remove this, I will hunt you down :)
//
// |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

var startHTML = '<p id="tiptext">';
var endHTML   = '<\/p>';
var xOffset   = 20;
var yOffset   = -20;

/* #FFFFFF #E5E5E5 */
var colorarray = new Array("#e1e1cd", "#e1e1cd", "#CCCCCC", "#B2B2B2", "#999999", "#7F7F7F", "#666666", "#4C4C4C", "#333333", "#191919", "#000000");
var timearray = new Array(0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000);

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

var w3c = (document.getElementById) ?true:false;
var ie = (document.all) ?true:false;
var supported = (w3c || ie) ?true:false;

var active = false;
for(var i=0; i<colorarray.length; i++){
	this["fade"+i] = null;
}

function mousemoved(evt){
	if(ie){
		mx  = window.event.clientX+document.body.scrollLeft;
		my  = window.event.clientY+document.body.scrollTop;
	}
	else if (w3c){
		mx  = evt.pageX+window.pageXOffset;
		my  = evt.pageY+window.pageYOffset;
	}
	if(active){
		obj = getStyle("tooltip");
		obj.left = mx+xOffset;
		obj.top  = my+yOffset;
	}
}
function getStyle(objstr){
	return (ie) ? document.all[objstr].style : document.getElementById(objstr).style;
}
function getObj(objstr){
	return (ie) ? document.all[objstr] : document.getElementById(objstr);
}
function show(msg){
	if(!supported){return false;}
	getObj("tooltip").innerHTML = startHTML+msg+endHTML;
	getStyle("tooltip").visibility = "visible";
	
	var objstr;
	for(var i=0; i<colorarray.length; i++){
		if(ie){
			objstr = "document.all.tiptext.style.color='"+colorarray[i]+"';";
		}
		else if(w3c){
			objstr = "document.getElementById('tiptext').style.color='"+colorarray[i]+"';";
		}
		this["fade"+i] = setTimeout(objstr, timearray[i]);
	}
	active = true;
}
function hide(){
	if(!supported){return false;}
	getStyle("tooltip").visibility = "hidden";
	for(var i=0; i<colorarray.length; i++){
		if(this["fade"+i]){
			clearTimeout(this["fade"+i]);
		}
	}
	active = false;
}
if(supported){
	document.onmousemove = mousemoved;
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

