	function showNPCTooltip(npcid, evt) {
		var xmlHttp;
		var tooltip;
		var link;
	
		var my = mouseY(evt);
		var mx = mouseX(evt);
			
		// calulate positions before the event object dies.
		
		// check to see if there is a div named AEATooltip, if not, create it
		tooltip = document.getElementById('AEATooltip');
		if (!tooltip) {
			//alert('cant find tooltip');
			return false;
		} else {
			//alert('Got AEATooltip div element');
		}
		// populate the tooltip
		
		xmlHttp = getHTTP();
		if (!xmlHttp) {
		} else {
			xmlHttp.onreadystatechange = function() {
				if (xmlHttp.readyState == 4) {
					// alert(xmlHttp.responseText);
					tooltip.innerHTML = xmlHttp.responseText;
	
					var wp = pw(); 
					ds = tooltip.style;
					st = ds.visibility; 
					if (tooltip.offsetWidth) 
						ew = tooltip.offsetWidth; 
					else if (tooltip.clip.width) 
						ew = tooltip.clip.width; 
					if (st == "visible" || st == "show") { 
						ds.visibility = "hidden"; 
					} else {
						tv = my + 20; 
						lv = mx - (ew/4); 
						if (lv < 2) 
							lv = 2; 
						else if (lv + ew > wp) 
							lv -= ew/2; 
						lv += 'px';
						tv += 'px';  
						ds.left = lv; 
						ds.top = tv; 
						ds.visibility = "visible";		
					}
				}
			}
	
			xmlHttp.open('GET','gettooltip.asp?NPCID=' + npcid,true);
			xmlHttp.send(null);			
		}

	}
	
	function showTip(itemid, evt) {
		var xmlHttp;
		var tooltip;
		var link;
	
		var my = mouseY(evt);
		var mx = mouseX(evt);
			
		// calulate positions before the event object dies.
		
		// check to see if there is a div named AEATooltip, if not, create it
		tooltip = document.getElementById('AEATooltip');
		if (!tooltip) {
			//alert('cant find tooltip');
			return false;
		} else {
			//alert('Got AEATooltip div element');
		}
		// populate the tooltip
		
		xmlHttp = getHTTP();
		if (!xmlHttp) {
		} else {
			xmlHttp.onreadystatechange = function() {
				if (xmlHttp.readyState == 4) {
					// alert(xmlHttp.responseText);
					tooltip.innerHTML = xmlHttp.responseText;
	
					var wp = pw(); 
					ds = tooltip.style;
					st = ds.visibility; 
					if (tooltip.offsetWidth) 
						ew = tooltip.offsetWidth; 
					else if (tooltip.clip.width) 
						ew = tooltip.clip.width; 
					if (st == "visible" || st == "show") { 
						ds.visibility = "hidden"; 
					} else {
						tv = my + 20; 
						lv = mx - (ew/4); 
						if (lv < 2) 
							lv = 2; 
						else if (lv + ew > wp) 
							lv -= ew/2; 
						lv += 'px';
						tv += 'px';  
						ds.left = lv; 
						ds.top = tv; 
						ds.visibility = "visible";		
					}
				}
			}
	
			xmlHttp.open('GET','gettooltip.asp?ItemID=' + itemid,true);
			xmlHttp.send(null);			
		}
	}
	
	function hideTip() {
		// hide the tooltip
		var tooltip;
		
		tooltip = document.getElementById('AEATooltip');
		if (!tooltip) {
		} else {
			//alert('hiding tooltip');
			ds = tooltip.style;
			ds.visibility = "hidden";
		}
	}
	
	function onPageLoad() {
	
	}
	
	function getHTTP() {
		var xmlHttp;
		
		try {
			xmlHttp = new XMLHttpRequest();
		} catch(e) {
			try {
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
					xmlHttp = new ActiveXObject("Microsoft.HTMLHTTP");
				} catch(e) {
					return false;
				}
			}
		}
		
		return xmlHttp;
	}
	
	function mouseX(evt) {
		return evt.clientX ? evt.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : evt.pageX;
	} 
	
	function mouseY(evt) {
		return evt.clientY ? evt.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : evt.pageY
	} 
	
	function pw() {
		return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
	}
	
	function init() {
		var tooltip = document.getElementById('AEATooltip');
		if (!tooltip) {
			//alert('Creating AEATooltip div');
			
			link = document.createElement('link');
			link.type = 'text/css';
			link.href = 'http://aeauction.com/tooltip.css';
			link.rel = 'stylesheet';
			document.documentElement.getElementsByTagName("HEAD")[0].appendChild(link);
			
			tooltip = document.createElement('div');
			tooltip.className = 'AEATooltipClass';
			tooltip.id = 'AEATooltip';
			document.body.appendChild(tooltip);
		}	
	}

	window.onload = init;
