function showpresence(presence, i)
{
    var innerFrame = document.getElementById('liveStatus'+i);
    var memberId = document.getElementById('memberIdList'+i);

    //icon
    var statusImgDivElement = document.createElement("span");
    statusImgDivElement.className = "im_img";

    var statusIcon = document.createElement('img');
    statusIcon.style.border = 'none';
    statusIcon.src = presence.icon.url;
    statusIcon.width = presence.icon.width;
    statusIcon.height = presence.icon.height;
    statusIcon.alt = presence.statusText;
    statusIcon.title = presence.statusText;

    statusImgDivElement.appendChild(statusIcon);
    innerFrame.appendChild(statusImgDivElement);

    //text
    var statusTextDivElement = document.createElement("span");
    statusTextDivElement.className = "im_text";

    var statusText = document.createElement('span');
    statusText.title = presence.statusText;

    var stTx = presence.statusText;

    if(stTx == "Be right back")
        stTx = "Right back";

    statusText.appendChild(document.createTextNode(stTx));
    statusText.innerHTML += "(msn)";

    statusText.onclick = function () {openLiveMessenger(presence.id, memberId.value);};

    statusTextDivElement.appendChild(statusText);
    innerFrame.appendChild(statusTextDivElement);
}    
    
    
function openLiveMessenger(cid, toMemberId)
{
    //WindowObjectReference = window.open("Messenger_Live.aspx?cid="+cid+"&toMemberId="+toMemberId, "messenger",  "width=300,height=580,resizable=yes,scrollbars=no,status=no");
    window.open("http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee="+cid+"", "_blank");//&mkt=zh-cn
} 
