var docRoot = "/";

if (typeof window.attachEvent == "undefined") {
    window.attachEvent = function(name, func) {
        window.addEventListener(name.replace('on', ''), func, false);
    }
}

window.attachEvent('onload', rwycLoad);

function rwycLoad() {
    rwycUICustomizations();
}

function rwycUICustomizations() {
    var arrow = '&#9664;';
    if (isIE()) {
        arrow = '&#9668;';
    }
    
    setHTML('backLink', arrow);
    setAttr('backLink', 'title', 'Back');
    setAttr('logo', 'title', 'Home');
}

function isIE() {
    var re = /MSIE/ig;
    return re.test(navigator.userAgent);
}

function doBack() {
    history.go(-1);
}

function doHome() {
    location.href = docRoot;
}

function getElementById(tagId) {
    var oReturn = new Object();

    try {
        var el = document.getElementById(tagId);
        
        if (!isEmpty(el)) {
            oReturn = el;
        }
    }
    catch (e) {
    }
    
    return oReturn;
}

function isEmpty(el) {
    return (typeof el == "undefined" || el == null || el == "");
}

function setHTML(tagId, sHtml) {
    try {
        document.getElementById(tagId).innerHTML = sHtml;
    }
    catch (e) {
    }
}

function setValue(tagId, value) {
    try {
        document.getElementById(tagId).value = value;
    }
    catch (e) {
    }
}

function setAttr(tagId, attrName, value) {
    try {
        document.getElementById(tagId)[attrName] = value;
    }
    catch (e) {
    }
}

function setText(tagId, value) {
    try {
        document.getElementById(tagId).innerText = value;
    }
    catch (e) {
    }
}
