$(document).ready(function(){
	//Rounded corners for rankings
  // $('.rounded').corners("transparent");

 //Selected the navigation
  // $('ol.nav-main li a.selected').corners("30px");
	
	// Add utility first/last/alt classes to LIs.
	$("ul li:first-child").addClass("first");
	$("ul li:last-child").addClass("last");
	$("ul li:nth-child(even)").addClass("alt");
	$("table tr:nth-child(even)").addClass("alt");

	// Replace HRs with Divs in IE
		if (jQuery.browser.msie) {
			$("hr").wrap("<div class='hr'></div>");
		}
		
		// Tab_options and Tabs: Two DIVs that interact using Rels and IDs
		$(".tabs li:first-child").each(function(){
			$(this).addClass("current");
		});
		
		$(".tab-content").each(function(){
			$(this).children(":not(:first)").hide();	
		});
		
		$(".tabs a").click(function(){

			if ($(this).parent().hasClass("current") == false)
				{
					var thisTarget = $(this).attr("href");
					$(this).parents(".tabs").find('li.current').removeClass('current');
					$(this).parent().addClass('current');
					$(this).parents(".tabs").next().children(":visible").fadeOut(1, function() {
						$(thisTarget).fadeIn("fast");
					});
			}
			if(jQuery.browser.msie && jQuery.browser.version == '6.0') {
    		$(this).blur();
			}
			return false; 
		});
		
		//Reset button inside forms
		$("form .reset").click(function(){
			$(this).parents("form")[ 0 ].reset();
			return false;
		});
		
		$(".tab-controller").click(function(){
					var thisTarget = $(this).attr("href");
					if ($(".tabs a[href='"+ thisTarget +"']").parent().hasClass("current") == false) 
						{
							$(".tabs a[href='"+ thisTarget +"']").parents(".tabs").find('a.current').removeClass('current');
							$(".tabs a[href='"+ thisTarget +"']").parent().addClass('current');
							
							$(".tab-content").children(":visible").fadeOut(1, function() {
								$(thisTarget).fadeIn("fast");
							});
						}
					return false;
		});
		
		$(".legend-colors a").click(function(){
					var thisTarget = $(this).attr("class");
					$(".table-data td.highlight").removeClass("highlight");
					$(".table-data ." + thisTarget + "").parents("td").addClass("highlight");
					return false;
		});

		$(".table-results table").tablesorter({widgets: ['zebra','columnHighlight']}); 
		$(".table-results table th").addClass("th-link");
});


