function openLiveMessenger(cid, toMemberId)
{
    WindowObjectReference = window.open("http://www.ec21.com/global/member/EC21LiveMessenger.jsp?cid="+cid+"&toMemberId="+toMemberId, "messenger",  "width=300,height=580,resizable=yes,scrollbars=no,status=no");
}

function showpresence(presence, i)
{
    var innerFrame = document.getElementById('liveStatus'+i);
    var memberId = document.getElementById('memberIdList'+i);

    //icon
    var statusImgDivElement = document.createElement("div");
    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("div");
    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.setAttribute("cid", presence.id);
    statusText.setAttribute("memberId", memberId.value);
    statusText.onclick = function () {openLiveMessenger(this.getAttribute("cid"), this.getAttribute("memberId"));};
    */
    statusText.onclick = function () {openLiveMessenger(presence.id, memberId.value);};

    statusTextDivElement.appendChild(statusText);
    innerFrame.appendChild(statusTextDivElement);
}