﻿function showpresence(presence)
{

//	alert(
//	presence.status + "\n" + 
//	presence.statusText + "\n" + 
//	presence.id + "\n" + 
//	presence.displayName + "\n" + 
//	presence.mkt + "\n" + 
//	presence.icon + "\n" + 
//	presence.icon.url + "\n" + 
//	presence.icon.width + "\n" + 
//	presence.icon.height
//	);

    var innerFrame = document.getElementById('innerFrame');

    var statusIcon = document.createElement('img');
    statusIcon.className = 'innerFrameImg';
    statusIcon.src = presence.icon.url;
    statusIcon.width = presence.icon.width;
    statusIcon.height = presence.icon.height;
    statusIcon.alt = presence.statusText;
    statusIcon.title = presence.statusText;

    var displayName = document.createElement('span');
    displayName.style.fontFamily = 'Tahoma, Verdana, sans-serif';
    displayName.style.fontSize = '9pt';
    displayName.title = presence.displayName;

    var statusText = document.createElement('span');
    statusText.style.fontFamily = 'Tahoma, Verdana, sans-serif';
    statusText.style.fontSize = '9pt';
    statusText.title = presence.statusText;

    innerFrame.appendChild(statusIcon);
    //  var br = document.createElement('br');
    //  innerFrame.appendChild(br);
    innerFrame.appendChild(displayName);
    //  innerFrame.appendChild(br);
    innerFrame.appendChild(statusText);

    if ((displayName.innerText !== undefined) && (statusText.innerText !== undefined))
    {
        var newDisplayName = presence.displayName;
        var strippedName = newDisplayName.substr(6, newDisplayName.length +1);
        displayName.innerText = strippedName;
        statusText.innerText = " [" + presence.statusText + "]";
    }
    else if ((displayName.textContent != undefined) && (statusText.textContent !== undefined))
    {
        var newDisplayName = presence.displayName;
        var strippedName = newDisplayName.substr(6, newDisplayName.length + 1);
        displayName.textContent = strippedName;
        statusText.textContent = " [" + presence.statusText + "]";
    }
}
