
var tip_duceactionid=null;
var tip_popside_x=10;
// 弹出窗口位于鼠标左侧或者右侧的距离；3-12 合适
function tip_fetchOffset(obj) {
	var left_offset=obj.offsetLeft;
	var top_offset=obj.offsetTop;
	while((obj=obj.offsetParent)!=null) {
		left_offset+=obj.offsetLeft;
		top_offset+=obj.offsetTop;
	}
	return {
		'left':left_offset,'top':top_offset
	};
}
function tip_ducepopupinit(event) {
	try{
		if(event.srcElement)o=event.srcElement;
		else o=event.target;
		if(o.id!=tip_duceactionid) {
			tip_duceactionid=o.id;
			var divid='tip_info';
			if(o.id.indexOf('tip_')!=-1) {
				var duceid='yun_'+o.id;
				document.getElementById(divid).innerHTML=document.getElementById(duceid).innerHTML;
				tip_ducetomouseloc(event,divid,o.id);
				if(!o.onmouseover) {
					o.onmouseout=function () {
						document.getElementById(divid).style.display='none';
					}
				}
				if(!document.getElementById(divid).onmouseover) {
					document.getElementById(divid).onmouseover=function () {
						document.getElementById(divid).style.display='block';
					}
					document.getElementById(divid).onmouseout=document.getElementById(divid).onmouseup=function () {
						document.getElementById(divid).style.display='none';
					}
				}
			}
		}
	}catch(e) {
		return true
	}
}
function tip_ducetomouseloc(em,showid,ctrlid) {
	var userAgent=navigator.userAgent.toLowerCase();
	var is_opera=userAgent.indexOf('opera')!=-1&&opera.version();
	var is_moz=(navigator.product=='Gecko')&&userAgent.substr(userAgent.indexOf('firefox')+8,3);
	var is_ie=(userAgent.indexOf('msie')!=-1&&!is_opera)&&userAgent.substr(userAgent.indexOf('msie')+5,3);
	var is_mac=userAgent.indexOf('mac')!=-1;
	try{
		if(document.getElementById(showid).innerHTML=='')return ;
		document.getElementById(showid).style.display='block';
		var showobj=document.getElementById(showid);
		var menuobj=document.getElementById(ctrlid);
		menuobj.pos=tip_fetchOffset(menuobj);
		showobj.X=em.clientX+tip_popside_x;
		showobj.Y=menuobj.pos['top'];
		showobj.w=showobj.offsetWidth;
		showobj.h=showobj.offsetHeight;
		menuobj.w=menuobj.offsetWidth;
		menuobj.h=menuobj.offsetHeight;
		var bdtop=document.documentElement.scrollTop+document.documentElement.clientHeight;
		var bdleft=document.body.clientWidth;
		if(showobj.X>menuobj.w+menuobj.pos['left']-tip_popside_x*2) {
			showobj.X=menuobj.w+menuobj.pos['left']-tip_popside_x*2;
		}
		showobj.style.left=(showobj.X+showobj.w>document.body.clientWidth)&&(showobj.X-showobj.w-tip_popside_x>=0)?showobj.X-showobj.w-tip_popside_x+'px':showobj.X+'px';
		showobj.style.top=showobj.Y+showobj.h>document.documentElement.scrollTop+document.documentElement.clientHeight?showobj.Y-showobj.h+1+'px':showobj.Y+(is_moz?15:14)+'px';
	}catch(e) {
	}
}
if(!document.onmouseover) {
	document.onmouseover=function (e) {
		if(!e)tip_ducepopupinit(window.event);
		else tip_ducepopupinit(e);
	};
}
