// create print page link on the fly if key items are supported
var hasPrintFeature = (window.print) ? true : false;
var supportsW3CDOM = ((document.createElementNS || document.createElement) && document.createTextNode && document.insertBefore && document.appendChild);
if (hasPrintFeature && supportsW3CDOM) {
    if (typeof PRINT_PAGE_TEXT == 'string') {
        var li = (document.createElementNS) ? document.createElementNS(XHTML_NS_URI, 'li') : document.createElement('li');
        var a = (document.createElementNS) ? document.createElementNS(XHTML_NS_URI, 'a') : document.createElement('a');
        a.setAttribute('href', '#');
        li.setAttribute('id', 'navFunctionsPrint');  
        if (typeof PRINT_TOOLTIP == 'string') {
            a.setAttribute('title', PRINT_TOOLTIP);
        }
        a.onclick = function() {
            window.print();
            return false;
        }
        a.appendChild(document.createTextNode(PRINT_PAGE_TEXT));
        li.appendChild(a);
        var refNode = document.getElementById('navFunctionsToTheTop');
        if (refNode) {
            refNode.parentNode.insertBefore(li, refNode);
        } else {
            var parentRefNode = document.getElementById('pageFunctions');
            if (parentRefNode) {
                var ul = (document.createElementNS) ? document.createElementNS(XHTML_NS_URI, 'ul') : document.createElement('ul');
                ul.appendChild(li);
                parentRefNode.appendChild(ul);
            }
        }
    }
}
