$(document).ready(function() {
	//Ben Code: method for coloring same season boxes
	//$("#dialog").dialog();
	//Redline here
	//$(".redline-g:last").css("color","red");
	//$(".redline-ab:last").css("color","red");
	//$(".redline-r:last").css("color","red");
	var rlr = $(".redline-g:last").text();
	$(".redline-g").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-ab:last").text();
	$(".redline-ab").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-babip:last").text();
	$(".redline-babip").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-ops:last").text();
	$(".redline-ops").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-r:last").text();
	$(".redline-r").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-h:last").text();
	$(".redline-h").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-h:last").css("color","red");
	//$(".redline-1b:last").css("color","red");
	var rlr = $(".redline-1b:last").text();
	$(".redline-1b").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-2b:last").css("color","red");
	var rlr = $(".redline-2b:last").text();
	$(".redline-2b").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-3b:last").css("color","red");
	var rlr = $(".redline-3b:last").text();
	$(".redline-3b").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-hr:last").text();
	$(".redline-hr").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-rbi:last").css("color","red");
	var rlr = $(".redline-rbi:last").text();
	$(".redline-rbi").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-tb:last").css("color","red");
	var rlr = $(".redline-tb:last").text();
	$(".redline-tb").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-bb:last").css("color","red");
	var rlr = $(".redline-bb:last").text();
	$(".redline-bb").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
//	$(".redline-so:last").css("color","red");
	var rlr = $(".redline-so:last").text();
	$(".redline-so").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
//	$(".redline-sb:last").css("color","red");
	var rlr = $(".redline-sb:last").text();
	$(".redline-sb").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-obp:last").css("color","red");
	var rlr = $(".redline-obp:last").text();
	$(".redline-obp").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-slg:last").css("color","red");
	var rlr = $(".redline-slg:last").text();
	$(".redline-slg").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-avg:last").css("color","red");
	var rlr = $(".redline-avg:last").text();
	$(".redline-avg").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-ip:last").text();
	$(".redline-ip").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-sv:last").text();
	$(".redline-sv").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-cg:last").text();
	$(".redline-cg").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-gs:last").text();
	$(".redline-gs").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-app:last").text();
	$(".redline-app").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	
	var rlr = $(".redline-w:last").text();
	$(".redline-w").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
		var rlr = $(".redline-l:last").text();
	$(".redline-l").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
		var rlr = $(".redline-er:last").text();
		$(".redline-er").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-era:last").text();
		$(".redline-era").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	var rlr = $(".redline-whip:last").text();
		$(".redline-whip").each(function(index) {
		if($(this).text() == rlr) {
			$(this).css("color","red");
		}
	});
	//$(".redline-g:last").css("color","red");
	//end redline
	
	var $stat_table_innards = $("#jq_id > tbody > tr").children();
	var counter = 0;
	var outer_name = '';
	var year_arr = new Array();
	$stat_table_innards.each(function(index) {
		//alert(this);
		var my_name = $(this).attr("name")
		if(my_name != null){
			if(year_arr[my_name] == null){
				year_arr[my_name] = 0;
			}
			year_arr[my_name] = year_arr[my_name] + 1;
			if(year_arr[my_name] >5) {
				//alert(year_arr[my_name]);
				//alert(my_name);
				$("td[name='"+my_name+"']").css("color","blue");
			}
		}
		//counter++;
	});
	
	//alert(counter);
	//End Ben Code
	$("#tabs").tabs();
	
	
	//Show Banner
	if ($(".main_image .desc").length){
		$(".main_image .desc").show(); //Show Banner
		$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity
	}

	//Click and Hover events for thumbnail list
	if ($(".image_thumb").length){
		$(".image_thumb ul li:first").addClass('active'); 
		$(".image_thumb ul li").click(function(){ 
			//Set Variables
			var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
			var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
			var imgDesc = $(this).find('.block').html(); 	//Get HTML of block
			var imgDescHeight = $(".main_image").find('.block').height();	//Calculate height of block	
			
			if ($(this).is(".active")) {  //If it's already active, then...
				return false; // Don't click through
			} else {
				//Animate the Teaser				
					$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
					$(".main_image .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
					$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
				});
			}
		
		
			$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
			$(this).addClass('active');  //add class of 'active' on this list only
			return false;
		
		}) .hover(function(){
			$(this).addClass('hover');
			}, function() {
			$(this).removeClass('hover');
		});
			
		//Toggle Teaser
		$("a.collapse").click(function(){
			$(".main_image .block").slideToggle();
			$("a.collapse").toggleClass("show");
		});
	}
	
	if ($("#slider1").length){
		featuredcontentslider.init({
					id: "slider1",  //id of main slider DIV
					contentsource: ["inline", ""],  //Valid values: ["inline", ""] or ["ajax", "path_to_file"]
					toc: "#increment",  //Valid values: "#increment", "markup", ["label1", "label2", etc]
					nextprev: ["Previous", "Next"],  //labels for "prev" and "next" links. Set to "" to hide.
					revealtype: "click", //Behavior of pagination links to reveal the slides: "click" or "mouseover"
					enablefade: [true, 0.2],  //[true/false, fadedegree]
					autorotate: [true, 4000],  //[true/false, pausetime]
					onChange: function(previndex, curindex){  //event handler fired whenever script changes slide
						//previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc)
						//curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc)
					}
		});
	}
	
	if ($(".stats_table").length){
		$(".stats_table tr:nth-child(odd)").addClass('zebra_2');
		$(".stats_table tr").hover( function() { $(this).addClass('hovered'); }, function() { $(this).removeClass('hovered'); });
		$(".stats_table tr").click( function() { if ($(this).hasClass('selected')) $(this).removeClass('selected'); else $(this).addClass('selected'); });
	}

	var has_cufon = false;
	if ($("h1").length){
		Cufon.replace('.content_wrap h1, .content_inside2 h1, .content2 h1', 'sigfont');
		has_cufon = true;
	}

	if (has_cufon)
		Cufon.now();

});//Close Function
function showPlayers(id) {
alert(id);
}

