//**********************************************************************************************************************
/**
* DOCUMENT: /core/plugins/sports/front/sports.front.js
* DEVELOPED BY: Ryan Stemkoski
* COMPANY: Zipline Interactive
* EMAIL: ryan@gozipline.com
* PHONE: 509-321-2849
* DATE: 4/28/2010
* DESCRIPTION: This document has all of the javascript functions required for the sports plugin.
*/
//***********************************************************************************************************************

//***********************************************************************************************************************
//ON DOCUMENT READY FUNCTIONS
//***********************************************************************************************************************
$(function() {
	
	//*******************************************************************************************************************
	// TABS
	//*******************************************************************************************************************  	
	$("#tabs").tabs();
	
	//*******************************************************************************************************************
	// CLASS AND COMMITTED DROPDOWN
	//*******************************************************************************************************************  	
	$('#roster_dropdown').live('change', function() {
		var sport = $(".roster_box").attr("rel");
		var roster_class = $(this).val();
		$.ajax({
			type: "GET",
			url: "/index.php",
			data: "action=output_roster&sport="+sport+"&class="+roster_class,
			success: function(response) {
				$(".roster_box").html(response);
			}
		})
	});
	
	$('input[name="committed_roster"]:checked').live('change', function() {
		var sport = $('.roster_box').attr("rel");
		var committed = $(this).val();
		$.ajax({
			type: "GET",
			url: "/index.php",
			data: "action=output_recruits&sport="+sport+"&committed="+committed,
			success: function(response) {
				$(".roster_box").html(response);
			}
		})
	});
	
	//*******************************************************************************************************************
	// LINKS TO PLAYER PROFILES
	//*******************************************************************************************************************
	$('.roster_player').live('click', function(){
		var player = $(this).attr('id');
		window.location = '/players/'+player;
	});
	
});
