/*
* 该函数用于使用自己的提示条，在需要显示提示的标记中必须加上 MsTips = "提示的内容"
* 使用中可以通过参数定制提示条的样式：makeTips(前景色,背景色,透明度(0-100)0表示不显示,阴影的宽度,阴影的颜色) 
*/
var tipsTimer = null;
var tipsInit  = false;
var bgColor = "#EEEEEE"; //提示条
var opacity = 30;
var fgColor = "#333333";
var shadowWidth = 3;
var shadowColor = "#222222";
var start = 0;

function makeTips()
{
	if(tipsInit)
	{
		return;
	}
	tipsInit = true;
	
	var arglen = arguments.length;



	var tipsLimWidth = 300;

	if(arglen>=1)
	{
		if(fgColor != "")
			fgColor = arguments[0];
	}
	if(arglen>=2)
	{
		if(bgColor != "")
		bgColor = arguments[1];
	}
	if(arglen>=3)
	{
		if(opacity != "" && opacity != 0)
			opacity = arguments[2];
	}
	if(arglen>=4)
	{
		if(shadowWidth != "" && shadowWidth != 0)
			shadowWidth = arguments[3];
	}
	if(arglen>=5)
	{
		if(shadowColor != "")
			shadowColor = arguments[4];
	}
	if(shadowWidth > 8)
		shadowWidth = 8;

	if(shadowWidth<2)
		shadowWidth = 2

	var tipbar = document.all.MsTipbar;

	MsTipbarShadow1.style.backgroundColor = shadowColor
	MsTipbarShadow2.style.backgroundColor = shadowColor;

	with(tipbar.style)
	{
		color = fgColor;
		backgroundColor = bgColor;
		
		border = "1px solid "+fgColor;
	}


	var elmlen = document.all.length
	for(i=0;i<elmlen;i++)
	{
		var elm = document.all[i];
		
		if(elm.MsTips != null && elm.MsTips != "")
		{
			elm.onmouseover = function()
			{
				clearTimeout(tipsTimer);//防止
				var obj = event.srcElement;
				tipbar.innerHTML = "";
				var tipsWidth = 0;
				tipbar.style.width = ""//删除样式
				
				tipbar.style.top  = event.y + 18;
				tipbar.style.left = 0;//必须先设置为0，很重要的一句代码
				
				tipbar.style.visibility='visible'//显示提示条

				tipbar.innerHTML = obj.MsTips;
				
				//如果提示条的宽度 极限宽度
				if(tipbar.clientWidth >= tipsLimWidth)
				{
					tipsWidth = parseInt(tipsLimWidth);
					tipbar.style.width = tipsWidth
				}
				else
					tipsWidth = tipbar.clientWidth; 

			
				//aa = 鼠标位置 + TIP宽度 - 窗口的宽度
				var off = parseInt(event.x) + parseInt(tipbar.clientWidth) - parseInt(document.body.clientWidth) + 10
				
				if(off < 0)
					off = 0
	//alert(off)
				tipbar.style.left = event.x - off;
				//下面
				with(MsTipbarShadow1.style)
				{
				
					visibility='visible'
					width = parseInt(tipbar.clientWidth)+2;
					height = shadowWidth//shadowWidth;
					left = parseInt(tipbar.style.left) + shadowWidth;
					top = parseInt(tipbar.style.top) + parseInt(tipbar.clientHeight)+2;
					//alert(tipbar.clientLeft)
				}
				//右边
				with(MsTipbarShadow2.style)
				{
				
					visibility='visible'
					width = shadowWidth;
					height = parseInt(tipbar.clientHeight)-shadowWidth+2;
					left = parseInt(tipbar.style.left) + parseInt(tipbar.clientWidth)+2;
					top = parseInt(tipbar.style.top) + shadowWidth;
				}
				aa(opacity);

			}
			elm.onmouseout = function()
			{
				start =0;
				tipsTimer = setTimeout("funTimer()",100);
			}
		}
	}
	tipbar.onmouseout = function()
	{
		//tipsTimer = setTimeout("funTimer()",300);
	}
	tipbar.onmouseover = function()
	{
		//clearTimeout(tipsTimer);//防止
	}
}

function aa()
{
	if(start>opacity)
		return;
	document.all.MsTipbarShadow1.style.filter="alpha(opacity="+start+",style=1,startx=100,starty=80,finishx=100,finishy=100)";
	document.all.MsTipbarShadow2.style.filter="alpha(opacity="+start+",style=1,startx=80,starty=100,finishx=100,finishy=100)";
	document.all.MsTipbar.style.filter="alpha(opacity="+(start+60)+")";
	start = start + 5;
	setTimeout("aa()",120);
}
function funTimer()
{
	document.all.MsTipbar.style.visibility='hidden';
	document.all.MsTipbarShadow1.style.visibility='hidden';
	document.all.MsTipbarShadow2.style.visibility='hidden';
}
document.write("<span style=\"word-break:break-all;padding:3;height:1;visibility:hidden;position:absolute;);\" id=\"MsTipbar\"></span>")
document.write("<table cellpadding=\"0\" cellspacing=\"0\" style=\"visibility:hidden;position:absolute;background-color:#222222\" id=\"MsTipbarShadow1\"><tr><td></td></tr></table>")
document.write("<table cellpadding=\"0\" cellspacing=\"0\" style=\"visibility:hidden;position:absolute;background-color:#222222\" id=\"MsTipbarShadow2\"><tr><td></td></tr></table>")
//setTimeout("makeTips()",1000)

