﻿$(document).ready(function() {

    var currURL = window.document.location.toString();

    if ($('table.ImmTS_Transactions')) {
        $('table.ImmTS_Transactions td').each(
            function() {
                var html = $(this).html();
                if (html != "&nbsp;") {
                    $(this).html('<div class="transaction"></div>');
                    $(this).find('div:first').append(html);
                }
            }
        );
    }

    var titleText = ($("title").text() == "") ? $("title").html() : $("title").text();
    var sectionTitle = "Investment Banking";

    if (titleText.trim() == sectionTitle.trim()) {
        titleText = "";
    } else {
        sectionTitle += " : ";
    }

    var newTitle = "Stephens Inc. : " + sectionTitle + titleText.trim();
    parent.document.title = newTitle;


	var subText = $("p.subheader:first").text();
	var num = subText.indexOf(" ")
	if (num != -1) {
		subText = subText.slice(0, subText.indexOf(" "));
	}

    if ($(".ImmTS_ServicesIndustries").length) {
        $("tr > td").each(function(i) {
	     var textChars = $(this).attr("class");
	     textChars = textChars.slice(3);
	     (subText.match(textChars)) ? $(this).addClass("selectedIndustry") : $(this).parents("td").removeClass("selectedIndustry");
        });
        
        if ($(".industryTabs").length) {
            $('#mainContent').children().not('.ImmTS_ServicesIndustries').not('.industryTabs').not('.subheader:first').wrapAll("<div class='serviceIndustry_Container'></div>");
        }
    }
    
    

});

