function replaceAll(str, searchTerm, replaceWith)	{
	var regex = "/"+searchTerm+"/g";
	return str.replace( eval(regex), replaceWith );
}

function tdl(docName, docEventToUse) {
    if (docEventToUse) { if (s_account) { s.prop21 = s.eVar21 = 'Download:' + docName; if (dma) { s.prop22 = s.eVar22 = dma + ':' + s.prop21; } if (c) { s.prop23 = s.eVar23 = c + ':' + s.prop21; } s.prop28 = docName; s.linkTrackEvents = docEventToUse; s.events = docEventToUse; s.tl(this, 'o', docName); } }
    cleanUp();
    return true;
}
function tc(desc) {
    if (desc) { if (s_account) { s.prop21 = s.eVar21 = 'Click:' + desc; if (dma) { s.prop22 = s.eVar22 = dma + ':' + s.prop21; } if (c) { s.prop23 = s.eVar23 = c + ':' + s.prop21; } s.tl(this, 'o', desc); } }
    cleanUp();
    return true;
}
$(document).ready(function() {
    if (typeof $('a.download, a.LitAdPromo, a.LitBrochure, a.LitCaseStudy, a.LitCertifications, a.LitCodeCompliance, a.LitInstallationInstructions, a.LitLeedReport, a.LitMsds, a.LitProductDataSubmittalSheet, a.LitSpecificationGuide, a.LitTechnicalBulletin, a.LitWarranty') != 'undefined') {
        var litLinks = $('a.download, a.LitAdPromo, a.LitBrochure, a.LitCaseStudy, a.LitCertifications, a.LitCodeCompliance, a.LitInstallationInstructions, a.LitLeedReport, a.LitMsds, a.LitProductDataSubmittalSheet, a.LitSpecificationGuide, a.LitTechnicalBulletin, a.LitWarranty');
        for (i = 0; i < litLinks.length; i++) {
            var ctrl = litLinks[i];
            if ($(ctrl).attr('href')) {
                $(ctrl).click(
                    function() { var doctype = $(this).attr('class'); var docname = $(this).attr('title'); if (!docname) { var img = $(this).find('img'); if (img) { docname = img.attr('alt'); } } if (!docname) { docname = $(this).html(); } tdl(replaceAll(doctype + ':' + docname, '®', ''), 'event7'); }
                );
            }
        }
    }
    if (typeof $('a.click') != 'undefined') {
        var litLinks = $('a.click');
        for (i = 0; i < litLinks.length; i++) {
            var ctrl = litLinks[i];
            if ($(ctrl).attr('href')) {
                $(ctrl).click(
                    function() { var desc = $(this).attr('title'); if (!desc) { var img = $(this).find('img'); if (img) { desc = img.attr('alt'); } } if (!desc) { desc = $(this).html(); } tc(replaceAll(desc, '®', '')); }
                );
            }
        }
    }
});

function cleanUp() { if (s) { s.events = ''; s.prop21 = s.eVar21 = s.prop22 = s.prop28 = ''; } }
