// Compressed with JSCruncher.
// www.domapi.com/jscruncher
function DisplayScheduleSideBar(){var curr_date=new Date();var curr_day=curr_date.getDay();var objDisplaySchedule=new DisplaySchedule("SmallSchedule");if(curr_day>=0&&curr_day<=3){objDisplaySchedule.DisplayWeek(CurrentBlock.Schedule.GetCurrentWeek());objDisplaySchedule.DisplayWeek(CurrentBlock.Schedule.GetLastWeek())}else{objDisplaySchedule.DisplayWeek(CurrentBlock.Schedule.GetLastWeek());objDisplaySchedule.DisplayWeek(CurrentBlock.Schedule.GetCurrentWeek())}}function DisplayStandings(containerCssClass){this.ContainerCssClass=(containerCssClass?containerCssClass:"");this.DisplayGroup=function(group){var team;group.Teams.sort(sortTeam);document.writeln(GetTagWithCss("div",this.ContainerCssClass));document.writeln("<h4>"+GetClickableGroup(group)+"</h4>");document.writeln("<table cellspacing='0'>");document.writeln("<tr>");document.writeln("<th class='TeamCol'>Team</th>");document.writeln("<th class='WinCol'>W</th>");document.writeln("<th class='LossCol'>L</th>");document.writeln("</tr>");for(var i=0;i<group.Teams.length;i++){team=group.Teams[i];document.writeln(GetTagWithCss("tr",(((i%2)>0)?"Alt":"")));document.writeln("<td class='TeamCol'>"+team.GetDisplayName()+"</td>");document.writeln("<td class='WinCol'>"+team.Wins+"</td>");document.writeln("<td class='LossCol'>"+team.Losses+"</td>");document.writeln("</tr>")}document.writeln("</table>");document.writeln("</div>")}}function DisplaySchedule(containerCssClass,filterBlock,highlightCurrentWeek){this.ContainerCssClass=(containerCssClass?containerCssClass:"");if(filterBlock){if(filterBlock!=null){this.FilterOn=true;this.FilterBlock=filterBlock}else this.FilterOn=false}else this.FilterOn=false;if(highlightCurrentWeek)this.HighlightCurrentWeek=highlightCurrentWeek;else this.HighlightCurrentWeek=false;this.DisplayWeek=function(week){if(!week){return}document.writeln(GetTagWithCss("div",this.ContainerCssClass));if(this.HighlightCurrentWeek&&week==CurrentBlock.Schedule.GetCurrentWeek()){document.writeln("<h4><font color='yellow'>"+week.Name+"<br/>"+GetFriendlyDate(week.GameDate)+"</font></h4>")}else document.writeln("<h4>"+week.Name+"<br/>"+GetFriendlyDate(week.GameDate)+"</h4>");document.writeln("<table cellspacing='0'>");var game,bye,isAlt;var displayedCount=0;for(var i=0;i<week.Games.length;i++){game=week.Games[i];if(this.FilterOn){if(this.FilterBlock.Name!=game.RedTeam.Group.Name){continue}}isAlt=((displayedCount%2)>0);if(game.IsFinished){this.DisplayCompletedGame(isAlt,game)}else{this.DisplayFutureGame(isAlt,game)}displayedCount++}if(week.Byes.length>0){document.writeln("<tr><td colspan='10' class='Byes'>"+week.Name+" Byes</td></tr>");for(var i=0;i<week.Byes.length;i++){bye=week.Byes[i];if(this.FilterOn){if(this.FilterBlock.Name!=bye.Team.Group.Name){continue}}isAlt=((displayedCount%2)>0);this.DisplayBye(isAlt,bye);displayedCount++}}document.writeln("</table>");document.writeln("</div>")};this.DisplayCompletedGame=function(isAlt,game){var isGroupA=(game.RedTeam.Group.Name=="Group A")?true:false;var groupStyle=(isGroupA)?"GroupA":"GroupB";var winnerStyle="style='font-weight:bold;'";var txt="";txt+=GetTagWithCss("tr",(isAlt?"Alt":""));txt+="<td rowspan='2' class=\"SheetCol " + groupStyle + "\">"+game.SheetNumber+"</td>";var style="";if(game.WinningTeam==game.RedTeam){style=winnerStyle}txt+="<td "+style+" class=\"RedTeamName\">"+game.RedTeam.GetDisplayName()+"</td>";txt+="<td "+style+" class=\"ScoreCol\">"+game.RedLineScore.FinalScore+"</td>";txt+="</tr>";style="";if(game.WinningTeam==game.BlueTeam){style=winnerStyle}txt+=GetTagWithCss("tr",(isAlt?"Alt":""));txt+="<td "+style+" class=\"BlueTeamName\">"+game.BlueTeam.GetDisplayName()+"</td>";txt+="<td "+style+" class=\"ScoreCol\">"+game.BlueLineScore.FinalScore+"</td>";txt+="</tr>";document.writeln(txt)};this.DisplayFutureGame=function(isAlt,game){var isGroupA=(game.RedTeam.Group.Name=="Group A")?true:false;var groupStyle=(isGroupA)?"GroupA":"GroupB";var txt="";txt+=GetTagWithCss("tr",(isAlt?"Alt":""));txt+="<td rowspan='2' class=\"SheetCol " + groupStyle + "\">"+game.SheetNumber+"</td>";txt+="<td class=\"RedTeamName\">"+game.RedTeam.GetDisplayName()+" "+this.AppendTeamRecord(game.RedTeam)+"</td>";txt+="<td>&nbsp;</td>";txt+="</tr>";txt+=GetTagWithCss("tr",(isAlt?"Alt":""));txt+="<td class=\"BlueTeamName\">"+game.BlueTeam.GetDisplayName()+" "+this.AppendTeamRecord(game.BlueTeam)+"</td>";txt+="<td>&nbsp;</td>";txt+="</tr>";document.writeln(txt)};this.DisplayBye=function(isAlt,bye){var isGroupA=(bye.Team.Group.Name=="Group A")?true:false;var groupStyle=(isGroupA)?"GroupA":"GroupB";var txt="";txt+=GetTagWithCss("tr",(isAlt?"Alt":""));txt+="<td class=\"SheetCol " + groupStyle + "\">&nbsp;</td>";txt+="<td class=\"RedTeamName\">"+bye.Team.GetDisplayName()+" "+this.AppendTeamRecord(bye.Team)+"</td>";txt+="<td>&nbsp;</td>";txt+="</tr>";txt+="</tr>";document.writeln(txt)};this.AppendTeamRecord=function(team){return "<small>( "+team.Wins+"-"+team.Losses+" )</small>"}}function DisplayRosters(containerCssClass){this.ContainerCssClass=(containerCssClass?containerCssClass:"");this.DisplayGroup=function(group){group.Teams.sort(sortTeamByName);document.writeln(GetTagWithCss("div",this.ContainerCssClass));document.writeln("<h4>"+group.Name+"</h4>");document.writeln("<table cellspacing='0'>");document.writeln("<tr>");document.writeln("<th class='TeamCol'>Team</th>");document.writeln("<th class='SponsorCol'>Sponsor</th>");document.writeln("<th class='SkipCol'>Skip</th>");document.writeln("<th class='ThirdCol'>Third</th>");document.writeln("<th class='SecondCol'>Second</th>");document.writeln("<th class='LeadCol'>Lead</th>");document.writeln("</tr>");var isAlt;for(var i=0;i<group.Teams.length;i++){isAlt=((i%2)>0);document.writeln(this.GetTeamRow(isAlt,group.Teams[i]))}document.writeln("</table>");document.writeln("</div>")};this.GetTeamRow=function(isAlt,team){var txt="";txt+=GetTagWithCss("tr",(isAlt?"Alt":""));txt+="<td class='TeamCol'>"+team.GetDisplayName()+"</td>";if(team.HasSponsor)txt+="<td class='SponsorCol'>"+team.Sponsors[0].GetDisplayName()+"</td>";else txt+="<td class='SponsorCol'>&nbsp;</td>";if(team.Skip!=null){txt+="<td class='SkipCol'>"+team.Skip.FullName+"</td>"}else txt+="<td class='SkipCol'>&nbsp;</td>";if(team.Third!=null){txt+="<td class='ThirdCol'>"+team.Third.FullName+"</td>"}else txt+="<td class='ThirdCol'>&nbsp;</td>";if(team.Second!=null){txt+="<td class='SecondCol'>"+team.Second.FullName+"</td>"}else txt+="<td class='SecondCol'>&nbsp;</td>";if(team.Lead!=null){txt+="<td class='LeadCol'>"+team.Lead.FullName+"</td>"}else txt+="<td class='LeadCol'>&nbsp;</td>";txt+="</tr>";return txt}}function DisplayTeam(containerCssClass){var NUM_GAMES_PER_LINE=4;this.ContainerCssClass=(containerCssClass?containerCssClass:"");this.Display=function(team){document.writeln(GetTagWithCss("div",this.ContainerCssClass));document.writeln("<h4>"+this.GetTeamUrl(team));document.writeln("<div>"+team.Name+" ( "+team.Wins+" - "+team.Losses+" )</div>");document.writeln("</h4>");this.DisplayTeamPic(team);this.DisplaySponsor(team);this.DisplayRoster(team);this.DisplayGames(team);document.writeln("</div>")};this.GetTeamUrl=function(team){if(team.HasTeamUrl){return "<span><a href=\"" + team.TeamUrl + "\" class=\"TeamHomePage\" target='TeamHomePage'>"+team.TeamUrl+"</a></span>"}else return ""};this.DisplayTeamPic=function(team){if(team.HasTeamPic){document.writeln("<img src='"+team.TeamPicUrl+"' />")}};this.DisplaySponsor=function(team){if(team.HasSponsor){var sponsor;var closed=false;document.writeln("<table border='0' cols='2' cellpadding='5' style='font-size:0.9em;'>");for(var i=0;i<team.Sponsors.length;i++){sponsor=team.Sponsors[i];if((i%2)==0){document.writeln("<tr>");closed=false}document.writeln("<td valign='bottom'>");if(sponsor.HasImage){document.writeln(sponsor.GetSponsorImageLink())}else document.writeln(sponsor.GetDisplayName());if(sponsor.HasUrl){document.writeln("<br/><a href='"+sponsor.Url+"' class='NoDecoration' target='Sponsor' onClick='javascript:urchinTracker(\"/outgoing/sponsors/" + sponsor.Name + "\")'>"+sponsor.Url+"</a>")}document.writeln("</td>");if((i%2)==1){document.writeln("</tr>");closed=true}}if(!closed){document.writeln("<td>&nbsp;</td></tr>")}document.writeln("</table>")}};this.DisplayRoster=function(team){document.writeln("<p>");document.writeln("<ul class='Roster'>");document.writeln("<li><div>Skip</div>");document.writeln((team.Skip!=null)?team.Skip.FullName:"&nbsp;");document.writeln("</li>");document.writeln("<li><div>Third</div>");document.writeln((team.Skip!=null)?team.Third.FullName:"&nbsp;");document.writeln("</li>");document.writeln("<li><div>Second</div>");document.writeln((team.Skip!=null)?team.Second.FullName:"&nbsp;");document.writeln("</li>");document.writeln("<li><div>Lead</div>");document.writeln((team.Skip!=null)?team.Lead.FullName:"&nbsp;");document.writeln("</li>");document.writeln("</ul>");document.writeln("<br style='clear:both;' />");document.writeln("</p>")};this.DisplayGames=function(team){var obj;for(var i=0;i<team.Schedule.length;i++){obj=team.Schedule[i];switch(obj.Type){case "Game":this.DisplayGame(team,obj);break;case "Bye":this.DisplayBye(team,obj);break}}};this.DisplayGame=function(team,game){document.writeln("<span class='TeamGame'>");document.writeln("<h5>");if(game.Week==CurrentBlock.Schedule.GetCurrentWeek()){document.writeln("<font color='yellow'>")}document.writeln(game.Week.Name+"<br/>");document.writeln(GetFriendlyDate(game.Week.GameDate));if(game.Week==CurrentBlock.Schedule.GetCurrentWeek()){document.writeln("</font>")}document.writeln("</h5>");document.writeln("<div class=\"Sheet\">");document.writeln("Sheet "+game.SheetNumber);document.writeln("</div>");this.DisplayGameTeam(game.RedTeam,game);this.DisplayGameTeam(game.BlueTeam,game);document.writeln("</span>")};this.DisplayGameTeam=function(gameTeam,game){var css="Team ";if(game.IsFinished){css+=(game.WinningTeam==gameTeam)?"Winner":"Loser"}document.writeln(GetTagWithCss("div",css));document.writeln("<span style='float:left;'>"+gameTeam.GetDisplayName()+"</span>");document.writeln("<span style='float:right;'>");if(game.IsFinished){var score;if(gameTeam==game.RedTeam)score=game.RedLineScore.FinalScore;else score=game.BlueLineScore.FinalScore;document.writeln(score)}else document.writeln(" <small>( "+gameTeam.Wins+" - "+gameTeam.Losses+" )</small>");document.writeln("</span>");document.writeln("</div>");document.writeln("<br style='clear:both;' />")};this.DisplayBye=function(team,bye){document.writeln("<span class='TeamGame'>");document.writeln("<h5>");document.writeln(bye.Week.Name+"<br/>");document.writeln(GetFriendlyDate(bye.Week.GameDate));document.writeln("</h5>");document.writeln("<div class=\"Sheet\">");document.writeln("Bye");document.writeln("</div>");document.writeln("<div class='Team'>&nbsp;</div>");document.writeln("<div class='Team'>&nbsp;</div>");document.writeln("</span>")}}function GetIndexListItem(heading,description){var html;html="<li>\n";html+="<h3>"+heading+"</h3>\n";html+=description;html+="\n</li>\n";return html}function DisplayWeekByes(week){if(week!=null){week.Byes.sort(sortTeamByName);var title="PCL "+week.Name+" ("+GetFriendlyDate(week.GameDate)+") Byes";var listing;listing="The following teams have "+week.Name+" byes:\n";listing+="<ul>\n";for(var i=0;i<week.Byes.length;i++){listing+="<li>"+week.Byes[i].Team.GetDisplayName()+"</li>\n"}listing+="</ul>\n";document.writeln(GetIndexListItem(title,listing))}}function GetTagWithCss(tagName,cssClass){var str;if(cssClass.length>0){str="<"+tagName+" class=\"" + cssClass + "\">"}else str="<"+tagName+">";return str}function GetFriendlyDate(date){date=new Date(date);var curr_day=date.getDay();var curr_date=date.getDate();var sup="";if(curr_date==1||curr_date==21||curr_date==31){sup="st"}else if(curr_date==2||curr_date==22){sup="nd"}else if(curr_date==3||curr_date==23){sup="rd"}else{sup="th"}curr_date=curr_date+"<sup>"+sup+"</sup>";return day_names[curr_day]+" "+month_names[date.getMonth()]+" "+curr_date+" "+date.getFullYear()}function GetFriendlyDateTime(date){var curr_min=""+date.getMinutes();if(curr_min.length<2){curr_min="0"+curr_min}var curr_sec=""+date.getSeconds();if(curr_sec.length<2){curr_sec="0"+curr_sec}var date=GetFriendlyDate(date)+" "+date.getHours()+":"+curr_min+":"+curr_sec;return ""+date}function GetClickableGroup(group){return "<a href='"+GetSiteLink("schedule.htm")+"?group="+group.Name.replace(" ","")+"'>"+group.Name+"</a>"}function DisplaySponsors(group,containerCss){group.Teams.sort(sortTeamByName);document.writeln(GetTagWithCss("div",containerCss));document.writeln("<h4>Team Sponsors</h4>");document.writeln("<table cellspacing='0'>");var k=1;for(var i=0;i<group.Teams.length;i++){var team=group.Teams[i];if(team.HasSponsor){document.writeln(GetTagWithCss("tr",(((k%2)>0)?"Alt":"")));document.writeln("<td>&nbsp;"+team.GetDisplayName()+"<br/>\r\n");document.writeln("<div style='font-size:0.85em;'>");document.writeln("<ul class='smallSponsors'>");for(var j=0;j<team.Sponsors.length;j++){var sponsor=team.Sponsors[j];document.writeln("<li>");if(sponsor.HasUrl){document.writeln("<a href='"+sponsor.Url+"' class='NoDecoration' target='Sponsor' onClick='javascript:urchinTracker(\"/outgoing/teamsponsors/\")'>"+sponsor.GetDisplayName()+"</a>")}else document.writeln(sponsor.GetDisplayName());document.writeln("</li>\n")}document.writeln("</ul>");document.writeln("</div>");document.writeln("</td>");document.writeln("</tr>")}}document.writeln("</table>");document.writeln("</div>")}function DumpScheduleDiagnostic(){var team;document.writeln("<br style='clear:both;'>");for(i=0;i<AllTeams09.Teams.length;i++){team=AllTeams09.Teams[i];var game,opponent;var opponents=new Array();document.writeln(team.Name+" plays "+team.Games.length+" games:");for(var k=0;k<team.Games.length;k++){game=team.Games[k];opponent=(game.RedTeam==team)?game.BlueTeam:game.RedTeam;var found=false;for(var z=0;z<opponents.length;z++){if(opponents[z][0]==opponent){opponents[z][1]++;opponents[z][2]+=" ,"+game.Week.GameDate;found=true;break}}if(!found){var newRow=new Array();newRow[0]=opponent;newRow[1]=1;newRow[2]=game.Week.GameDate;opponents.push(newRow)}}document.writeln("<ul>");for(var k=0;k<opponents.length;k++){if(opponents[k][1]>1)document.writeln("<li>"+opponents[k][0].Name+": "+opponents[k][1]+" "+opponents[k][2]+"</li>")}document.writeln("</ul>");document.writeln("<br>")}}
