	jQuery(document).ready(function(){ 



		
		/*----------------------------------
		// Tabs
		/*----------------------------------*/
				
		// Get selected tab from cookie
		var cookie_string = $.cookies.get('selected_tab');
				
		if (cookie_string) {
			selected_tab = cookie_string; 
		} else {
			selected_tab = 0;
		}	

		// draw tabs				
		var $tabs = $('#gridcontent').tabs({
			selected:selected_tab			
		});
				
		/*----------------------------------
		// Format Team Links to Team Page
		/*----------------------------------*/
				
		linkTeamName = function(cellvalue, options, rowObject){
 		    team_id = rowObject[8];
 		    return '<a href="teams/getTeamProfile/' + team_id + '/">' + cellvalue + '</a>'; 
		}

		/*---------------------------------------------
		// Format SOS to SOS section on Team Page
		/*-------------------------------------------*/

		colorSOS = function(cellvalue, options, rowObject) {
			position = rowObject[1];
						
			switch (position) {
				case 'QB':
					return "<div style='background-color:#94CDF6;'>" + cellvalue + "</div>";
				break;

				case 'RB':
				case 'WR':
				case 'TE':
					return "<div style='background-color:#A0F2A6;'>" + cellvalue + "</div>";
				break;

				case 'PK':
					return "<div style='background-color:#FBC684;'>" + cellvalue + "</div>";
				break;

				case 'DE':
					return "<div style='background-color:#F8F672;'>" + cellvalue + "</div>";
				break;
			}		
		}

		/*---------------------------------------------
		// Format Tieres
		/*-------------------------------------------*/

		formatTiers = function(cellvalue, options, rowObject) {
			
			
			switch (rowObject[5]) {
			
				case '1':
				return "<div style='background-color:#D8F3C9;'>" + cellvalue + "</div>";  //Green
				break;
				
				case '2':
				return "<div style='background-color:#FFFFBE;'>" + cellvalue + "</div>";  //Yellow
				break;
				
				case '3':
				return "<div style='background-color:#C5EFFD;'>" + cellvalue + "</div>";  //Blue
				break;
				
				case '4':
				return "<div style='background-color:#FFCF75;'>" + cellvalue + "</div>";  //Orange
				break;
				
				case '5':
				return "<div style='background-color:#E49EF6;'>" + cellvalue + "</div>";  //Purple
				break;																
			
   			  default:
       		  return cellvalue;
			
			
			}
			
		}
		

		/*---------------------------------------------
		// Format Arrows for Stock Report
		/*-------------------------------------------*/
			
		formatStockReport = function(cellvalue, options, rowObject) {
			switch (cellvalue) {
				
				case 'N':
					return '&nbsp';
				break;
				
				case 'U':
					return '<img src="/images/bigboard/uparrow.gif">';
				break;
				
				case 'D':
					return '<img src="/images/bigboard/downarrow.gif">';
				break;
			
			}
		}	


		/*---------------------------------------------
		// Format Red Cross for Injury Report
		/*-------------------------------------------*/
			
		formatInjuryStatus = function(cellvalue, options, rowObject) {
			
			if (cellvalue == 'I') {	
			
				return '<img src="/images/bigboard/redcross.gif">';
			
			} else {
			
				return '&nbsp';
			}
		}	


		/*---------------------------------------------
		// Format Blue Calculated Field Values
		/*-------------------------------------------*/
			
		makeBoldBlue = function(cellvalue, options, rowObject) {
			return "<div style='font-weight:bold; Color:#002EB8;'>" + cellvalue + "</div>"
		}			

		/*---------------------------------------------
		// Format Red Bye Weeks
		/*-------------------------------------------*/

		makeRed = function(cellvalue, options, rowObject) {
			return "<div style='Color:#D60000;'>" + cellvalue + "</div>"
		}

		/*---------------------------------------------
		// Add QB ID Hidden Field
		/*-------------------------------------------*/

		addQB_IDField = function(cellvalue, options, rowObject) {
			return "<input type='hidden' name='qb_id[]' value='" + cellvalue + "'>" + cellvalue
		}

		/*---------------------------------------------
		// Add RB ID Hidden Field
		/*-------------------------------------------*/

		addRB_IDField = function(cellvalue, options, rowObject) {
			return "<input type='hidden' name='rb_id[]' value='" + cellvalue + "'>" + cellvalue
		}
		
		/*---------------------------------------------
		// Add TE ID Hidden Field
		/*-------------------------------------------*/

		addTE_IDField = function(cellvalue, options, rowObject) {
			return "<input type='hidden' name='te_id[]' value='" + cellvalue + "'>" + cellvalue
		}


		/*---------------------------------------------
		// Add WR ID Hidden Field
		/*-------------------------------------------*/

		addWR_IDField = function(cellvalue, options, rowObject) {
			return "<input type='hidden' name='wr_id[]' value='" + cellvalue + "'>" + cellvalue
		}

		/*---------------------------------------------
		// Add PK ID Hidden Field
		/*-------------------------------------------*/

		addPK_IDField = function(cellvalue, options, rowObject) {
			return "<input type='hidden' name='pk_id[]' value='" + cellvalue + "'>" + cellvalue
		}

		/*---------------------------------------------
		// Add DE ID Hidden Field
		/*-------------------------------------------*/

		addDE_IDField = function(cellvalue, options, rowObject) {
			return "<input type='hidden' name='de_id[]' value='" + cellvalue + "'>" + cellvalue
		}



		/*---------------------------------------------
		// Toggle Filter
		/*-------------------------------------------*/
				
			$("#show_filters").click(function () {
				
     			$("#filters").slideToggle(800);
				$(this).text($(this).text() == 'Hide Player Filters' ? 'Show Player Filters' : 'Hide Player Filters');
     			return false;
    		});
   

		/*---------------------------------------------
		// Attach Filter Selections to _POST
		/*-------------------------------------------*/
	
		$("#enter_filters").click(function () {
			
			$formdata = $("#filters").formHash()
			$("#QB").setPostData($formdata);
			$("#QB").trigger("reloadGrid"); 
			$("#RB").setPostData($formdata);
			$("#RB").trigger("reloadGrid"); 
			$("#WR").setPostData($formdata);
			$("#WR").trigger("reloadGrid"); 
			$("#TE").setPostData($formdata);
			$("#TE").trigger("reloadGrid"); 
			$("#PK").setPostData($formdata);
			$("#PK").trigger("reloadGrid"); 
			$("#DE").setPostData($formdata);
			$("#DE").trigger("reloadGrid"); 
			
			$("#filters").slideUp(800);
			$("#show_filters").text("Show Player Filters");		
			return false;
		});

			
			
		/*---------------------------------------------
		// QB Grid
		/*-------------------------------------------*/


		

		var lastselqb;
		$("#QB").jqGrid({
			 url:'http://www.collegefootballgeek.com/bigboard/index.php/players/inseasonloadplayers/QB/', 
			 datatype: 'json', 
			 mtype: 'POST', 
			 colNames:['ID',
			 		   'pos',
			 		   'All-FBS<br>Rank',
			 		   'Injury<br>Status',
			 		   'Stock',
			 		   'Tier',
			 		   'Pos',
			 		   'Name',
			 		   'team_id',
			 		   'Class',
			 		   'School',
			 		   'Conf.',
			 		   'Next Opp.',
			 		    'Opp Tot<br>Def Strength',
			 		   'Opp Pass<br>Def Strength',
			 		   'Pass<br>Yds',
			 		   'Pass<br>TD',
			 		   'INT',
			 		   'Rush<br>Yds',
			 		   'Rush<br>TD',
			 		   'Proj.<br>Total<br>Ftsy-Pts',
			 		   'Proj.<br>Fantasy<br>PPG'
			 		   ],
			 		    
			 colModel :[
			 	 {name:'id', index:'player_id', hidden:true, formatter:addQB_IDField},
			 	 {name:'pos', index:'pos', hidden:true},
			 	 {name:'rank', index:'rank', width:35, align:'center'},
			 	 {name:'injury_status', index:'injury_status', width:35, align:'center', formatter:formatInjuryStatus}, 
			 	 {name:'stock_report', index:'stock_report', width:38, align:'center', formatter:formatStockReport}, 
			 	 {name:'tier', index:'tier', width: 38, align:'center', hidden:true},
			 	 {name:'position', index:'position', width:40, align:'center', hidden:true},
			 	 {name:'full_name', index:'full_name', width:125, align:'left', formatter:formatTiers}, 
			     {name:'team_id', index:'team_id', hidden:true},
			 	 {name:'class', index:'class', width:38, align:'center'},
			     {name:'school', index:'school', width:50, formatter:linkTeamName}, 
			 	 {name:'conference', index:'conference', width:50, align:'center'}, 
			 	 {name:'opponent', index:'opponent', width:50, align:'center', sortable:false, hidden:true}, 
			 	 {name:'opponent_sos_tot', index:'opponent_sos_tot', width:55, align:'center', sortable:false, hidden:true}, 			 	 
			 	 {name:'opponent_sos_pass', index:'opponent_sos_pass', width:50, align:'center', sortable:false, hidden:true}, 				 	 
			 	 {name:'pass_yds', index:'pass_yds', width:40, align:'center', hidden:true},
			 	 {name:'pass_td', index:'pass_td', width:40, align:'center', hidden:true},
			 	 {name:'ints', index:'ints', width:35, align:'center', hidden:true},
			 	 {name:'rush_yds', index:'rush_yds', width:40, align:'center', hidden:true},
			 	 {name:'rush_td', index:'rush_td', width:40, align:'center', hidden:true},			 	 
			 	 {name:'tot_fant_pts', index:'tot_fant_pts', align:'center', width:55, formatter:makeBoldBlue, hidden:true}, 
			 	 {name:'fant_ppg', index:'fant_ppg', width:55, align:'center',  formatter:makeBoldBlue, hidden:true}
			 	 ], 
			 	 			 	 
			 	 
			 pager: jQuery('#pager-1'), 
			 height: 550,
			 width: 750,
			 rowNum:25, 
			 sortname: 'rank', 
			 sortorder: 'asc', 
			 viewrecords: true, 
			 rownumbers: true,			 
			 altRows: true,
			 gridview: true, 
			 imgpath: 'themes/basic/images'
		});



		/*---------------------------------------------
		// RB Grid
		/*-------------------------------------------*/


		

		var lastselqb;
		$("#RB").jqGrid({
			 url:'http://www.collegefootballgeek.com/bigboard/index.php/players/inseasonloadplayers/RB/', 
			 datatype: 'json', 
			 mtype: 'POST', 
			 colNames:['ID',
			 		   'pos',
			 		   'All-FBS<br>Rank',
			 		   'Injury<br>Status',
			 		   'Stock',
			 		   'Tier',
			 		   'Pos',
			 		   'Name',
			 		   'team_id',
			 		   'Class',
			 		   'School',
			 		   'Conf.',
			 		   'Next Opp.',
			 		    'Opp Tot<br>Def Strength',
			 		   'Opp Rush<br>Def Strength',
			           'Rush<br>Yds',
			           'Rush<br>TD',
			           'Rec.',
			           'Rec.<br>Yds',
			           'Rec.<br>TDs',
			 		   'Proj.<br>Total<br>Ftsy-Pts',
			 		   'Proj.<br>Fantasy<br>PPG'
			 		   ],
			 		    
			 colModel :[
			 	 {name:'id', index:'player_id', hidden:true, formatter:addRB_IDField},
			 	 {name:'pos', index:'pos', hidden:true},
			 	 {name:'rank', index:'rank', width:35, align:'center'},
			 	 {name:'injury_status', index:'injury_status', width:35, align:'center', formatter:formatInjuryStatus}, 
			 	 {name:'stock_report', index:'stock_report', width:38, align:'center', formatter:formatStockReport}, 
			 	 {name:'tier', index:'tier', width: 38, align:'center', hidden:true},
			 	 {name:'position', index:'position', width:40, align:'center', hidden:true},
			 	 {name:'full_name', index:'full_name', width:125, align:'left', formatter:formatTiers}, 
			     {name:'team_id', index:'team_id', hidden:true},
			 	 {name:'class', index:'class', width:38, align:'center'},
			     {name:'school', index:'school', width:50, formatter:linkTeamName}, 
			 	 {name:'conference', index:'conference', width:50, align:'center'}, 
			 	 {name:'opponent', index:'opponent', width:50, align:'center', sortable:false, hidden:true}, 
			 	 {name:'opponent_sos_tot', index:'opponent_sos_tot', width:55, align:'center', sortable:false, hidden:true}, 			 	 
			 	 {name:'opponent_sos_rush', index:'opponent_sos_rush', width:50, align:'center', sortable:false, hidden:true}, 		 	 
			 	 {name:'rush_yds', index:'rush_yds', width:40, align:'center', hidden:true},
			 	 {name:'rush_td', index:'rush_td', width:40, align:'center', hidden:true},
			 	 {name:'rec', index:'rec', width:40, align:'center', hidden:true},
			 	 {name:'rec_yds', index:'rec_yds', width:40, align:'center', hidden:true},
			 	 {name:'rec_td', index:'rec_td', width:40, align:'center', hidden:true},	 
			 	 {name:'tot_fant_pts', index:'tot_fant_pts', align:'center', width:55, formatter:makeBoldBlue, hidden:true}, 
			 	 {name:'fant_ppg', index:'fant_ppg', width:55, align:'center',  formatter:makeBoldBlue, hidden:true}
			 	 ], 
			 	 			 	 
			 	 
			 pager: jQuery('#pager-2'), 
			 height: 550,
			 width: 750,
			 rowNum:25, 
			 sortname: 'rank', 
			 sortorder: 'asc', 
			 viewrecords: true, 
			 rownumbers: true,	
			 altRows: true,
			 gridview: true, 
			 imgpath: 'themes/basic/images'
		});


		/*---------------------------------------------
		// WR Grid
		/*-------------------------------------------*/



		var lastselqb;
		$("#WR").jqGrid({
			 url:'http://www.collegefootballgeek.com/bigboard/index.php/players/inseasonloadplayers/WR/', 
			 datatype: 'json', 
			 mtype: 'POST', 
			 colNames:['ID',
			 		   'pos',
			 		   'All-FBS<br>Rank',
			 		   'Injury<br>Status',
			 		   'Stock',
			 		   'Tier',
			 		   'Pos',
			 		   'Name',
			 		   'team_id',
			 		   'Class',
			 		   'School',
			 		   'Conf.',
			 		   'Next Opp.',
			 		    'Opp Tot<br>Def Strength',
			 		    'Opp Pass<br>Def Strength',
			           'Rush<br>Yds',
			           'Rush<br>TD',
			           'Rec.',
			           'Rec.<br>Yds',
			           'Rec.<br>TDs',
			 		   'Proj.<br>Total<br>Ftsy-Pts',
			 		   'Proj.<br>Fantasy<br>PPG'
			 		   ],
			 		    
			 colModel :[
			 	 {name:'id', index:'player_id', hidden:true, formatter:addWR_IDField},
			 	 {name:'pos', index:'pos', hidden:true},
			 	 {name:'rank', index:'rank', width:35, align:'center'},
			 	 {name:'injury_status', index:'injury_status', width:35, align:'center', formatter:formatInjuryStatus}, 
			 	 {name:'stock_report', index:'stock_report', width:38, align:'center', formatter:formatStockReport}, 
			 	 {name:'tier', index:'tier', width: 38, align:'center', hidden:true},
			 	 {name:'position', index:'position', width:40, align:'center', hidden:true},
			 	 {name:'full_name', index:'full_name', width:125, align:'left', formatter:formatTiers}, 
			     {name:'team_id', index:'team_id', hidden:true},
			 	 {name:'class', index:'class', width:38, align:'center'},
			     {name:'school', index:'school', width:50, formatter:linkTeamName}, 
			 	 {name:'conference', index:'conference', width:50, align:'center'}, 
			 	 {name:'opponent', index:'opponent', width:50, align:'center', sortable:false, hidden:true}, 
			 	 {name:'opponent_sos_tot', index:'opponent_sos_tot', width:55, align:'center', sortable:false, hidden:true}, 			 	 
			 	 {name:'opponent_sos_pass', index:'opponent_sos_pass', width:50, align:'center', sortable:false, hidden:true}, 	 	 
			 	 {name:'rush_yds', index:'rush_yds', width:40, align:'center', hidden:true},
			 	 {name:'rush_td', index:'rush_td', width:40, align:'center', hidden:true},
			 	 {name:'rec', index:'rec', width:40, align:'center', hidden:true},
			 	 {name:'rec_yds', index:'rec_yds', width:40, align:'center', hidden:true},
			 	 {name:'rec_td', index:'rec_td', width:40, align:'center', hidden:true},	 	 
			 	 {name:'tot_fant_pts', index:'tot_fant_pts', align:'center', width:55, formatter:makeBoldBlue, hidden:true}, 
			 	 {name:'fant_ppg', index:'fant_ppg', width:55, align:'center',  formatter:makeBoldBlue, hidden:true}
			 	 ], 
			 	 			 	 
			 	 
			 pager: jQuery('#pager-3'), 
			 height: 550,
			 width: 750,
			 rowNum:25, 
			 sortname: 'rank', 
			 sortorder: 'asc', 
			 viewrecords: true,
			 rownumbers: true, 
			 altRows: true,
			 gridview: true, 
			 imgpath: 'themes/basic/images'
		});



		/*---------------------------------------------
		// TE Grid
		/*-------------------------------------------*/


		

		var lastselqb;
		$("#TE").jqGrid({
			 url:'http://www.collegefootballgeek.com/bigboard/index.php/players/inseasonloadplayers/TE/', 
			 datatype: 'json', 
			 mtype: 'POST', 
			 colNames:['ID',
			 		   'pos',
			 		   'All-FBS<br>Rank',
			 		   'Injury<br>Status',
			 		   'Stock',
			 		   'Tier',
			 		   'Pos',
			 		   'Name',
			 		   'team_id',
			 		   'Class',
			 		   'School',
			 		   'Conf.',
			 		   'Next Opp.',
			 		    'Opp Tot<br>Def Strength',
			 		    'Opp Pass<br>Def Strength',
			           'Rush<br>Yds',
			           'Rush<br>TD',
			           'Rec.',
			           'Rec.<br>Yds',
			           'Rec.<br>TDs',
			 		   'Proj.<br>Total<br>Ftsy-Pts',
			 		   'Proj.<br>Fantasy<br>PPG'
			 		   ],
			 		    
			 colModel :[
			 	 {name:'id', index:'player_id', hidden:true, formatter:addTE_IDField},
			 	 {name:'pos', index:'pos', hidden:true},
			 	 {name:'rank', index:'rank', width:35, align:'center'},
			 	 {name:'injury_status', index:'injury_status', width:35, align:'center', formatter:formatInjuryStatus}, 
			 	 {name:'stock_report', index:'stock_report', width:38, align:'center', formatter:formatStockReport}, 
			 	 {name:'tier', index:'tier', width: 38, align:'center', hidden:true},
			 	 {name:'position', index:'position', width:40, align:'center', hidden:true},
			 	 {name:'full_name', index:'full_name', width:125, align:'left', formatter:formatTiers}, 
			     {name:'team_id', index:'team_id', hidden:true},
			 	 {name:'class', index:'class', width:38, align:'center'},
			     {name:'school', index:'school', width:50, formatter:linkTeamName}, 
			 	 {name:'conference', index:'conference', width:50, align:'center'}, 
			 	 {name:'opponent', index:'opponent', width:50, align:'center', sortable:false, hidden:true}, 
			 	 {name:'opponent_sos_tot', index:'opponent_sos_tot', width:55, align:'center', sortable:false, hidden:true}, 			 	 
			 	 {name:'opponent_sos_pass', index:'opponent_sos_pass', width:50, align:'center', sortable:false, hidden:true}, 	 	 
			 	 {name:'rush_yds', index:'rush_yds', width:40, align:'center', hidden:true},
			 	 {name:'rush_td', index:'rush_td', width:40, align:'center', hidden:true},
			 	 {name:'rec', index:'rec', width:40, align:'center', hidden:true},
			 	 {name:'rec_yds', index:'rec_yds', width:40, align:'center', hidden:true},
			 	 {name:'rec_td', index:'rec_td', width:40, align:'center', hidden:true},	 	  
			 	 {name:'tot_fant_pts', index:'tot_fant_pts', align:'center', width:55, formatter:makeBoldBlue, hidden:true}, 
			 	 {name:'fant_ppg', index:'fant_ppg', width:55, align:'center',  formatter:makeBoldBlue, hidden:true}
			 	 ], 
			 	 			 	 
			 	 
			 pager: jQuery('#pager-4'), 
			 height: 550,
			 width: 750,
			 rowNum:25, 
			 sortname: 'rank', 
			 sortorder: 'asc', 
			 viewrecords: true,
			 rownumbers: true, 
			 altRows: true,
			 gridview: true, 
			 imgpath: 'themes/basic/images'
		});

		
		/*---------------------------------------------
		// PK Grid
		/*-------------------------------------------*/


		

		var lastselqb;
		$("#PK").jqGrid({
			 url:'http://www.collegefootballgeek.com/bigboard/index.php/players/inseasonloadplayers/PK/', 
			 datatype: 'json', 
			 mtype: 'POST', 
			 colNames:['ID',
			 		   'pos',
			 		   'All-FBS<br>Rank',
			 		   'Injury<br>Status',
			 		   'Stock',
			 		   'Tier',
			 		   'Pos',
			 		   'Name',
			 		   'team_id',
			 		   'Class',
			 		   'School',
			 		   'Conf.',
			 		   'Next Opp.',
			 		    'Opp Tot<br>Def Strength',
		               'PAT<br>Made',
			           'FG<br>Made',
			 		   'Proj.<br>Total<br>Ftsy-Pts',
			 		   'Proj.<br>Fantasy<br>PPG'
			 		   ],
			 		    
			 colModel :[
			 	 {name:'id', index:'player_id', hidden:true, formatter:addPK_IDField},
			 	 {name:'pos', index:'pos', hidden:true},
			 	 {name:'rank', index:'rank', width:35, align:'center'},
			 	 {name:'injury_status', index:'injury_status', width:35, align:'center', formatter:formatInjuryStatus}, 
			 	 {name:'stock_report', index:'stock_report', width:38, align:'center', formatter:formatStockReport}, 
			 	 {name:'tier', index:'tier', width: 38, align:'center', hidden:true},
			 	 {name:'position', index:'position', width:40, align:'center', hidden:true},
			 	 {name:'full_name', index:'full_name', width:125, align:'left', formatter:formatTiers}, 
			     {name:'team_id', index:'team_id', hidden:true},
			 	 {name:'class', index:'class', width:38, align:'center'},
			     {name:'school', index:'school', width:50, formatter:linkTeamName}, 
			 	 {name:'conference', index:'conference', width:50, align:'center'}, 
			 	 {name:'opponent', index:'opponent', width:50, align:'center', sortable:false, hidden:true}, 
			 	 {name:'opponent_sos_tot', index:'opponent_sos_tot', width:55, align:'center', sortable:false, hidden:true}, 			 	 
			 	 {name:'pat_made', index:'pat_made', width:60, align:'center', hidden:true},
			 	 {name:'fg_made', index:'fg_made', width:60, align:'center', hidden:true},
			 	 {name:'tot_fant_pts', index:'tot_fant_pts', align:'center', width:55, formatter:makeBoldBlue, hidden:true}, 
			 	 {name:'fant_ppg', index:'fant_ppg', width:55, align:'center',  formatter:makeBoldBlue, hidden:true}
			 	 ], 
			 	 			 	 
			 	 
			 pager: jQuery('#pager-5'), 
			 height: 550,
			 width: 750,
			 rowNum:25, 
			 sortname: 'rank', 
			 sortorder: 'asc', 
			 viewrecords: true,
			 rownumbers: true, 
			 altRows: true,
			 gridview: true, 
			 imgpath: 'themes/basic/images'
		});


		/*---------------------------------------------
		// DE Grid
		/*-------------------------------------------*/


		

		var lastselqb;
		$("#DE").jqGrid({
			 url:'http://www.collegefootballgeek.com/bigboard/index.php/players/inseasonloadplayers/DE/', 
			 datatype: 'json', 
			 mtype: 'POST', 
			 colNames:['ID',
			 		   'pos',
			 		   'All-FBS<br>Rank',
			 		   'Injury<br>Status',
			 		   'Stock',
			 		   'Tier',
			 		   'Pos',
			 		   'Name',
			 		   'team_id',
			 		   'Class',
			 		   'School',
			 		   'Conf.',
			 		   'Next Opp.',
			 		   'Opp Tot<br>Off Strength',
	                   'PPG<br>Allowed',
			           'YPG<br>Allowed',
			           'Fumb.<br>Rec.',
			           'INT',
			           'Sacks',
			           'Def.<br>Safety',
			           'TD<br>Punt',
			           'TD<br>Kickoff',
			           'Def.<br>TD',
			 		   'Proj.<br>Total<br>Ftsy-Pts',
			 		   'Proj.<br>Fantasy<br>PPG'
			 		   ],
			 		    
			 colModel :[
			 	 {name:'id', index:'player_id', hidden:true, formatter:addDE_IDField},
			 	 {name:'pos', index:'pos', hidden:true},
			 	 {name:'rank', index:'rank', width:35, align:'center'},
			 	 {name:'injury_status', index:'injury_status', width:35, align:'center', formatter:formatInjuryStatus}, 
			 	 {name:'stock_report', index:'stock_report', width:38, align:'center', formatter:formatStockReport}, 
			 	 {name:'tier', index:'tier', width: 38, align:'center', hidden:true},
			 	 {name:'position', index:'position', width:40, align:'center', hidden:true},
			 	 {name:'full_name', index:'full_name', width:125, align:'left', formatter:formatTiers}, 
			     {name:'team_id', index:'team_id', hidden:true},
			 	 {name:'class', index:'class', width:38, align:'center', hidden:true},
			     {name:'school', index:'school', width:50, formatter:linkTeamName}, 
			 	 {name:'conference', index:'conference', width:50, align:'center'}, 
			 	 {name:'opponent', index:'opponent', width:50, align:'center', sortable:false, hidden:true}, 
			 	 {name:'opponent_sos_off', index:'opponent_sos_off', width:60, align:'center', sortable:false, hidden:true}, 			 	 
			 	 {name:'def_pa_0', index:'def_pa_0', width:50, align:'center', hidden:true},
			 	 {name:'def_ypg_allowed', index:'def_ypg_allowed', width:50, align:'center', hidden:true},
			 	 {name:'def_fumb', index:'def_fumb', width:40, align:'center', hidden:true},
			 	 {name:'def_int', index:'def_int', width:40, align:'center', hidden:true},
			 	 {name:'def_sacks', index:'def_sacks', width:40, align:'center', hidden:true},
			 	 {name:'def_safety', index:'def_safety', width:40, align:'center', hidden:true},
			 	 {name:'def_punt', index:'def_punt', width:40, align:'center', hidden:true},
			 	 {name:'def_kickoff', index:'def_kickoff', width:45, align:'center', hidden:true},
			 	 {name:'def_td', index:'def_td', width:40, align:'center', hidden:true},
			 	 {name:'tot_fant_pts', index:'tot_fant_pts', align:'center', width:55, formatter:makeBoldBlue, hidden:true}, 
			 	 {name:'fant_ppg', index:'fant_ppg', width:55, align:'center',  formatter:makeBoldBlue, hidden:true}
			 	 ], 
			 	 			 	 
			 	 
			 pager: jQuery('#pager-6'), 
			 height: 550,
			 width: 750,
			 rowNum:25, 
			 sortname: 'rank', 
			 sortorder: 'asc', 
			 viewrecords: true,
			 rownumbers: true, 
			 altRows: true,
			 gridview: true, 
			 edithidden:true,
			 imgpath: 'themes/basic/images',
			 editurl: 'admin/inseasonupdateplayer',
			onSelectRow : function(id){
				if(id && id!==lastselqb){
				recid = id;
				jQuery('#DE').editRow(id,true);
				jQuery('#DE').saveRow(lastselqb); 
			lastselqb = id;      				}
    		}
		});
		
		    var mygrid=jQuery('#DE')[0];
			mygrid.updateColumns();	




		/*----------------------------------
		// Toggle Classes
		/*----------------------------------*/
	
		$('.select_class').click(function() {
		
		var $checkboxes = $(".class");

		if (this.checked) {
				$(this).next().text(' Select All');
				$checkboxes.attr('checked', 'true');
			} else {
				$(this).next().text(' Select All');
				$checkboxes.attr('checked', '')
			};
		
		});
		
		$('.class').click(function() {
		
			$('.select_class').attr('checked', '');
		
		});



		/*----------------------------------
		// Toggle Conferences
		/*----------------------------------*/
	
		$('.toggle_conf').click(function() {
		
		var $conf = $(this).attr("title");
		//alert($conf);
		var $checkboxes = $("." + $conf + "");

		if (this.checked) {
				$(this).next().text(' De-Select All');
				$checkboxes.attr('checked', 'true');
			} else {
				$(this).next().text(' Select All');
				$checkboxes.attr('checked', '');
			};
		
		
		});



		/*----------------------------------
		// Toggle ALL and BCS Teams
		/*----------------------------------*/
	
		
		$('.select').click(function() {
		
			$type = $(this).attr("title");
			var $checkboxes = $('input:checkbox:not(.class)');
			
			switch ($type) {
			case 'ALL':			
				if (this.checked) {
					$(this).next().text(' De-Select All Schools');
					$checkboxes.attr('checked', 'true');
					$('#select_bcs').attr('checked', '');
					$('#select_bcs').next().text(' Select BCS Schools');
					$('.toggle_conf').next().text('De-Select All');
				} else {
					$(this).next().text(' Select All Schools');
					$checkboxes.attr('checked', '');
					$('.toggle_conf').next().text('Select All');
				};
				break;
				
			case 'BCS':	

				var $BCS_checkboxes = $('.BCS');
				var $BCS_toggle_checkboxes = $('.toggle_bcs');
		
				if (this.checked) {

					$checkboxes.attr('checked', '');
					$('#select_all').next().text(' Select All Schools'); //*
					$('.toggle_conf').next().text('Select All');
					$('#select_bcs').attr('checked', 'true');				
				
				
					$BCS_checkboxes.attr('checked', 'true');
					$(this).next().text(' De-Select BCS Schools');
					$BCS_toggle_checkboxes.attr('checked', 'true');
					$BCS_toggle_checkboxes.next().text(' De-Select All');
			
				} else {
				
					$BCS_checkboxes.attr('checked', '');
					$(this).next().text(' Select BCS Schools');
					$BCS_toggle_checkboxes.attr('checked', '');
					$BCS_toggle_checkboxes.next().text(' Select All');
				};
			
			}
		});


		/*----------------------------------
		// Set Cookies
		/*----------------------------------*/


		$(window).unload( function () {		
					
			var selected = $tabs.tabs('option', 'selected');
			$.cookies.set('selected_tab', selected);
				
		});	//end window unload			
	
	});	//end document.ready
