// JavaScript Document
document.write('<div id="divReview" style="background: #32251F; visibility: hidden; position: absolute; width: 235px; left: 344px; top: 210px; z-index: 101;"></div>');

//显示浮动信息窗口
function Face_MouseOver(a, id, event)
{
	//获取event对象的兼容写法，兼容FF和IE
	var evt = window.event?window.event:event;

	var addX = +20;
	var addY = -30;
	var mouseX = evt.clientX;
	var mouseY = evt.clientY;
	var scrollWidth  = getScrollWidth();
	var scrollHeight = getScrollHeight();

	showInfo(a, id);
	var divWidth  = document.getElementById("divReview").clientWidth;
	var divHeight = document.getElementById("divReview").clientHeight;

	var divLeftAdjust = 0;
	var divTopAdjust  = 0;
	if (mouseX + 20 + divWidth > document.documentElement.clientWidth) {
		divLeftAdjust = - divWidth  - 35;
		addX += divLeftAdjust;
	}
	if (mouseY + 5 + divHeight > document.documentElement.clientHeight) {
		divTopAdjust  = - (divHeight/1.2);
		addY  = divTopAdjust;
	}

	document.getElementById("divReview").style.left = scrollWidth  + mouseX + addX + "px";
	document.getElementById("divReview").style.top  = scrollHeight + mouseY + addY + "px";
	document.getElementById("divReview").style.visibility = "visible";
}

//隐藏浮动信息窗口
function Face_MouseOut()
{
	document.getElementById("divReview").style.visibility = "hidden";
}

function getScrollWidth()
{
	var scrollPos;
	if (typeof window.pageXOffset != 'undefined') {
		scrollPos = window.pageXOffset;
	}
	else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
		scrollPos = document.documentElement.scrollLeft;
	}
	else if (typeof document.body != 'undefined') {
		scrollPos = document.body.scrollLeft;
	}

	return scrollPos;
}

function getScrollHeight()
{
	var scrollPos;
	if (typeof window.pageYOffset != 'undefined') {
		scrollPos = window.pageYOffset;
	}
	else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
		scrollPos = document.documentElement.scrollTop;
	}
	else if (typeof document.body != 'undefined') {
		scrollPos = document.body.scrollTop;
	}

	return scrollPos;
}

function showInfo(a, id)
{
	var xmlHttp = getXmlHttpObject();
	var urlPath = "showInfo.php?a=" + a + "&id=" + id;

	//var tcache = readCache(urlPath);
 	//if (tcache.length)
	//{
	//	 document.getElementById("divReview").innerHTML = tcache;
	//}
 	//else {
		 xmlHttp.open("GET", urlPath, true);
		 xmlHttp.onreadystatechange = function()
		 {
			document.getElementById("divReview").innerHTML = '<span style="color:#EEEEEE;">Loading......</span>';

			if (xmlHttp.readyState == 4)
			{
				if (xmlHttp.status == 200)
				{
					document.getElementById("divReview").innerHTML = xmlHttp.responseText;
					//cache.push(new Array(urlPath, xmlHttp.responseText));
				}
			}
		};
		xmlHttp.send(null);
	 //}
}

//获取XMLHttp对象
function getXmlHttpObject()
{
	var objXMLHttp = null;
	if (window.ActiveXObject) {
		try {
			objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try{
				objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				alert("Browser does not support HTTP Request");
			}
		}
	} else if (window.XMLHttpRequest) {
		objXMLHttp = new XMLHttpRequest();
	} else {
		alert("Browser does not support HTTP Request");
	}

	return objXMLHttp;
}