$(document).ready(function() {
	if ($.browser.msie && ($.browser.version <= 6)) {
		$('th.sortable').each(
			function() {
				$(this).mouseover( function() { $(this).addClass('sortable_over'); } );
				$(this).mousedown( function() { $(this).removeClass('sortable_over'); $(this).addClass('sortable_down'); } );
				$(this).mouseup( function() { $(this).removeClass('sortable_down'); $(this).addClass('sortable_over'); } );
				$(this).mouseout( function() { $(this).removeClass('sortable_over'); } );
			}
		);
		$('th.sorted').each(
			function() {
				$(this).mouseover( function() { $(this).addClass('sortable_over'); } );
				$(this).mousedown( function() { $(this).removeClass('sortable_over'); $(this).addClass('sortable_down'); } );
				$(this).mouseup( function() { $(this).removeClass('sortable_down'); $(this).addClass('sortable_over'); } );
				$(this).mouseout( function() { $(this).removeClass('sortable_over'); } );
			}
		);
	}
	
	// collapse all on page load
	$(".bhvCollapseToolList").css({display: "none"});
	$(".toolListTable").css({display: "none"});

	// find the toggle button and add onclick handler to toggle visibility of div
	$(".bhvExpandToolList").click(
		function() {
			$(".bhvExpandToolList").css({display: "none"});
			$(".bhvCollapseToolList").css({display: "block"});
			$(".toolListTable").slideDown("fast");
			return false;
		}
	);
	$(".bhvCollapseToolList").click(
		function() {
			$(".bhvCollapseToolList").css({display: "none"});
			$(".bhvExpandToolList").css({display: "block"});
			$(".toolListTable").slideUp("fast");
			return false;
		}
	);

	// Bind onMouseOver and onMouseOut handlers for all anchors with the title attribute
	$("a[@title]").each(
		function(i) {
			var origTitle = $(this).attr("title");
			$(this).hover(
				function() {
					createTip(this,i);
				},
				function() {
					destroyTip(this,i,origTitle);
				}
			);
		}
	);
});
