jQuery(document).ready(function() {category_row();});

function category_row() {
	// category row hide
	jQuery('tbody.cat > tr:not(tr:has(th))').hide();
	jQuery('#timeline_tbody').hide();
	jQuery('#calResults th[colspan=4]')
	.css('background','url(/images/ui/th-plus.gif) no-repeat 21px center');
	jQuery('tbody.cat:last th')
	.css('borderBottom', '#d5d5d5 solid 1px');
	    
	// click category in category view
	jQuery('#calResults tbody.cat > tr:first-child').click(function() {
	var catexp = jQuery(this).nextAll('');
	
	// if category expand is hidden
	if (catexp.css('display') == 'none') {
	jQuery(this).children().css('background','url(/images/ui/th-minus.gif) no-repeat 21px center').css('borderBottom','#d5d5d5 dotted 1px');
	catexp.not('tr.moreInfo').show();
	jQuery('#timeline > td, tbody.cat > tr > td').css('borderBottom', '#d5d5d5 dotted 1px');
	
	// else if category expand is showing
	} else if (catexp.css('display') != 'none') {
	jQuery(this).children().css('background','url(/images/ui/th-plus.gif) no-repeat 21px center');
	jQuery(this).nextAll().fadeOut('fast');
	}
	
	});
	
}
