var mouse_x, mouse_y;
window.onload = init;
function init() {
	if (window.Event) {
		document.captureEvents(Event.MOUSEMOVE);
	}
	document.onmousemove = getXY;
	var obj = document.getElementById('tourney_info');
	if (obj) {
		obj.SP = function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
	}
}

function getXY(e) {
	mouse_x = (window.Event) ? e.pageX : event.clientX;
	mouse_y = (window.Event) ? e.pageY : event.clientY;
}

function hideInfo()
{
	var obj = document.getElementById('tourney_info');
	if (obj) {
		obj.style.display = 'none';
	}
}

function assign(el, val) {
	var obj = document.getElementById(el);
	if (obj) {
		obj.innerHTML = val;
	}
}
function showInfo(league_name, game_date, game_time, site_name, buy_in, stakes, type)
{
	if (parseInt(navigator.appVersion) > 3) {
		var obj = document.getElementById('tourney_info');
		if (obj) {
			assign('tourney_name', league_name);
			assign('tourney_date', game_date);
			assign('tourney_time', game_time);
			assign('tourney_site', site_name);
			assign('tourney_buy_in', buy_in);
			assign('tourney_game_limit', stakes);
			assign('tourney_game_name', type);
			
			if (navigator.appName=="Netscape") {
				winW = window.innerWidth;
				winH = window.innerHeight;
			}
			if (navigator.appName.indexOf("Microsoft")!=-1) {
				winW = document.body.offsetWidth;
				winH = document.body.offsetHeight;
			}
			tab = document.getElementById('tourney_popup');
			
			var width = parseInt(tab.width);
			
			var s = '';
			var i = 0;
			for (v in obj) {
				s = s + ' ' + v;
				i++;
				if (i > 3) {
					s += '\n';
					i = 0;
				}
			}
			var x;
			if (mouse_x + 30 + width > winW) {
				x = mouse_x - width - 30;
			}
			else {
				x = mouse_x + 30;
			}
			obj.style.top = mouse_y + "px";
			obj.style.left = x + "px";
			obj.style.display = 'inline';
		}
	}
}

