var is_department = false;
$(document).ready(function() {
    $(".phvalue").each(function() {
	if ($(this).text() == 'Index id') {
	    if ($(this).next().text().substring(0, 1) == 'D')
		is_department = true;
	} else if (is_department && $(this).text() == 'Text') {
	    var html = $(this).next().html();
	    html = html.replace(/^(.*)	(.*)(<br|$)/gm, '<span style="float: left;" class="departmental-entry-name">$1</span><span style="float: right;">$2</span>' + "\n");
	    html = html.replace(/&nbsp;&nbsp;/g, '<span style="padding-left: 2em;"></span>');
	    html = html.replace(/^(.*)/gm, '<div style="clear: both;">$1</div>');
	    $(this).next().html( html );
	    $(this).next().wrapInner('<div style="width: 34em;"></div>');

	    $(".departmental-entry-name").hover(function() {
		$(this).css("font-weight", "bold");
		$(this).next().css("font-weight", "bold");
	    }, function() {
		$(this).css("font-weight", "normal");
		$(this).next().css("font-weight", "normal");
	    });
	}
    });
});
