// Browser feature flags.
var FEATURES = {
    hasInnerText : false,
    hasGetElemById : false
}

// Check browser features and initialize feature flags.
function checkFeatures()
{
    FEATURES.hasGetElemById = false;
    FEATURES.hasInnerText = false;
    if (document.getElementById)
        FEATURES.hasGetElemById = true;
    else
        return;
    var e = document.getElementById("imageRef01");
	if (e.hasOwnProperty && e.hasOwnProperty('innerText'))
		FEATURES.hasInnerText = true;
	else if (e.innerText != undefined)
		FEATURES.hasInnerText = true;
}

function init()
{
    checkFeatures();
}

function setText(e, text)
{
    if (!FEATURES.hasInnerText)
        e.textContent = text;
    else
        e.innerText = text;
}

function imageRef(elementName, text)
{
    if (!FEATURES.hasGetElemById)
        return;
    var e = document.getElementById(elementName);
    setText(e, text);
}

