	$(document).ready(function() 
    { 
        $("table.sortable").tablesorter(); 
		/*$("table.sortable").addCount(); */
		$("table.clasificacion").addCount();
		$("table.maximochavista").addCount();

		$("tr").hover(function() {
				 $(this).addClass("resaltado");
			},
			function() {
				$(this).removeClass("resaltado");
		});
		
		$("table.clasificacion tbody tr").bind("click", function(){ 
			$url = $("table.clasificacion tbody tr th a").attr("href");
			window.location = $url;
		});

// Pestanas
		$(function () {
			var tabContainers = $('div.tabs > div');
			tabContainers.hide().filter(':first').show();
                        
			$('div.tabs ul.tabNavigation a').click(function () {
				tabContainers.hide();
				tabContainers.filter(this.hash).show();
				$('div.tabs ul.tabNavigation a').removeClass('selected');
				$(this).addClass('selected');
				return false;
			}).filter(':first').click();
		});
    } 
	);
	
(function($){
	$.fn.extend({
		addCount: function() {
			return $(this).each(function(){
				if($(this).is('table')){
					$('thead th:first, thead td:first', this).each(function(){
						if($(this).is('td'))
							$(this).before('<td rowspan="'+$('thead tr').length+'">#</td>');
						else if($(this).is('th'))
							$(this).before('<th rowspan="'+$('thead tr').length+'">#</th>');
					});
	
					$('tbody th:first-child', this).each(function(i){
						$(this).before('<td>'+(i+1)+'</td>');
					});
				}
			});
		}
	});
})(jQuery);