var popupInitialized = 0;
function initializePopup() {
	if (popupInitialized == 0 && document.getElementById("gameThumbnail") != undefined) {
		var newContent = "<table class=\"overlibBG\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr><td><table class=\"overlibFG\" width=\"97%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr><td class=\"overlibText\" id=\"overlibText\" valign=\"top\">";
		newContent += "</td></tr></tbody></table></td></tr></tbody></table>";
		document.getElementById("gameThumbnail").innerHTML = newContent;
		popupInitialized = 1;
	}
}
function overlib(content, event)
{
	initializePopup();
	if (event != undefined) {
		moveThumbnail(event);
	}
	if (document.getElementById("gameThumbnail") != undefined) {
		document.getElementById("gameThumbnail").style.visibility='visible';
		
		content.replace("&lt;","<");
		content.replace("&gt;",">");

		if (document.getElementById("overlibText") != undefined) {
			document.getElementById("overlibText").innerHTML = content;
		}
	}
}

function nd()
{
	if (document.getElementById("gameThumbnail") != undefined) {
		document.getElementById("gameThumbnail").style.visibility='hidden';
	}
}

function moveThumbnail(e)
{
	if (document.getElementById("gameThumbnail") != undefined) {
		
		if (document.all) {
			var popup_width = 213;
		} else {
			var popup_width = 235;
		}
		var popup_height = 150;
		var browser_width = 0;
		var browser_height = 0;
		var pos_hor = 0;
		var pos_ver = 0;
		var scroll_top = 0;
		var scroll_left = 0;
		
		marge=20;
		if(document.all) {
			pos_hor=event.clientX+marge;
			pos_ver=event.clientY+marge;
		} else {
			pos_ver=e.clientY+marge;
			pos_hor=e.clientX+marge;
		}
		
		if (document.documentElement && document.documentElement.scrollTop) {
			scroll_left = document.documentElement.scrollLeft;
			scroll_top = document.documentElement.scrollTop;
		} else if (document.all) {
			scroll_left = document.body.scrollLeft;
			scroll_top = document.body.scrollTop;
		} else {
			scroll_left = pageXOffset;
			scroll_top = pageYOffset;
		}
		
		pos_hor = pos_hor+scroll_left;
		pos_ver = pos_ver+scroll_top;
		
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			browser_width = window.innerWidth;
			browser_height = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			browser_width = document.documentElement.clientWidth;
			browser_height = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			browser_width = document.body.clientWidth;
			browser_height = document.body.clientHeight;
		}

		if ( pos_hor < (browser_width + scroll_left - popup_width) ) {
			document.getElementById("gameThumbnail").style.left=pos_hor+'px';
		} else {
			document.getElementById("gameThumbnail").style.left=(browser_width+scroll_left-popup_width)+'px';
		}
		if ( pos_ver < (browser_height + scroll_top - popup_height) ) {
			document.getElementById("gameThumbnail").style.top=pos_ver+'px';
		} else {
			document.getElementById("gameThumbnail").style.top=(pos_ver-(popup_height+30))+'px';
		}
	}
}