jQuery.fn.alternateTableColor = function(){
	// Alternating row colors on table
	$('table.alternate > tbody > tr:even').removeClass('even odd');
	$('table.alternate > tbody > tr:odd').removeClass('even odd');	

	$('table.alternate > tbody > tr:even').addClass('even');
	$('table.alternate > tbody > tr:odd').addClass('odd');
};

jQuery.fn.tableHover = function() {
	// Add hover to table rows
	$('table.hover tr').hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	})
};

$(document).ready(function(){
	//Activate tabs
	init_tabs()

	// Alternate table row colors
	$(document).alternateTableColor();

	// Table hover
	$(document).tableHover();

	// Focus on first text input
	$('form:not(.filter) :input.text:not(.nofocus):visible:first').focus();
});

function init_tabs() {
	$('.tabs').tabs();
	$('.tabs li').each(
		function(index){
			if ($(this).hasClass('selected')) {				
				$('.tabs').tabs("select", index );
			}
		}
	);
}

