<?php
  include("html_functions.php");

  ################## PAGE INITIALIZATION #########################
  $lgid=$_SESSION['lgid'];
  $lgpath=$_SESSION['lgpath'];
  $date=new Date($_SESSION['lgdate']);
  $lgyear=$_SESSION['lgyear'];

  if ($_SESSION['user_team_id']>0) {$team_id=$_SESSION['user_team_id'];}
  if (isset($_GET['team_id'])) {$team_id=$_GET['team_id'];}
  if ($team_id=="") {$team_id=-1;}
  $page=$_GET['page'];
  if ($page=="") {$page='index';}
  $tyear=$_GET['year'];
  $pos=$_GET['pos'];
  if ($pos=="") {$pos=0;}
	  
  ##### Get Title #####
  switch ($page)
  {
  case "batreg"  : $location="team_batting_registry.php?team_id=$team_id"; break;
  case "pitreg"  : $location="team_pitching_registry.php?team_id=$team_id"; break;
  case "fldreg"  : $location="team_fielding_registry.php?team_id=$team_id&pos=$pos"; break;
  case "batstart": $location="team_positional_starters.php?team_id=$team_id"; break;
  case "pitstart": $location="team_pitcher_starters.php?team_id=$team_id"; break;
  case "batlead" : $location="team_batting_leaders.php?team_id=$team_id"; break;
  case "pitlead" : $location="team_pitching_leaders.php?team_id=$team_id"; break;
  case "ballpark": $location="team_park_history.php?team_id=$team_id"; break;
  case "year"    : $location="team_summary.php?team_id=$team_id&year=$tyear"; break;
  case "yearTen" : $location="team_player_tenure.php?team_id=$team_id&year=$tyear"; break;
  default        : $location="team_hist.php?team_id=$team_id"; break;
  }

  header("Location: ".$location);
  
?>
