﻿function findPos(o)     { 
    this.top  = o.offsetTop;
    this.left = o.offsetLeft;
    while(o = o.offsetParent)
    {
        this.top  += o.offsetTop;
        this.left += o.offsetLeft;
    }
}

function showpost(a,b)
{
     
    var menuObj = document.getElementById(b);
    var titleObj = document.getElementById(a);
    var posObj = new findPos(titleObj);
    var menu_left = posObj.left;
    var menu_top = posObj.top + parseInt(titleObj.offsetHeight);

    menuObj.style.position = 'absolute';
    menuObj.style.display  = '';
    
    // 计算显示位置
    if (posObj.left + menuObj.offsetWidth >= document.body.clientWidth && 0)
    {
        menu_left = parseInt(posObj.left) - parseInt(menuObj.offsetWidth) + parseInt(titleObj.offsetWidth);
    }
    if (posObj.top + menuObj.offsetHeight >= document.body.clientHeight && 1)
    {
        menu_top = parseInt(posObj.top) - parseInt(menuObj.offsetHeight);
    }
    
    menuObj.style.left =  (menu_left - 36) + "px";
    menuObj.style.top = menu_top + "px";
}

function hiddenpost(a,b)
{
    str=document.getElementById(a).value;
    chkarr = str.split(' ');
    if(chkarr.length==3)ckid=1;
    if(ckid==1) document.getElementById(b).style.display='none';
}

function closepost(b)
{
    document.getElementById(b).style.display='none';
}
  
