﻿// JavaScript Document
<!--
//***********默认设置定义.*********************
var tPopWait=1;    //停留tWait豪秒后显示提示。
var tPopShow=8000;    //显示tShow豪秒后关闭提示
var showPopStep=20;
var popOpacity=90;
var tfontcolor="#000000";
var tbgcolor="#ededed";
var tbordercolor="#808080";

//***************内部变量定义*****************
var sPop=null,curShow=null,tFadeOut=null,tFadeIn=null,tFadeWaiting=null;

document.write("<style type='text/css' id='defaultPopStyle'>");
document.write(".over_cPopText {display: block; background-color: " + tbgcolor + "; border: solid 1px " + tbordercolor + "; padding: 2px; line-height: 20px;}");
document.write(".cPopText {color:" + tfontcolor + "; font-size: 12px; margin: 4px; line-height: 20px; filter: Alpha(Opacity=0)}");
document.write("</style>");
document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");

function showPopupText()
{
  var o=event.srcElement;
  MouseX=event.x?event.clientX:event.pageX;
  MouseY=event.y?event.clientY:event.pageY;
  
  if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
  if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
  if(o.dypop!=sPop)
  {
    sPop=o.dypop;
    clearTimeout(curShow);
    clearTimeout(tFadeOut);
    clearTimeout(tFadeIn);
    clearTimeout(tFadeWaiting);  
    if(sPop==null || sPop=="")
    {
      dypopLayer.innerHTML="";
      dypopLayer.style.filter="Alpha()";
      dypopLayer.filters.Alpha.opacity=0;  
    }
    else
    {
      if(o.dyclass!=null) popStyle=o.dyclass 
      else popStyle="cPopText";
      curShow=setTimeout("showIt()",tPopWait);
    }
  }
}

function showIt()
{
	dypopLayer.className=popStyle;
	dypopLayer.innerHTML="<span class='over_cPopText'>" + sPop + "</span>";
	
	var theSubSpan=dypopLayer.childNodes.item(0);
	var theShowImg=theSubSpan.childNodes.item(0);
	if(theShowImg.src)
	{
		var originImage=new Image();
		originImage.src=theShowImg.src;
		if(originImage.width>400)
		{
			theShowImg.style.width="400px";
		}
	}
	
	popWidth=dypopLayer.clientWidth;
	popHeight=dypopLayer.clientHeight;
	var theBodyWidth=document.documentElement.clientWidth || document.body.clientWidth || 0;
	var theBodyHeight=document.documentElement.clientHeight || document.body.clientHeight || 0;
	if(MouseX+12+popWidth>theBodyWidth) popLeftAdjust=-popWidth-24
		else popLeftAdjust=0;
	if(MouseY+12+popHeight>theBodyHeight) popTopAdjust=-popHeight-24
		else popTopAdjust=0;
	//dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
	//dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
	var theScrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
	var theScrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;	
	
	dypopLayer.style.left=MouseX+12+theScrollLeft+popLeftAdjust;
	dypopLayer.style.top=MouseY+12+theScrollTop+popTopAdjust;
	
	dypopLayer.style.filter="Alpha(Opacity=0)";
	fadeOut();
}

function fadeOut(){
  if(dypopLayer.filters.Alpha.opacity<popOpacity)
  {
    dypopLayer.filters.Alpha.opacity+=showPopStep;
    tFadeOut=setTimeout("fadeOut()",1);
  }
  else
  {
    dypopLayer.filters.Alpha.opacity=popOpacity;
    tFadeWaiting=setTimeout("fadeIn()",tPopShow);
  }
}

function fadeIn()
{
  if(dypopLayer.filters.Alpha.opacity>0)
  {
    dypopLayer.filters.Alpha.opacity-=1;
    tFadeIn=setTimeout("fadeIn()",1);
  }
}

document.attachEvent("onmouseover",showPopupText);
/*
if(window.attachEvent)
{
	window.attachEvent('onmouseover',showPopupText);
}
else if(window.addEventListener)
{
	window.addEventListener('mouseover',showPopupText,false);
}
*/
//document.onmouseover=showPopupText;
//document.onmouseoout=showPopupText;
//-->
