function gB(e)
{
  var left = e.offsetLeft;
  var top = e.offsetTop;
  for (var parent = e.offsetParent; parent; parent = parent.offsetParent)
  {
    left += parent.offsetLeft - parent.scrollLeft;
    top += parent.offsetTop - parent.scrollTop
  }
  return {left: left, top: top, w: e.offsetWidth, h: e.offsetHeight};
}
var isshow="";
var isactive=false;
var timeout_id=0;
function lm(o, s, t, a) {
	if (!document.getElementById('lm')){
		var obj=document.createElement('div');
		document.body.appendChild(obj);
		obj.id='lm';
		obj.style.display='none';
		obj.innerHTML=''
		+ '<div class="xw xw-plain" id="lmout" style="position:absolute;top:0px;left:0px;width:0px;" onMouseOver=\"a_div();\" onMouseOut=\"d_div();\">'
		+ '<div class="xw-tl" unselectable="on">'
		+ '<div class="xw-tr">'
		+ '<div class="xw-tc">'
		+ '<div class="xw-hdr x-unselectable xp-icon" align="center">'
		+ '<span id="lmtitle"></span></div>'		
		+ '</div></div></div>'
		+ '<div class="xw-bwrap">'
		+ '<div class="xw-ml">'
		+ '<div class="xw-mr">'
		+ '<div class="xw-mc">'
		+ '<div class="xw-body">'
		+ '<div class="myWinCont" style="padding:5px;width*:100%;"><div align="left" id="lmcontent"></div></div>'
		+ '</div></div></div></div></div>'
		+ '<div class="xw-bl"><div class="xw-br">'
		+ '<div class="xw-bc"><div class="xw-footer"></div>'
		+ '</div></div></div></div>';
	}
	o.onmouseout=function(){d_div();};
	if(s==1) { isshow=o.id; timeout_id=setTimeout(function() {show(o,t,a);}, 800); }
	else  { if(isactive) {return;} else {isshow='';  setTimeout(function() {lm_hide();}, 800); } }
}	
function a_div() {
	isactive=true;
}
function d_div() {
	isactive=false;
	setTimeout(function() {lm_hide();}, 800);
	if(timeout_id>0){
		clearTimeout(timeout_id);
		timeout_id=0;
	};
}
function show(img,t,f) {
	if(isshow!=img.id) return;
	var a=gB(img);
	var out=document.getElementById('lmout');
	out.style.left=a.left+60+document.body.scrollLeft;
	out.style.top=a.top-60+document.body.scrollTop;
	out.style.width=150;
	document.getElementById('lmtitle').innerHTML=t;
	document.getElementById('lmcontent').innerHTML=makeInner(f);
	document.getElementById('lm').style.display='block';
}
function lm_hide() {
	if((isactive)||(isshow!='')) return;
	document.getElementById('lm').style.display='none';
}

function _hide() {
	document.getElementById('lm').style.display='none';
}
function makeInner(a) {
	var s='<table width="100%">';
	var act;
	if(a.m>0){
		act='onmouseover="_cTDs(this,\'myWinTD2\');" onmouseout="_cTDs(this,\'myWinTD1\');" onclick="_hide();msg('+a.m+');" style="cursor:pointer;"';
		s+='<tr '+act+'><td class="myWinTD1"><span class="lmtd lmimg0">';
		s+=lmmsg[0];
		s+='</span></td></tr>';
	}
	if(a.t>0){
		act='onmouseover="_cTDs(this,\'myWinTD2\');" onmouseout="_cTDs(this,\'myWinTD1\');" onclick="_hide();showfly('+a.t+');" style="cursor:pointer;"';
		s+='<tr '+act+'><td class="myWinTD1"><span class="lmtd lmimg1">';
		s+=lmmsg[1];
		s+='</span></td></tr>';
	}
	if(a.f>0){
		act='onmouseover="_cTDs(this,\'myWinTD2\');" onmouseout="_cTDs(this,\'myWinTD1\');" onclick="_hide();albom('+a.f+');" style="cursor:pointer;"';
		s+='<tr '+act+'><td class="myWinTD1"><span class="lmtd lmimg2">';
		s+=lmmsg[2];
		s+='</span></td></tr>';
	}
	if(a.p>0){
		act='onmouseover="_cTDs(this,\'myWinTD2\');" onmouseout="_cTDs(this,\'myWinTD1\');" onclick="_hide();profile('+a.p+');" style="cursor:pointer;"';
		s+='<tr '+act+'><td class="myWinTD1"><span class="lmtd lmimg3">';
		s+=lmmsg[3];
		s+='</span></td></tr>';
	}
	if(a.r>0){
		act='onmouseover="_cTDs(this,\'myWinTD2\');" onmouseout="_cTDs(this,\'myWinTD1\');" onclick="_hide();addbook('+a.r+');" style="cursor:pointer;"';
		s+='<tr '+act+'><td class="myWinTD1"><span class="lmtd lmimg4">';
		s+=lmmsg[4];
		s+='</span></td></tr>';
	}
	if(a.d>0){
		act='onmouseover="_cTDs(this,\'myWinTD2\');" onmouseout="_cTDs(this,\'myWinTD1\');" onclick="_hide();delbook('+a.d+');" style="cursor:pointer;"';
		s+='<tr '+act+'><td class="myWinTD1"><span class="lmtd lmimg5">';
		s+=lmmsg[5];
		s+='</span></td></tr>';
	}
	if(a.b>0){
		act='onmouseover="_cTDs(this,\'myWinTD2\');" onmouseout="_cTDs(this,\'myWinTD1\');" onclick="_hide();lmflybook('+a.b+');" style="cursor:pointer;"';
		s+='<tr '+act+'><td class="myWinTD1"><span class="lmtd lmimg6">';
		s+=lmmsg[6];
		s+='</span></td></tr>';
	}
	if(a.p>0){
		act='onmouseover="_cTDs(this,\'myWinTD2\');" onmouseout="_cTDs(this,\'myWinTD1\');" onclick="_hide();level('+a.p+');" style="cursor:pointer;"';
		s+='<tr '+act+'><td class="myWinTD1"><span class="lmtd lmimg7">';
		s+=lmmsg[7];
		s+='</span></td></tr>';
	}
	s+='</table>';
	return s;
}
function _cTDs(r,c){
	var cl='';
	if (typeof(r)!='object'){r=document.getElementById(r);}
	if (typeof(document.getElementsByTagName)!='undefined'){cl=r.getElementsByTagName('td');}
	else if (typeof(r.cells)!='undefined') {cl=r.cells;}
	else {return false;}
	for (var i=0;i<cl.length;i++) {
		cl[i].className=c;
	}
}
