	
	
	//team array to hold all the players
	var team = new Array();
	/*team[0]= new Player("1","Janice Rivera","L","Fr.","major","5-2","Windermere, FL","Olympia",
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=794");
    team[1]= new Player("2","Kellie Sellers","OH","So.","major","6-0","Allentown, PA","Emmaus H.S.",
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=921");
	team[2]= new Player("3","Kelsey Hall","S","So.","major","5-8","Berryton, KS","Shawnee Heights",
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=54");
	team[3]= new Player("4","Ginnie Talley","DS/L","So.","major","5-8","Atlanta, GA","The Westminster School",			 
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=925");
	team[4]= new Player("5","Lauren Huber","OH/RS","Fr.","major","5-11","Charlotte, NC","North Mecklenburg H.S.",
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=688");
	team[5]= new Player("7","Brittany Blackman","RS","Fr.","major","6-3","Sanford, NC","Lee County H.S.",
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=687"); 
	team[6]= new Player("8","Kaley Viola","OH","So.","major","6-0","Orlando, FL","Lake Highland Preparatory School",
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=924"); 
	team[7]= new Player("10","Kelley Taylor","RS","Jr.","major","6-1","Tampa, FL","The Cambridge School",
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=690") 
	team[8]= new Player("11","Sara Felts","MH","So.","major","6-1","Branchville, VA","Southampton Academy",
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=923"); 
	team[9]= new Player("12","Becca Toor","MH","Fr.","major","6-2","Rotonda West, FL","Lemon Bay H.S.",
						"http://www.winthropeagles.com/default.asp?section=18&type=player&id=926"); 
	team[10]= new Player("14","Shannon Sitzmann","MH","Sr.","major","6-2","LeMars, IA","Gehlen Catholic",
						 "http://www.winthropeagles.com/default.asp?section=18&type=player&id=520");
	team[11]= new Player("16","Chrissie Albers","S","Fr.","major","6-1","Springfield, IL","Sacred Heart Griffin H.S.",
						 "http://www.winthropeagles.com/default.asp?section=18&type=player&id=1032"); 
	team[12]= new Player("20","Kelsey Harrison","RS","So.","major","5-11","Lawrence, KS","Lawrence Free State H.S.",
						 "http://www.winthropeagles.com/default.asp?section=18&type=player&id=922"); 
	*/
	//schedule array to hold all the games
	var schedule = new Array();
	/*schedule[0]= new Game("8/29","Norfolk State","Winston-Salem, NC","4:30 pm",3,0); 
	schedule[1]= new Game("8/30","Davidson","Winston-Salem, NC","10:00 am",3,0);
	schedule[2]= new Game("8/30","Wake Forest","Winston-Salem, NC","7:00 pm",1,3);   
	schedule[3]= new Game("9/5","West Virginia","Rock Hill, SC","7:00 pm",2,3);
	schedule[4]= new Game("9/6","North Carolina Central","Rock Hill, SC","10:00 am",3,0);
	schedule[5]= new Game("9/6","Morehead State","Rock Hill, SC","7:00 pm",0,3);  
	schedule[6]= new Game("9/12","Clemson","Columbia, SC","12:30 pm",0,3);
	schedule[7]= new Game("9/12","College of Charleston","Columbia, SC","5:00 p.m",0,3);
	schedule[8]= new Game("9/13","South Carolina","Columbia, SC","10:00 am",0,3);   
	schedule[9]= new Game("9/19","North Carolina","Minneapolis, MN","5:00 pm",1,3); 
	schedule[10]= new Game("9/20","Minnesota","Minneapolis, MN","12:30 pm",0,3); 
	schedule[11]= new Game("9/20","TCU","Minneapolis, MN","5:00 pm",0,3); 
	schedule[12]= new Game("9/27","Gardner-Webb*","Boiling Springs, NC","2:00 pm",2,3); 
	schedule[13]= new Game("10/3","Presbyterian*","Home","7:00 pm",3,1); 
	schedule[14]= new Game("10/4","UNC Asheville*","Home","2:00 pm",3,2); 
	schedule[15]= new Game("10/7","Coastal Carolina*","Conway, SC","6:00 pm",1,3);  
	schedule[16]= new Game("10/10","High Point*","High Point, NC","7:00 pm",1,3); 
	schedule[17]= new Game("10/12","Charlotte","Home","2:00 pm",0,0); 
	schedule[18]= new Game("10/14","Charleston Southern*","Home","6:00 pm",0,0); 
	schedule[19]= new Game("10/17","Liberty*","Home","7:00 pm",0,0); 
	schedule[20]= new Game("10/18","Radford*","Home","2:00 pm",0,0); 
	schedule[21]= new Game("10/24","Gardner-Webb*","Home","7:00 pm",0,0); 
	schedule[22]= new Game("10/31","Presbyterian*","Clinton, SC","7:00 pm",0,0); 
	schedule[23]= new Game("11/1","UNC Asheville*","Asheville, NC","2:00 pm",0,0); 
	schedule[24]= new Game("11/4","Charleston Southern*","N. Charleston, SC","6:00 pm",0,0); 
	schedule[25]= new Game("11/7","High Point*","Home","7:00 pm",0,0); 
	schedule[26]= new Game("11/11","Coastal Carolina*","Home","6:00 pm",0,0); 
	schedule[27]= new Game("11/15","Liberty*","Lynchburg, VA","2:00 pm",0,0); 
	schedule[28]= new Game("11/16","Radford*","Radford, VA","1:00 pm",0,0); 
*/
	var randPlayer;
	var pName, pImg, pNum, pPos, pClass, pHeight, pHome, pSchool;

	var gInfo, tInfo; //divs that hold hidden content
	var js_game, js_team; //divs that will get content
	function initialize()
	{
	}
	function t_initialize()
	{
		tInfo = document.getElementById("teamInfo");
		js_team = document.getElementById("js_team");
		readTeam();
	}
	function g_initialize() //init function for pages that show a schedule
	{
		gInfo = document.getElementById("gameInfo");
		js_game = document.getElementById("js_game");
		readGames();
	
	}
	function readGames()
	{
		var schedArray = new Array();
		schedArray = gInfo.innerHTML.split("||");
		var gameArray = new Array();
		
		var i,j;
	    for(i=0;i<schedArray.length;i++)
		{
			gameArray = schedArray[i].split("+"); //creates an array for one game
			
			//createa new game object with the data read in.
			//trim removes the spaces...the spaces are there so that it's visually easier to edit
			schedule[i] = new Game(trim(gameArray[0]),trim(gameArray[1]),trim(gameArray[2]),
									trim(gameArray[3]),trim(gameArray[4]),trim(gameArray[5]));
		} 
	}
	function readTeam()
	{
		var teamArray = new Array();
		teamArray =tInfo.innerHTML.split("||");
		var playerArray = new Array();
		
		var i,j;
	    for(i=0; i<teamArray.length ; i++)
		{
			playerArray =teamArray[i].split("+");
			team[i] = new Player(trim(playerArray[0]),trim(playerArray[1]),trim(playerArray[2]),
								  trim(playerArray[3]),trim(playerArray[4]),trim(playerArray[5]),
								  trim(playerArray[6]),trim(playerArray[7]),trim(playerArray[8]));
		}
		
	}
	/*Trims a string using regular expressions. Trims all leading spaces, ending spaces, and multiple spaces*/
	function trim(s) {
		s = s.replace(/(^\s*)|(\s*$)/gi,"");
		s = s.replace(/[ ]{2,}/gi," ");
		s = s.replace(/\n /,"\n");
		return s;
	}
	function players_initialize()
	{ //initialize the player
	
		randPlayer = random(team.length);
		pName = document.getElementById("pCardName");
		pNum = document.getElementById("pCardNum");
		pImg = document.getElementById("pCardImg");
		pPos = document.getElementById("pCardPos");
		pHeight = document.getElementById("pCardHeight");
		pHome = document.getElementById("pCardHome");
		pSchool = document.getElementById("pCardSchool");
		pClass = document.getElementById("pCardClass");

		changePCard(randPlayer);
		
	}
	
	function random(n)
	{
		return Math.floor(Math.random() * n);
	}
	
	function rollover(img_name, img_src)
	{
		document[img_name].src = img_src;
	}
	
	function makeSchedule()
	{
		var jsContent = ""; //initialize the content
		//add table and table rows to content
		jsContent += '<table id="fullSchedule">';
		jsContent += '<thead><tr><td>Date</td><td>Opponent</td><td>Location</td><td>Result</td><td>Score</td></thead>';
		var i=0;
	 	for (i=0; i<schedule.length; i++)	
		{
			jsContent += '<tr><td>' + schedule[i].gameDate.toString() + '</td><td>' + schedule[i].gameOpponent + 
						   '</td><td>' + schedule[i].gamePlace + '</td>';
			jsContent += '<td>' + schedule[i].gameResult + '</td><td>' +schedule[i].gameWuScore +'-'+schedule[i].gameOppScore+
					       '</td></tr>';
		}
		jsContent += '</table>';
		js_game.innerHTML = jsContent; //set the content


	}
	
	function makeShortSchedule()
	{//make short schedule for the front page
		var today = new Date();
		var gameNum = 0;
		var jsContent ="";
		
		jsContent += '<table id="shortSched">';
		for (var i=0; i<schedule.length; i++)
		{
			if(schedule[i].gameFullDate > today	) //if the game is in the future (note this includes games that happen later today
			{
				if(gameNum<5) //only display 5 games.
				{
					jsContent += '<tr><td>' + schedule[i].gameDate.toString() + '</td><td>' + schedule[i].gameOpponent +
								   '</td><td>' + schedule[i].gamePlace + '</td>';
					jsContent += '<td>' + schedule[i].gameTime + '</td></tr>';
					gameNum++;
				}
			}
		}
		if(gameNum == 0) jsContent += '<tr><td>No Upcoming Games</td><tr>';
		jsContent += '</table>';
		js_game.innerHTML = jsContent;
	}
	
	function makeRoster()
	{//loops through team array
		var jsContent ="";
		jsContent +='<ul>';
		for( i=0; i<team.length; i++)
		{		
			jsContent +='<li><span onclick="navTo('+ i +')" onmouseover="changePCard(' + i + ')">' + team[i].name +'</span></li>';
		}
		jsContent +='</ul>';
		js_team.innerHTML = jsContent;
	}
	
	function changePCard(i) //changed the player card
	{
		pName.innerHTML = team[i].name;
		pImg.src = team[i].picture.src;
		pNum.innerHTML = team[i].number;
		pHome.innerHTML = team[i].hometown;
		pClass.innerHTML = team[i].classyear;
		pHeight.innerHTML = team[i].height;
		pSchool.innerHTML = team[i].school;
		pPos.innerHTML = team[i].position;
	
	}
	function navTo(i)
	{
		window.location = team[i].blogUrl;
	}
//~~~~~~~~~~~~~~~~~~~~~~~~~~OBJECT DECLARATIONS	
	
	//Player Object declaration
	function Player(pNum, pName, pPos, pClass, pMajor, pHeight, pHome, pSchool,pUrl)
	{
		this.name = pName;
		this.number = pNum;
		this.classyear =pClass;
		this.position = pPos;
		this.height = pHeight;
		this.major = pMajor,
		this.hometown = pHome;
		this.school = pSchool;
		this.blogUrl=pUrl
		
		//create an image for the player
		var imgSrc = pName.replace(" ",""); //all images saved as FirstnameLastname.jpg, so dynamically create the sources
		imgSrc ="images/"+ imgSrc +".jpg";
		
		this.picture = new Image();
		this.picture.src= imgSrc;

	}
	
	//Game Object declaration
	function Game(gDate, gOpponent, gPlace, gTime, gWuScore, gOppScore)
	{
		var today = new Date();//date defaults to today
		
		var gMonth = gDate.split("/")[0]; //gets the month from the string
		gMonth = gMonth - 1; //javascript dates are 0-indexed. 0 = january
		var gDay = gDate.split("/")[1]; //gets the date;
		var gHour = parseInt(gTime.split(":")[0]); //gets the hour from the time;
		
		if(gTime.search('p')>0)//if the time contains p (as in p.m.) account for 24hr time
			if(gHour != 12) gHour = gHour + 12; //if its not 12:__ p.m., add 12 hours
		
		var gMin = gTime.split(":")[1].split(" ")[0]; // gets the minutes... spilts "1:30 p.m." first into two strings on ':'  then on the ' '

		this.gameFullDate = new Date();
		this.gameFullDate.setFullYear(2008, gMonth, gDay);//date in full format. Using date object so comparison can be made later
		this.gameFullDate.setHours(gHour); //hours are 0 indexed
		this.gameFullDate.setMinutes(gMin);
		this.gameFullDate.setSeconds(0);
		
		this.gameDate = (parseInt(this.gameFullDate.getMonth()) + 1 )+ "/" + this.gameFullDate.getDate();//creates a string with the date in a 9/25 format
		this.gameTime = gTime;
		this.gameOpponent = gOpponent;
		this.gamePlace = gPlace;
		
		
		//if the game is in the future, the score is irrelevant
		if(this.gameFullDate > today) 
		{
			gWuScore = -1;	
		}
		if(gWuScore < 0 ) //negative will be the designator for games in the future.
		{
			this.gameResult="";
			this.gameWuScore ="";
			this.gameOppScore ="";
		}
		else
		{
			if(gWuScore > gOppScore) this.gameResult ="W";
			else if(gWuScore == gOppScore) this.gameResult ="D";
			else if(gWuScore < gOppScore) this.gameResult = "L";
			
			this.gameWuScore = gWuScore;
			this.gameOppScore= gOppScore;
		}
			
	}
//END OBJECT DECS