/**
 * Making boxes with class col1 and col2 of equal height
 */
/* {{{ */
var max = 0;
$( '.col1, .col2' ).each( function()
{
	max = this.offsetHeight > max ? this.offsetHeight : max;
} ).css( 'height', ( max ) + 'px' );
/* }}} */

/**
 * Stripping tables
 */
/* {{{ */
$( '#content table:not(.static) tbody tr' ).hover( function() { $( this ).addClass( 'hover' ); }, function() { $( this ).removeClass( 'hover' ); } );
$( '#content table:not(.plain) tbody tr:odd' ).addClass( 'alt' );
/* }}} */

highlightMenu();

/**
 * Highlighting appropriate link of the menu, according
 * to the current URI.
 *
 * If the current URI does not have any match the first
 * element will be selected.
 */
function highlightMenu() /* {{{ */
{
	var uriparts = window.location.pathname;
	var found = false;
	
	$( '#mainnav a, #secnav a' ).each( function()
	{
		var href = $( this ).attr( 'href' );
		
		if( href == '/' )
		{
			return;
		}
		
		if( uriparts.indexOf( $( this ).attr( 'href' ) ) > -1 )
		{
			$( this ).addClass( 'current' );
			found = true;
			
			return false;
		}
	} );
	
	if( ! found )
	{
		$( '#mainnav a:eq(0)' ).addClass( 'current' );
	}
}
/* }}} */

