// BEHAVIOR LAYER

// 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');
        li.setAttribute('id', 'navFunctionsPrint');
        var a = (document.createElementNS) ? document.createElementNS(XHTML_NS_URI, 'a') : document.createElement('a');
        a.setAttribute('href', '#');
       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('navFunctionsRecommend');
        var refNodeMain = document.getElementById('navServiceSitemap');
        if (refNode) {
            refNode.parentNode.insertBefore(li, refNode);
       } else if (refNodeMain) {
            refNodeMain.parentNode.insertBefore(li, refNodeMain);
        } else {
            var parentRefNode = document.getElementById('siteInfo');
            if (parentRefNode) {
                var ul = (document.createElementNS) ? document.createElementNS(XHTML_NS_URI, 'ul') : document.createElement('ul');
                ul.appendChild(li);
                refNode = (parentRefNode.getElementsByTagName('p').length > 0) ? parentRefNode.getElementsByTagName('p')[0] : null;
                if (refNode) {
                    refNode.parentNode.insertBefore(ul, refNode);
                }
            }
        }
    }
}

// attach events to search form input
attachToField('f206184d201978');
attachToField('f201976d201982');
attachToField('f201976d201984');
attachToField('f206186d206188');
attachToField('f206190d206192');
attachToField('f206190d206194');
attachToField('f316852d201978');
attachToField('f316732d201982');
attachToField('f316732d201984');