/*
===========扩展鼠标提示===========

  作者：ziyue's Blog
  网址：http://web-v.com
  声明：转载时务请保留以上信息

==================================
*/

var oPopup = window.createPopup();
var sPop = null;
function showPopupWin(){
	var tPopWait=250; //这里设定鼠标停留多长时间出现提示（系统alt和title延迟时间为500毫秒）
	var o=event.srcElement;

	if(o.alt!=null && o.alt!=""){o.sPop=o.alt;o.alt="";}
	if(o.title!=null && o.title!=""){o.sPop=o.title;o.title="";}
	
	if(sPop!=o.sPop) sPop=o.sPop;
	if(sPop==null || sPop=="")
		oPopup.hide(); //Hidden
	else
	{
	
		setTimeout("showIt("+event.x+","+event.y+")",tPopWait);
}
}

function showIt(MouseX,MouseY){
	if(sPop){
		sPop=replaceCharacters(sPop,"\r","<br>"); //如果在alt或title中用&#13;表示的换行，则替换为<br>换行
		
		var foreColor="#333333"; //字符颜色
		var backColor="#EDF2FC"; //背景色
		var borderColor="#9DBAF7"; //边框颜色
		
		var maxWidth=300; //这里设定提示信息的最大宽度（系统alt和title的宽度大约为295）
		var content1 ="<table border='0' cellspacing='1' cellpadding='3' bgcolor='" + borderColor + "'><td bgcolor='" + backColor + "' style='color:" + foreColor + "; font-size:12px; font-family: Verdana; line-height:120%' nowrap>" + sPop + "</td></table>";
		var content2 ="<table border='0' cellspacing='1' cellpadding='3' bgcolor='" + borderColor + "' width='" + maxWidth + "'><td bgcolor='" + backColor + "' style='color:" + foreColor + "; font-size:12px; font-family: Verdana; line-height:120%'>" + sPop + "</td></table>";

		oPopup.document.body.innerHTML=content1;
		oPopup.show(); //初始化
		var left = MouseX + 0;
		var top = MouseY -10;
		var width = oPopup.document.body.scrollWidth;
		var height = oPopup.document.body.scrollHeight;
		
		if(width>maxWidth){
			oPopup.document.body.innerHTML=content2;
			width = oPopup.document.body.scrollWidth;
			height = oPopup.document.body.scrollHeight;
		}
		
		var l=document.documentElement.scrollLeft		
		var t=document.documentElement.scrollTop
		oPopup.show(left+l, top+t, width, height, document.body);
          // alert(document.documentElement.scrollTop )
	}
}

function replaceCharacters(conversionString,inChar,outChar){
  var convertedString = conversionString.split(inChar);
  convertedString = convertedString.join(outChar);
  return convertedString;
}

document.onmouseover = showPopupWin;