//***********Default Setting.*********************
tPopWait  = 10;			//time to wait before show the tipsĄŁ
tPopShow  = 10000;		    //the stay time of tips
tPopDelay = 100;        //time to wait before hide the tips.

// private variable
var oCur = null;
var curShow=null;
var tFadeOut=null;
var tFadeIn=null;
var tFadeWaiting=null;

document.write("<style type='text/css' id='defaultPopStyle'>");
document.write(".cPopText {  background-color: #F8F8F5; color:#000000; border: 1px #000000 solid; font-size: 9pt; padding-right: 4px; padding-left: 4px;  padding-top: 2px; padding-bottom: 2px; overflow:visible;  display:none; text-align:justify;}");
document.write("</style>");
document.write("<div id='dypopLayer' style='position:absolute;word-wrap: break-word; z-index:1000;' class='cPopText'></div>");

function showPopupText(e){
	
	if(document.all)
	{
		var o=event.srcElement;
		MouseX=event.clientX;
		MouseY=event.clientY;
	}
	else if(document.getElementById && ! document.all) {
		var o=e.target;
		MouseX=e.pageX;
		MouseY=e.pageY;
		dypopLayer = document.getElementById('dypopLayer');
	}
	else {
		return false;
	}
	if( o == null) return false;
	if( (o.alt == null || o.alt == '') && (o.title == null || o.title == '') && (o.dypop ==null || o.dypop == '')){
		clearTimeout(tFadeWaiting);
		tFadeWaiting=setTimeout("hidePopupText()",tPopDelay);
		return;
	}
	if(o.alt!=null && o.alt!=""){o.dypop=o.alt; o.alt=''};
    if(o.title!=null && o.title!=""){o.dypop=o.title;o.title='';};
	clearTimeout(curShow);
	clearTimeout(tFadeWaiting);
	
		oCur = o;
		popStyle="cPopText";
		dypopLayer.innerHTML="";
		dypopLayer.style.display='none';
		curShow=setTimeout("showIt()",tPopWait);

}

function showIt(){
	var sPop = oCur.dypop.replace(/\n/g, "<br>");
	dypopLayer.className=popStyle;
	var oS = dypopLayer.style;
	oS.position = 'absolute';
	oS.left = -1000;
	oS.top  = -1000;
	oS.width = null;
	dypopLayer.innerHTML=sPop;
	oS.display='block';
	var popWidth=dypopLayer.offsetWidth;
	var popHeight=dypopLayer.offsetHeight;
	oS.width=popWidth;

	var b = document.body;

	if(MouseX+12+popWidth>b.clientWidth) {
		popLeftAdjust=-popWidth-24;
	}
	else
		popLeftAdjust=0;
	if(MouseY+12+popHeight>b.clientHeight) 
		popTopAdjust=-popHeight-24;
	else
		popTopAdjust=0;
	var intLeft = MouseX+12+popLeftAdjust+(document.all ? b.scrollLeft: 0);
	var intTop  = MouseY+12+popTopAdjust+(document.all ? b.scrollTop: 0);
	
	oS.left = (intLeft < b.scrollLeft ? b.scrollLeft : intLeft) + "px";
	oS.top=   (intTop  < b.scrollTop ? b.scrollTop : intTop) + "px";

	tFadeWaiting=setTimeout("hidePopupText()",tPopShow);
}


function hidePopupText(){
	dypopLayer.style.display='none';
}
addEvent(document, "mouseover", showPopupText);
addEvent(document, "click", hidePopupText);

