// (c)2012 Scott G. Walch

var WebSite=null;var sg=Class.create({currentSeason:null,news:null,sponsors:null,store:null,dugout:null,headerslideshow:null,slideshow:null,gallery:null,leaders:null,history:null,alumni:null,links:null,movies:null,documents:null,staff:null,cheer:null,toon:null,cfgClubs:null,club:[],lead:[],iScore:[],countdown:[],newsSlot:[],selectedPlayer:null,selectedTeam:null,playerBirthInfo:null,playerDetail:null,teamno:null,sponsorExecutor:null,leaderExecutor:null,historyExectuor:null,alumniExectuor:null,newsExecutuor:null,selectedPlayerExecutor:null,forecastExecutor:null,teamUpdated:null,currentschedule:1,currentteam:0,currentLeaderTeam:0,currentStatsTeam:0,showFull:null,theLeaders:[],schGamesToShow:null,schGamesCurrent:null,schGamesPages:null,schGamesCurrPage:null,forecast:null,clubsLoaded:null,countsLoaded:null,map:null,dirDis:null,dirSer:null,renOpt:null,textLatLong:null,stats:[],cards:[],gamecards:[],gameStats:[],gameName:null,statsLoaded:null,loginButton:null,printHeader:null,printTeam:null,currDisplay:null,searchText:null,calEvents:[],calAjaxFeeds:[],initialize:function(){this.cfgClubs=teams.teams;this.currentSeason=hist.seasons[0].year;this.newsSlot.length=3;this.newsSlot[0]=0;this.newsSlot[1]=1;this.newsSlot[2]=2;this.currDisplay='Home';if(document.body.id=='page1')
{var sText=getQueryValue('search');if(sText)
this.searchText=sText;this.buildHeader();this.getWeather();this.getApplicationData(1);if(showTodaysDate)
this.getToday(null);if(this.isLoggedIn())
this.genLogoff();this.buildFooter();this.loadGoogleMaps();startCount();displayNextGame();}},getApplicationData:function(refresh){var url='xmldata/'+this.currentSeason+'/';var UniqueQS=this.getRandomNumber(2400);this.getNewsData(url,UniqueQS);this.getSponsorsData(url,UniqueQS);this.getStoreData(url,UniqueQS);this.getContentData(url,UniqueQS);this.getLinksData(url,UniqueQS);this.getDocumentsData(url,UniqueQS);this.getAlumniData(url,UniqueQS);this.getHistoryData(url,UniqueQS);this.getMovies(url,UniqueQS);this.club.length=0;this.getClubData();this.getCountData();this.hideFooter(1);if(this.isLoggedIn())
var AddInitStatsCode=0;},initData:function(){this.news=null;this.sponsors=null;this.store=null;this.dugout=null;this.headerslideshow=null;this.slideshow=null;this.gallery=null;this.leaders=null;this.history=null;this.alumni=null;this.links=null;this.movies=null;this.documents=null;this.staff=null;this.cheer=null;this.stats.length=0;this.cards.length=0;this.gamecards.length=0;this.club.length=0;this.lead.length=0;this.countdown.length=0;this.iScore.length=0;},getNewsData:function(url,UniqueQS){var aj=new Ajax.Request(url+'news.xml?u='+UniqueQS,{method:'get',onSuccess:this.getNews.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getSponsorsData:function(url,UniqueQS){var aj=new Ajax.Request(url+'sponsors.xml?u='+UniqueQS,{method:'get',onSuccess:this.getSponsors.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getStoreData:function(url,UniqueQS){var aj=new Ajax.Request(url+'store.xml?u='+UniqueQS,{method:'get',onSuccess:this.getStore.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getContentData:function(url,UniqueQS){var aj=new Ajax.Request(url+'content.xml?u='+UniqueQS,{method:'get',onSuccess:this.getContent.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getLinksData:function(url,UniqueQS){var aj=new Ajax.Request(url+'links.xml',{method:'get',onSuccess:this.getLinks.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getDocumentsData:function(url,UniqueQS){var aj=new Ajax.Request(url+'documents.xml?u='+UniqueQS,{method:'get',onSuccess:this.getDocuments.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getAlumniData:function(url,UniqueQS){var aj=new Ajax.Request(url+'alumni.xml?u='+UniqueQS,{method:'get',onSuccess:this.getAlumni.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getHistoryData:function(url,UniqueQS){var aj=new Ajax.Request(url+'history.xml?u='+UniqueQS,{method:'get',onSuccess:this.getHistory.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getNews:function(oReq){this.news=XMLObjectifier.xmlToJSON(oReq.responseXML);this.processNews(this.news);this.newsExecutor=new PeriodicalExecuter(this.processNewsChange.bind(this),120);},getSponsors:function(oReq){this.sponsors=XMLObjectifier.xmlToJSON(oReq.responseXML);this.processSponsors();this.sponsorExecutor=new PeriodicalExecuter(this.processSponsors.bind(this),30);},getStore:function(oReq){this.store=XMLObjectifier.xmlToJSON(oReq.responseXML);},getRandomNumber:function(max)
{return Math.floor(Math.random()*max);},getLeaders:function(oReq){var leadData=oReq.responseJSON;if(leadData==null||leadData.rc!=null)
this.lead.push('No Leader Data');else
this.lead.push(leadData[0]);this.leadLoaded=this.lead.length;if(this.leadLoaded<this.cfgClubs.length)
this.getLeaderData();else{this.getStats();this.processLeaders();this.leaderExecutor=new PeriodicalExecuter(this.processLeaders.bind(this),40);}},genLeadersNav:function(nav){if(this.cfgClubs.length>1)
this.genLeadNav(nav);},genLeadNav:function(nav){var dv=new Element('div',{'id':'leadersnav'});for(var x=0;x<this.cfgClubs.length;x++)
{var clubLink='javascript:WebSite.showLeaders("'+x+'");';var clubHref=new Element('a',{'href':clubLink,'class':'resultsnav'}).update(this.cfgClubs[x].name);var sep=new Element('span').update(' | ');dv.insert({'bottom':clubHref});if(x+1!=this.cfgClubs.length)
dv.insert({'bottom':sep});}
nav.insert({'bottom':dv});},showLeaders:function(theTeam){this.currentLeaderTeam=theTeam;this.processLeaders();},processLeaders:function(){var Leader=this.lead[this.currentLeaderTeam];var ImageAlt=null;var ImageURL=null;var ImgElement=null;var div=null;var divCol3=null;var divCol4=null;var divBox3=null;var divLeft=null;var divRight=null;var divInd=null;var ClearDiv=null;var H5=null;var Desc=null;var Txt1=null;var Txt2=null;var Txt3=null;var BoxClass=null;var leadersDiv=$('leaders');leadersDiv.update();this.genLeadersNav(leadersDiv);var leadersHeader=$('leadersheader');leadersHeader.update(this.cfgClubs[this.currentLeaderTeam].name+' Team Leaders');if(Leader.updated=='Inactive')
{$('statsupdated').update('The Leaders Section is inactive');return;}
else if(Leader=='No Leader Data'){$('statsupdated').update('Data not Available for this team');return;}
else
$('statsupdated').update('Leaders as of '+Leader.updated);this.loadTheLeaders(Leader);var TotalLeaderCategories=this.theLeaders.length;var x=0;for(x=0;x<TotalLeaderCategories;x++)
{if(x%2)
BoxClass='box3';else
BoxClass='box4';ImageAlt=' ';var imgName=this.getImageName(0,this.currentLeaderTeam,this.theLeaders[x].first,this.theLeaders[x].last);ImageURL='images/roster/'+this.currentSeason+'/'+imgName;div=new Element('div',{'class':'container'});Col1=new Element('div',{'class':'leadCol1'});ImgElement=new Element('img',{'src':ImageURL,'alt':ImageAlt,'height':'80px','width':'80px'});Col2=new Element('div',{'class':'leadCol2'});divBox3=new Element('div',{'class':BoxClass});divLeft=new Element('div',{'class':'left'});divRight=new Element('div',{'class':'right'});divInd=new Element('div',{'class':'ind'});H5=new Element('h5',{'class':'txtLeadHeader'}).update(this.theLeaders[x].category);Desc=new Element('span',{'class':'txt1'}).update(this.theLeaders[x].desc);Txt1=new Element('span',{'class':'txt1'}).update(this.theLeaders[x].first+' '+this.theLeaders[x].last);var V=this.trimLZ(this.theLeaders[x].value);Txt2=new Element('span',{'class':'txt2'}).update(V);if(this.theLeaders[x].tied!='0')
{var tTxt='1 other tied with ';if(this.theLeaders[x].tied!='1')
tTxt=this.theLeaders[x].tied;Txt3=new Element('span',{'class':'txt1'}).update('('+tTxt+' tied with '+V+')');}
else Txt3=null;ClearDiv=new Element('div',{'class':'clear'});Col1.insert({'bottom':ImgElement});divInd.insert({'bottom':H5});divInd.insert({'bottom':Desc});divInd.insert({'bottom':Txt1});divInd.insert({'bottom':Txt2});if(Txt3!=null)
divInd.insert({'bottom':Txt3});divRight.insert({'bottom':divInd});divLeft.insert({'bottom':divRight});divBox3.insert({'bottom':divLeft});Col2.insert({'bottom':divBox3});leadersDiv.insert({'bottom':Col1});leadersDiv.insert({'bottom':Col2});leadersDiv.insert({'bottom':ClearDiv});}
leadersDiv.appear();},loadTheLeaders:function(Leaders){var TotalOffense=Leaders.offense.length;var TotalPitching=Leaders.pitching.length;var TotalDefense=Leaders.defense.length;var randomOffense1=this.getRandomNumber(TotalOffense);var randomOffense2=this.getRandomNumber(TotalOffense);var randomDefense=this.getRandomNumber(TotalDefense);var randomPitching1=this.getRandomNumber(TotalPitching);var randomPitching2=this.getRandomNumber(TotalPitching);while(randomOffense1==randomOffense2)
randomOffense2=this.getRandomNumber(TotalOffense);while(randomPitching1==randomPitching2)
randomPitching2=this.getRandomNumber(TotalPitching);this.theLeaders.length=0;this.theLeaders.push(Leaders.offense[randomOffense1]);this.theLeaders.push(Leaders.offense[randomOffense2]);this.theLeaders.push(Leaders.defense[randomDefense]);this.theLeaders.push(Leaders.pitching[randomPitching1]);this.theLeaders.push(Leaders.pitching[randomPitching2]);},getAlumni:function(oReq){var tmpAlumni;tmpAlumni=XMLObjectifier.xmlToJSON(oReq.responseXML);this.alumni=tmpAlumni.category[0].items[0].item;this.processAlumni();this.alumniExecutor=new PeriodicalExecuter(this.processAlumni.bind(this),70);},processAlumni:function(){var alumniDiv=$('alumni');if(alumniDiv==null)
return;var ImgElement=null;var Span=null;var ClearDiv=null;var H2=null;var H6=null;var subTitle=null;var Alumni=this.alumni;var alumniItem=this.getRandomNumber(Alumni.length);alumniDiv.update();H2=new Element('h2').update('Alumni Update');H6=new Element('h6').update(Alumni[alumniItem].title);H3=new Element('h3').update(Alumni[alumniItem].description[0].Text);ImgElement=new Element('img',{'class':'img_indent','src':Alumni[alumniItem].thumbnail,'alt':''});Span=new Element('span').update(Alumni[alumniItem].content[0].Text);ClearDiv=new Element('div',{'class':'clear'});alumniDiv.insert({'bottom':H2});alumniDiv.insert({'bottom':H3});alumniDiv.insert({'bottom':ImgElement});alumniDiv.insert({'bottom':H6});alumniDiv.insert({'bottom':Span});alumniDiv.insert({'bottom':ClearDiv});alumniDiv.appear();},getHistory:function(oReq){var tmpHistory;tmpHistory=XMLObjectifier.xmlToJSON(oReq.responseXML);this.history=tmpHistory.category[0].items[0].item;this.processHistory();this.historyExecutor=new PeriodicalExecuter(this.processHistory.bind(this),60);},processHistory:function(){var historyDiv=$('history');var ImgElement=null;var Span=null;var ClearDiv=null;var H2=null;var H3=null;var History=this.history;var historyItem=this.getRandomNumber(History.length);historyDiv.update();H2=new Element('h2').update(History[historyItem].title);H3=new Element('h3').update(History[historyItem].description[0].Text);ImgElement=new Element('img',{'class':'img_indent','src':History[historyItem].thumbnail,'alt':''});Span=new Element('span').update(History[historyItem].content[0].Text);ClearDiv=new Element('div',{'class':'clear'});historyDiv.insert({'bottom':H2});historyDiv.insert({'bottom':H3});historyDiv.insert({'bottom':ImgElement});historyDiv.insert({'bottom':Span});historyDiv.insert({'bottom':ClearDiv});historyDiv.appear();},getContent:function(oReq){var x=0,y=0,totContent=0,Max=9;var Content=XMLObjectifier.xmlToJSON(oReq.responseXML);totContent=Content.category[0].items[0].item.length;if(totContent>Max)
totContent=Max;for(x=0;x<totContent;x++)
{this.processContent(x+1,Content.category[0].items[0].item[x]);}
for(y=x;y<Max;y++)
{this.hideContent(y+1);}},hideContent:function(itemno){var contentDiv=$('contentArea'+itemno);contentDiv.hide();},processContent:function(itemno,Content){var contentDiv=$('content'+itemno);contentDiv.update();H2=new Element('h2').update(Content.title);H3=new Element('h3').update(Content.description[0].Text);Span=new Element('span').update(Content.content[0].Text);ClearDiv=new Element('div',{'class':'clear'});contentDiv.insert({'bottom':H2});contentDiv.insert({'bottom':H3});contentDiv.insert({'bottom':Span});contentDiv.insert({'bottom':ClearDiv});contentDiv.appear();},getDocuments:function(oReq){this.documents=XMLObjectifier.xmlToJSON(oReq.responseXML);this.processDocuments(this.documents);},getMovies:function(url,UniqueQS){var murl=url+'movies.xml?u='+UniqueQS;var aj_movies=new Ajax.Request(murl,{method:'get',onSuccess:this.getMoviesData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getMoviesData:function(oReq){this.movies=XMLObjectifier.xmlToJSON(oReq.responseXML);var sm=$('moviesSlideMenu');if(sm!=null)
{sm.fade();this.showMoviesList();}},getLinks:function(oReq){this.links=XMLObjectifier.xmlToJSON(oReq.responseXML);this.processLinks(this.links);},getStats:function(){var UniqueQS=this.getRandomNumber(2400);var qs='?un='+UniqueQS+'&season='+this.currentSeason+'&x=1&f=seasonstats.json&t='+this.cfgClubs[this.stats.length].key;var aj=new Ajax.Request(genjson+qs,{method:'get',onSuccess:this.getStatsAjaxData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getStatsAjaxData:function(oReq){var statsResponse=oReq.responseJSON;if(statsResponse.rc==null)
this.stats.push(statsResponse.teamstats);else
this.stats.push(statsResponse);if(this.stats.length<this.cfgClubs.length)
this.getStats();else
this.getPlayerCards();},showPDF:function(card,team){var pdf=genjson+'?season='+this.currentSeason+'&card=1&x=1&f='+card+'&t='+this.cfgClubs[team].key;var pdfWin=window.open(pdf,"Player PDF Card","width=600,height=480,status,scrollbars,resizable, screenX=20,screenY=40,left=20,top=40");},getPlayerCards:function(){var UniqueQS=this.getRandomNumber(2400);var qs='?un='+UniqueQS+'&season='+this.currentSeason+'&x=1&f=playercards.json&t='+this.cfgClubs[this.cards.length].key;var aj=new Ajax.Request(genjson+qs,{method:'get',onSuccess:this.getCardsAjaxData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getCardsAjaxData:function(oReq){var statsResponse=oReq.responseJSON;if(statsResponse.rc==null)
this.cards.push(statsResponse.playerCards);else
this.cards.push(statsResponse);if(this.cards.length<this.cfgClubs.length)
this.getPlayerCards();else
this.getGameCards();},getGameCards:function(){var UniqueQS=this.getRandomNumber(2400);var qs='?un='+UniqueQS+'&season='+this.currentSeason+'&x=1&f=gamecards.json&t='+this.cfgClubs[this.gamecards.length].key;var aj=new Ajax.Request(genjson+qs,{method:'get',onSuccess:this.getGameCardsAjaxData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getGameCardsAjaxData:function(oReq){var statsResponse=oReq.responseJSON;if(statsResponse.rc==null)
this.gamecards.push(statsResponse.gameCards);else
this.gamecards.push(statsResponse);if(this.gamecards.length<this.cfgClubs.length)
this.getGameCards();else
this.getiScoreGames();},getiScoreGames:function(){var UniqueQS=this.getRandomNumber(2400);if(this.cfgClubs[this.iScore.length].iScoreID!='0000000000'){var qs='?c='+this.cfgClubs[this.iScore.length].iScoreID+'&un='+UniqueQS;var aj=new Ajax.Request('/cgi-bin/get-iscore.php'+qs,{method:'get',onSuccess:this.getiScoreGamesData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});}
else{this.iScore.push('No iScore Games');if(this.iScore.length<this.cfgClubs.length)
this.getiScoreGames();else
this.buildNav(1);}},getiScoreGamesData:function(oReq){var iScoreResp=XMLObjectifier.xmlToJSON(oReq.responseXML);if(iScoreResp!=null)
this.iScore.push(iScoreResp);else
this.iScore.push('No iScore Games');if(this.iScore.length<this.cfgClubs.length)
this.getiScoreGames();else
this.buildNav(1);},getLeaderData:function(){var UniqueQS=this.getRandomNumber(2400);var qs='?un='+UniqueQS+'&season='+this.currentSeason+'&x=1&f=leaders.json&t='+this.cfgClubs[this.lead.length].key;var ajl=new Ajax.Request(genjson+qs,{method:'get',onSuccess:this.getLeaders.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getClubData:function(){var UniqueQS=this.getRandomNumber(2400);var qs='?un='+UniqueQS+'&season='+this.currentSeason+'&t='+this.cfgClubs[this.club.length].key;var aj_v=new Ajax.Request(genjson+qs,{method:'get',onSuccess:this.getAjaxData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getCountData:function(){var UniqueQS=this.getRandomNumber(2400);var qs='?un='+UniqueQS+'&season='+this.currentSeason+'&f=countdown2.js&t='+this.cfgClubs[this.countdown.length].key;var aj_c=new Ajax.Request(genjson+qs,{method:'get',onSuccess:this.getAjaxDataCD.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getAjaxData:function(oReq){var td=oReq.responseJSON.teamdata;if(td==null)
return;this.club.push(td);this.clubsLoaded=this.club.length;if(this.club.length==1)
this.setupClubData();if(this.clubsLoaded<this.cfgClubs.length)
this.getClubData();else if(showLeaders){this.getLeaderData();}
else
this.getStats();},getAjaxDataCD:function(oReq){this.countdown.push(oReq.responseJSON);this.countsLoaded=this.countdown.length;if(this.countsLoaded<this.cfgClubs.length)
this.getCountData();},setupClubData:function(){this.teamno=999;this.getRandomPlayer();this.generateSplits(0);this.displayScheduleSummary(0);this.selectedPlayerExecutor=new PeriodicalExecuter(this.getRandomPlayer.bind(this),25);},processLinks:function(reqdata){var linkItems=reqdata.category[0].items[0];var TotLinks=linkItems.item.length;if(TotLinks==0)
return;var linkDiv=$('links');var LinkURL=null;var LinkTitle=null;var LinkDescription=null;var linkList=new Element('ul',{'class':'list1'});var desc=new Element('div').update('Commonly used links for users of this web site.  To add a site to this list, email the link to our ');var email=new Element('a',{'href':'mailto:'+reqdata.contactemail}).update('webmaster');var ClearDiv=new Element('div',{'class':'clear'});desc.insert({'bottom':email});linkDiv.update();Element.insert(linkDiv,{'bottom':desc});Element.insert(linkDiv,{'bottom':ClearDiv});for(var x=0;x<TotLinks;x++)
{LinkDescription=linkItems.item[x].description;LinkTitle=linkItems.item[x].title;LinkURL=linkItems.item[x].url;this.insertLink(linkList,LinkURL,LinkTitle,LinkDescription,x);}
Element.insert($('links'),{'bottom':linkList});},insertLink:function(linkList,theLink,theText,theDesc,idx)
{var bElement=new Element('b').update(theText);var emElement=new Element('em');var linkAnchor;var listItem=new Element('li');if(idx%2)
{linkAnchor=new Element('a',{'href':theLink,'target':'_blank','class':'bgd','title':theDesc});}
else
{linkAnchor=new Element('a',{'href':theLink,'target':'_blank','title':theDesc});}
emElement.insert({'bottom':bElement});linkAnchor.insert({'bottom':emElement});listItem.insert({'bottom':linkAnchor});linkList.insert({'bottom':listItem});},processDocuments:function(reqdata){var docItems=reqdata.category[0].items[0];var totDocs=docItems.item.length;if(totDocs==0)
return;var docDiv=$('documents');docDiv.update();var docURL=null;var docTitle=null;var docIdx=null;var docDescription=null;var subHead=new Element('h3').update('Files For Download');var downimg=new Element('img',{'class':'downimg','src':'/common/images/Download.png','align':'right'});subHead.insert({'bottom':downimg});var docList=new Element('ul',{'class':'down1'});var desc=new Element('div').update('Documents presented for download for users of this web site.  To add a document to this list, contact our ');var email=new Element('a',{'href':'mailto:'+reqdata.contactemail}).update('webmaster');var ClearDiv=new Element('div',{'class':'clear'});desc.insert({'bottom':email});Element.insert(docDiv,{'bottom':subHead});Element.insert(docDiv,{'bottom':desc});Element.insert(docDiv,{'bottom':ClearDiv});for(var x=0;x<totDocs;x++)
{docDescription=docItems.item[x].description;docTitle=docItems.item[x].title;docURL='documents/'+docItems.item[x].url;docIdx=x;this.insertDocument(docList,docURL,docTitle,docIdx,docDescription);}
Element.insert(docDiv,{'bottom':docList});},insertDocument:function(docList,theDoc,theText,docIdx,docDescription)
{var bElement=new Element('b').update(theText);var emElement=new Element('em');var linkAnchor;var listItem=new Element('li');if(docIdx%2)
{linkAnchor=new Element('a',{'href':theDoc,'target':'_blank','class':'bgd','title':docDescription});}
else
{linkAnchor=new Element('a',{'href':theDoc,'target':'_blank','title':docDescription});}
emElement.insert({'bottom':bElement});linkAnchor.insert({'bottom':emElement});listItem.insert({'bottom':linkAnchor});docList.insert({'bottom':listItem});},getImageName:function(Type,Team,fName,lName){var ReturnImage=null;var Roster=this.club[Team].rosterdata;var idx=0,Len=Roster.length;for(idx=0;idx<Len;idx++)
{if(Roster[idx].first==fName&&Roster[idx].last==lName)
{if(Type==0)
ReturnImage=Roster[idx].rostimg;else
ReturnImage=Roster[idx].profimg;break;}}
if(ReturnImage==null)
ReturnImage='missing.png';return(ReturnImage);},getRandomPlayer:function(){var numClubs=this.cfgClubs.length;if(this.teamno==999)
this.teamno=0;else
this.teamno=this.getRandomNumber(numClubs);if(this.club==null||this.club.length<this.teamno+1)
return;var playerIdx=this.getRandomNumber(this.club[this.teamno].rosterdata.length);this.selectedPlayer=this.club[this.teamno].rosterdata[playerIdx];this.selectedTeam=this.cfgClubs[this.teamno].name;if(this.selectedPlayer!=undefined)
this.processSelectedPlayer(this.teamno);else
this.getRandomPlayer();},processSelectedPlayer:function(Team){var fName=null;var selectedPlayerDiv=$('selectedplayer');this.buildPlayerBirthInfo(Team);this.buildPlayerDetail();if(this.cfgClubs[Team].maskRosterNames)
fName=this.selectedPlayer.first.substring(0,1)+'.';else
fName=this.selectedPlayer.first;var player=this.selectedPlayer.first+" "+this.selectedPlayer.last;var playerName=fName+' '+this.selectedPlayer.last;var displayImage='images/profile/'+this.currentSeason+'/'+this.selectedPlayer.profimg;var img=new Element('img',{'alt':playerName,'src':displayImage,'class':'p3'});var div=new Element('div',{'class':'line_hor'});var h6=new Element('h6').update(playerName);var p=new Element('span',{'class':'txt4'}).update(this.playerBirthInfo);var p2=new Element('span').update(this.playerDetail);selectedPlayerDiv.update();div.insert({'bottom':h6});div.insert({'bottom':p});selectedPlayerDiv.insert({'bottom':img});selectedPlayerDiv.insert({'bottom':div});selectedPlayerDiv.insert({'bottom':p2});selectedPlayerDiv.appear();},buildPlayerDetail:function(playerDetail){var year=null;var qSet=this.getRandomNumber(4)
if(this.selectedPlayer.year=='FR')
year='Freshman';else if(this.selectedPlayer.year=='SO')
year='Sophmore';else if(this.selectedPlayer.year=='JR')
year='Junior';else if(this.selectedPlayer.year=='SR')
year='Senior';this.playerDetail='Bats: '+this.selectedPlayer.bats+'<br/>'+'Throws: '+this.selectedPlayer.throws;if(year!=null)
this.playerDetail+='<br/>Class: '+year;if(this.selectedPlayer.height.length)
this.playerDetail+='<br/>Height: '+this.selectedPlayer.height;if(this.selectedPlayer.weight.length)
this.playerDetail+='<br/>Weight: '+this.selectedPlayer.weight;switch(qSet){case 0:if(this.selectedPlayer.middle.length)
this.playerDetail+='<br/>Middle School: '+'<em>'+this.selectedPlayer.middle+'</em>';if(this.selectedPlayer.awards.length)
this.playerDetail+='<br/>Baseball Awards: '+'<em>'+this.selectedPlayer.awards+'</em>';if(this.selectedPlayer.parents.length)
this.playerDetail+='<br/>Parents or Guardians: '+'<em>'+this.selectedPlayer.parents+'</em>';if(this.selectedPlayer.siblings.length)
this.playerDetail+='<br/>Siblings: '+'<em>'+this.selectedPlayer.siblings+'</em>';if(this.selectedPlayer.snack.length)
this.playerDetail+='<br/>Favorite Midnight Snack: '+'<em>'+this.selectedPlayer.snack+'</em>';break;case 1:if(this.selectedPlayer.movie.length)
this.playerDetail+='<br/>Favorite Movie: '+'<em>'+this.selectedPlayer.movie+'</em>';if(this.selectedPlayer.musician.length)
this.playerDetail+='<br/>Favorite Musician/Band: '+'<em>'+this.selectedPlayer.musician+'</em>';if(this.selectedPlayer.favteam.length)
this.playerDetail+='<br/>Favorite Sports Team: '+'<em>'+this.selectedPlayer.favteam+'</em>';if(this.selectedPlayer.ready.length)
this.playerDetail+='<br/>How to get ready for a game: '+'<em>'+this.selectedPlayer.ready+'</em>';if(this.selectedPlayer.goodat.length)
this.playerDetail+='<br/>'+this.selectedPlayer.first+' is good at: '+'<em>'+this.selectedPlayer.goodat+'</em>';break;case 2:if(this.selectedPlayer.athletes.length)
this.playerDetail+='<br/>Favorite Athlete: '+'<em>'+this.selectedPlayer.athletes+'</em>';if(this.selectedPlayer.advice.length)
this.playerDetail+='<br/>'+this.selectedPlayer.first+'s advice to kids: '+'<em>'+this.selectedPlayer.advice+'</em>';if(this.selectedPlayer.color.length)
this.playerDetail+='<br/>Favorite Color: '+'<em>'+this.selectedPlayer.color+'</em>';if(this.selectedPlayer.food.length)
this.playerDetail+='<br/>Favorite Food: '+'<em>'+this.selectedPlayer.food+'</em>';if(this.selectedPlayer.sport.length)
this.playerDetail+='<br/>'+'Favorite (other) Sport: '+'<em>'+this.selectedPlayer.sport+'</em>';break;case 3:if(this.selectedPlayer.admire.length)
this.playerDetail+='<br/>People '+this.selectedPlayer.first+' admires most: '+'<em>'+this.selectedPlayer.admire+'</em>';if(this.selectedPlayer.shoesize.length)
this.playerDetail+='<br/>Shoe Size: '+'<em>'+this.selectedPlayer.shoesize+'</em>';if(this.selectedPlayer.famous.length)
this.playerDetail+='<br/>'+this.selectedPlayer.first+' has met: '+'<em>'+this.selectedPlayer.famous+'</em>';if(this.selectedPlayer.coach.length)
this.playerDetail+='<br/>About our Coaches: '+'<em>'+this.selectedPlayer.coach+'</em>';if(this.selectedPlayer.toughest.length)
this.playerDetail+='<br/>'+'Tougheset Individual Opponent: '+'<em>'+this.selectedPlayer.toughest+'</em>';if(this.selectedPlayer.aboutme.length)
this.playerDetail+='<br/>'+'What People Dont Know about '+this.selectedPlayer.first+': '+'<em>'+this.selectedPlayer.aboutme+'</em>';break;default:break;}},buildPlayerBirthInfo:function(Team){if(this.selectedPlayer.dob.length)
{var mo=this.selectedPlayer.dob.substring(4,6);var yr=this.selectedPlayer.dob.substring(0,4);var dy=this.selectedPlayer.dob.substring(6,8);var d=new Date(yr,mo-1,dy);if(!this.cfgClubs[Team].maskRosterDOB)
this.playerBirthInfo='Born '+d.format('l, F jS Y')+' '+this.selectedPlayer.hometown+'<br/>'+this.selectedTeam+' Team';else
{if(mo=='12'||mo=='01'||mo=='02')
this.playerBirthInfo='Born in the Winter of '+yr+' in ';else if(mo=='03'||mo=='04'||mo=='05')
this.playerBirthInfo='Born in the Spring of '+yr+' in ';else if(mo=='06'||mo=='07'||mo=='08')
this.playerBirthInfo='Born in the Summer of '+yr+' in ';else if(mo=='09'||mo=='10'||mo=='11')
this.playerBirthInfo='Born in the Fall of '+yr+' in ';this.playerBirthInfo+=this.selectedPlayer.hometown+'<br/>'+this.selectedTeam+' Team';}}
else
{this.playerBirthInfo=this.selectedTeam+' Team';}},genResultsNav:function(){var nav=$('resultsnav');nav.update();if(this.cfgClubs.length>1)
this.genResNav(nav);},genResNav:function(nav){for(var x=0;x<this.cfgClubs.length;x++)
{var clubLink='javascript:WebSite.showResults("'+x+'");';var clubHref=new Element('a',{'href':clubLink,'class':'resultsnav'}).update(this.cfgClubs[x].name);var sep=new Element('span').update(' | ');nav.insert({'bottom':clubHref});if(x+1!=this.cfgClubs.length)
nav.insert({'bottom':sep});}},printSchedule:function(Team,Type){this.printTeam=this.cfgClubs[Team].name;var url='xmldata/'+this.currentSeason+'/html/'+this.cfgClubs[Team].key+'/';var schName=null;switch(Type){case 1:default:schType='schedule.html';this.printHeader='Full Schedule';break;case 2:schType='pschedule.html';this.printHeader='Practice Schedule';break;case 3:schType='lschedule.html';this.printHeader='League Schedule';break;case 4:schType='tschedule.html';this.printHeader='Tournament Schedule';break;case 5:schType='hschedule.html';this.printHeader='Home Schedule';break;case 6:schType='aschedule.html';this.printHeader='Away Schedule';break;case 7:schType='dschedule.html';this.printHeader='Day Schedule';break;case 8:schType='nschedule.html';this.printHeader='Night Schedule';break;}
url+=schType;var UniqueQS=this.getRandomNumber(2400);var aj_news=new Ajax.Request(url+'?u='+UniqueQS,{method:'get',onSuccess:this.genSchedule.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},genSchedule:function(oReq){if(oReq.responseText.length>0)
{var sheduleWin=window.open("","printschedule","width=600,height=480,status,scrollbars,resizable, screenX=20,screenY=40,left=20,top=40");sheduleWin.document.write('<html><head><title>'+this.printHeader+'</title>');sheduleWin.document.write('<link type="text/css" href="/common/styles/print.css" rel="stylesheet"></head>');sheduleWin.document.write('<BODY BGCOLOR=#ffffff TEXT=#0000CC LINK=#33CCFF VLINK=#FF6666>');sheduleWin.document.write('<div class="teamListContent" id=sheduleWin>');sheduleWin.document.write(oReq.responseText);sheduleWin.document.write('</div><div><br/><input name="print" value="Print" type="button" onClick="window.print()" /></div></body></html>');}
else
alert('Schedule is not ready to print, please try later.');},showSchedule:function(Team,Type){var scheduleDiv=$('schedule');var theGames;var teamdir='documents/';var locations=null;var gamesheader;this.currentteam=Team;this.currentschedule=Type;teamdir+=this.cfgClubs[Team].key+'/Calendar/';gamesheader=this.cfgClubs[Team].name+' Schedule';locations=this.club[Team].locations;switch(Type){case 1:default:theGames=this.club[Team].games;break;case 2:theGames=this.club[Team].pgames;break;case 3:theGames=this.club[Team].lgames;break;case 4:theGames=this.club[Team].tgames;break;case 5:theGames=this.club[Team].hgames;break;case 6:theGames=this.club[Team].agames;break;case 7:theGames=this.club[Team].dgames;break;case 8:theGames=this.club[Team].ngames;break;}
$('prime').hide();this.updateLeftHeader(0);var schedNav=$('schedulenav');this.processScheduleNav(schedNav);$('schedulenav').appear();scheduleDiv.update();gamesSpan=new Element('span',{'class':'txt_schedule_header'}).update(gamesheader);var div=new Element('div',{'class':'schedule_hd'}).update(gamesSpan);scheduleDiv.insert({'bottom':div});this.processGames(scheduleDiv,theGames,teamdir,locations,Team);scheduleDiv.appear();},processScheduleNav:function(schedNav){schedNav.update();if(this.cfgClubs.length>1)
{this.genClubNav(schedNav);var br=new Element('br');schedNav.insert({'bottom':br});}
this.genClubSubNav(schedNav,'full','Full',1);this.genClubSubNav(schedNav,'practice','Practice',1);this.genClubSubNav(schedNav,'league','League',1);this.genClubSubNav(schedNav,'tourn','Tournament',1);this.genClubSubNav(schedNav,'day','Day',1);this.genClubSubNav(schedNav,'night','Night',1);this.genClubSubNav(schedNav,'home','Home',1);this.genClubSubNav(schedNav,'away','Away',0);this.genPrnNav(schedNav);this.genPrintMenu(schedNav);},genClubNav:function(schedNav){for(var x=0;x<this.cfgClubs.length;x++)
{var clubLink='javascript:handleMenu("club'+x+'");';var clubHref=new Element('a',{'href':clubLink,'class':'schedulenav'}).update(this.cfgClubs[x].name);var sep=new Element('span').update(' | ');schedNav.insert({'bottom':clubHref});if(x+1!=this.cfgClubs.length)
schedNav.insert({'bottom':sep});}},genClubSubNav:function(schedNav,option,desc,seperator){var subLink='javascript:handleMenu("'+option+'");';var subHref=new Element('a',{'href':subLink,'class':'subnav'}).update(desc);var sep=new Element('span').update(' | ');schedNav.insert({'bottom':subHref});if(seperator)
{var br=new Element('br');schedNav.insert({'bottom':sep});}},genPrnNav:function(schedNav){var sep1=new Element('span').update(' | ');var prnHref=new Element('a',{'href':'#','class':'subnav','id':'prnLink'}).update('Print');schedNav.insert({'bottom':sep1});schedNav.insert({'bottom':prnHref});},genPrintMenu:function(schedNav){var prnMenu=new Element('div',{'id':'prnMenu','class':'dmxNavigationMenu dark_black contextMenu','style':'width:190px'});var h3=new Element('h3').update('Print');var ul=new Element('ul',{'class':'menu dark_black vertical'});this.buildPrintNavItems(ul,'full','Full Schedule');this.buildPrintNavItems(ul,'practice','Practice Schedule');this.buildPrintNavItems(ul,'league','League Schedule');this.buildPrintNavItems(ul,'tourn','Tournament Schedule');this.buildPrintNavItems(ul,'day','Day Game Schedule');this.buildPrintNavItems(ul,'night','Night Game Schedule');this.buildPrintNavItems(ul,'home','Home Schedule');this.buildPrintNavItems(ul,'away','Away Schedule');prnMenu.insert({'bottom':h3});prnMenu.insert({'bottom':ul});schedNav.insert({'bottom':prnMenu});jQuery("#prnMenu").dmxNavigationMenu({width:190,timeout:50,mainShowEffect:"slide",mainShowDuration:"slow",mainShowEasing:"easeInBounce",mainHideEffect:"slide",mainHideDuration:"slow",mainHideEasing:"easeOutBounce",subShowDuration:"normal",subShowEasing:"swing",subHideDuration:"normal",subHideEasing:"swing",menuOrientation:"vertical",design:"dark_black",useMenuBarSearch:false,contextButton:"left",contextTarget:"#prnLink",contextPosition:"right",keyboard:false,menuWidth:190});},buildPrintNavItems:function(ul,mode,desc){var js="javascript:handleMenu('prn"+mode+"');";var li=new Element('li',{'title':desc});var href=new Element('a',{'href':js,'style':'text-align:left'});var img=new Element('img',{'src':'/ig/images/prntypes/'+mode+'.png','border':'0','alt':'Print '+desc,'title':'Print '+desc});href.insert({'bottom':img});href.insert({'bottom':desc});li.insert({'bottom':href});ul.insert({'bottom':li});},processGames:function(scheduleDiv,theGames,teamdir,locations,Team){var gamesHeader=null;var gamesDetail=null;var gamesColumn=null;var gamesSpan=null;var gamesCalLink=null;var gamesClear=null;var background=null;var isResult=null;var gameResult=null;var gameResultClass=null;var dateClass=null;var theOpponent=null;var gamesColumnTime=null;var gamesColumnAmPm=null;var gamesColumnDayOfWeek=null;var ampm=null;var gametime=null;var gamesImg=null;var teamLogo=null;var recapLink=null;var mapLink=null;var mapLL=null;var gamesToShow=null;this.setNavVars(theGames.length);var gamesToShow=this.schGamesCurrent+this.schGamesToShow;if(gamesToShow>theGames.length)
gamesToShow=theGames.length;for(var x=this.schGamesCurrent;x<gamesToShow;x++)
{if(x%2)
background='schedule_1';else
background='schedule_2';if(theGames[x].result!='F'&&theGames[x].result!='P')
{isResult=true;if(theGames[x].result=='W')
gameResultClass='txt_win';else
gameResultClass='txt_loss';}
else
{isResult=false;gamesCalLink=this.getCalLink(theGames[x].recap,teamdir)}
teamLogo=this.getTeamLogo(theGames[x].name,locations);theOpponent=theGames[x].home+' '+theGames[x].name;gamesDetail=new Element('div',{'class':background});if(isResult)
{recapLink=this.getRecapLink(theGames[x].recap,Team);gamesColumn=new Element('div',{'class':'col1result'});gamesSpan=new Element('span',{'class':gameResultClass}).update(theGames[x].result);gamesColumn.insert({'bottom':gamesSpan});gamesDetail.insert({'bottom':gamesColumn});gamesColumn=new Element('div',{'class':'col2result'});gamesSpan=new Element('span',{'class':'txt_score'}).update(theGames[x].score);gamesColumn.insert({'bottom':gamesSpan});gamesDetail.insert({'bottom':gamesColumn});gamesColumn=new Element('div',{'class':'col3team'});gamesSpan=new Element('span',{'class':'colTeamText'});gamesHref=new Element('a',{'href':recapLink,'class':'txt_team','alt':'Click for game recap'}).update(theOpponent);var gameDate=null;if(theGames[x].social.length>0)
gameDate=theGames[x].social+' - '+theGames[x].day+' '+theGames[x].date+' '+theGames[x].time;else
gameDate=theGames[x].day+' '+theGames[x].date+' '+theGames[x].time;var dateSpan=new Element('span',{'class':'colDateText'});var dateContent=new Element('span',{'class':'txt_date'}).update(gameDate);dateSpan.insert({'bottom':dateContent});gamesSpan.insert({'bottom':gamesHref});gamesColumn.insert({'bottom':gamesSpan});gamesColumn.insert({'bottom':dateSpan});gamesDetail.insert({'bottom':gamesColumn});}
else
{mapLL=this.getMapLink(theGames[x].location,locations);mapLink='javascript:WebSite.showDirections("'+mapLL+','+theGames[x].location+'");';gametime=this.getGameTime(theGames[x].time);ampm=this.getGameAMPM(theGames[x].time);dateClass=this.getDateClass(theGames[x].date);gamesColumn=new Element('div',{'class':dateClass});gamesSpan=new Element('span',{'class':'colCalText'});gamesHref=new Element('a',{'href':gamesCalLink,'class':'txt_day','alt':'Click to add this game to your Calendar'}).update(this.getDayValue(theGames[x].date));gamesSpan.insert({'bottom':gamesHref});gamesColumn.insert({'bottom':gamesSpan});gamesDetail.insert({'bottom':gamesColumn});gamesColumn=new Element('div',{'class':'col2game'});gamesColumnDayOfWeek=new Element('div',{'class':'col2dayofweek'});gamesColumnTime=new Element('div',{'class':'col2time'});gamesColumnAmPm=new Element('div',{'class':'col2ampm'});gamesSpan=new Element('span',{'class':'txt_dayofweek'}).update(theGames[x].day);gamesColumnDayOfWeek.insert({'bottom':gamesSpan});gamesSpan=new Element('span',{'class':'txt_time'}).update(gametime);gamesColumnTime.insert({'bottom':gamesSpan});gamesSpan=new Element('span',{'class':'txt_ampm'}).update(ampm);gamesColumnAmPm.insert({'bottom':gamesSpan});gamesColumn.insert({'bottom':gamesColumnDayOfWeek});gamesColumn.insert({'bottom':gamesColumnTime});gamesColumn.insert({'bottom':gamesColumnAmPm});gamesDetail.insert({'bottom':gamesColumn});var teamClass='colTeamSched';var socialSpan=null;if(theGames[x].social.length>0){socialSpan=new Element('span',{'class':'colDateText'});var socialContent=new Element('span',{'class':'txt_date'}).update(theGames[x].social);socialSpan.insert({'bottom':socialContent});teamClass='colTeamText';}
gamesColumn=new Element('div',{'class':'col3team'});gamesSpan=new Element('span',{'class':teamClass});gamesHref=new Element('a',{'href':mapLink,'class':'txt_team','alt':'Click to show map and get directions to this field'}).update(theOpponent);gamesSpan.insert({'bottom':gamesHref});gamesColumn.insert({'bottom':gamesSpan});if(socialSpan!=null)
gamesColumn.insert({'bottom':socialSpan});gamesDetail.insert({'bottom':gamesColumn});}
gamesColumn=new Element('div',{'class':'col4logo'});gamesImg=new Element('img',{'class':'games_teamlogo','src':teamLogo});gamesColumn.insert({'bottom':gamesImg});gamesDetail.insert({'bottom':gamesColumn});scheduleDiv.insert({'bottom':gamesDetail});gamesClear=new Element('div',{'class':'clear'});scheduleDiv.insert({'bottom':gamesClear});}
this.showScheduleNav(scheduleDiv);},initNavVars:function(){this.schGamesToShow=null;this.schGamesCurrent=null;this.schGamesPages=null;this.schGamesCurrPage=null;},setNavVars:function(totGames){if(this.schGamesToShow==null)
this.schGamesToShow=10;if(this.schGamesToShow>totGames)
this.schGamesToShow=totGames;if(this.schGamesCurrPage==null)
this.schGamesCurrPage=1;if(this.schGamesCurrent==null)
this.schGamesCurrent=0;else
this.schGamesCurrent=this.schGamesToShow*this.schGamesCurrPage-this.schGamesToShow;this.schGamesPages=totGames/this.schGamesToShow;},showScheduleNav:function(scheduleDiv){var navDiv;var navLink;var navSpan;var navHref;var navDiv=new Element('div',{'class':'txtpaging'}).update('Page: ');for(var x=0;x<this.schGamesPages;x++)
{if(x!=this.schGamesCurrPage-1)
{navLink='javascript:WebSite.navSchedule('+(x+1)+')';navHref=new Element('a',{'href':navLink,'class':'navpaging'}).update(' '+(x+1)+' ');navDiv.insert({'bottom':navHref});}
else
{navSpan=new Element('span',{'class':'txtpaging'}).update(' '+(x+1)+' ');navDiv.insert({'bottom':navSpan});}}
scheduleDiv.insert({'bottom':navDiv});},navSchedule:function(page){this.schGamesCurrPage=page;this.showSchedule(this.currentteam,this.currentschedule);},getDateClass:function(gameDate){return('col1game_'+gameDate.substring(0,2));},getDayValue:function(gameDate){return(gameDate.substring(3,5));},getCalLink:function(recap,teamdir){var calfile=recap.substring(0,recap.length-6);return(teamdir+calfile+'.ics');},getGameTime:function(gametime){return(gametime.substring(0,5));},getGameAMPM:function(gametime){return(gametime.substring(5,7));},getTeamLogo:function(name,locations){var imgPath=imagePath+'TeamLogos/';var returnImage=null;var LocLength=null;if(Prototype.Browser.IE)
LocLength=locations.length-1;else
LocLength=locations.length;for(var x=0;x<LocLength;x++)
{if(name==locations[x].name)
{returnImage=locations[x].image;break;}}
if(returnImage==null)
returnImage="ghsa.png";imgPath+=returnImage;return(imgPath);},getRecapLink:function(recap,Team){var returnLink="javascript:WebSite.showRecap('";var GameKey=this.cfgClubs[Team].key+recap.substring(0,recap.length-6);returnLink+=GameKey;returnLink+="');";return(returnLink);},getMapLink:function(location,locations){var returnLink=null;var LocLength=null;var LatLong=null;if(Prototype.Browser.IE)
LocLength=locations.length-1;else
LocLength=locations.length;for(var x=0;x<LocLength;x++)
{if(location==locations[x].name)
{LatLong=locations[x].latlong;break;}}
if(LatLong==null)
LatLong=locations[x].latlong;returnLink=LatLong;return(returnLink);},showRecap:function(recap){var News=this.news.category[0].items[0].item;var len=News.length;var NewsItem=null;for(var idx=0;idx<len;idx++)
{if(recap==News[idx].key)
{NewsItem=idx;break;}}
if(NewsItem!=null)
this.displayNewsItem(NewsItem,1);else
alert("There is no recap for this game.");},showDynamic:function(story){WebSite.transFull(0);var News=this.news.category[0].items[0].item;var len=News.length;var NewsItem=null;for(var idx=0;idx<len;idx++)
{if(story==News[idx].key)
{NewsItem=idx;break;}}
if(NewsItem!=null)
this.displayNewsItem(NewsItem,0);else
alert("Sorry, this item is no longer available.");},showResults:function(Team){this.initCountdownVars(Team);this.generateSplits(Team);this.displayScheduleSummary(Team);},initCountdownVars:function(TheTeam){this.TeamUpdated=1;clearTimeout(alertTimerId);year=this.countdown[TheTeam].year;month=this.countdown[TheTeam].month;day=this.countdown[TheTeam].day;hour=this.countdown[TheTeam].hour;mins=this.countdown[TheTeam].mins;nextevent=this.countdown[TheTeam].nextevent;nextgame=this.countdown[TheTeam].nextgame;startCount();displayNextGame();this.displayScheduleSummary(TheTeam);},updateLeftHeader:function(type){var lh=$('leftHeader');if(lh==null)
return;var lc=$('leftCaption');var hd=$('header_ss');if(type==0){lh.update('Results');lc.update('Team Report');if(hd!=null)
hd.setOpacity(1);}
else if(type==1){lh.update('Directions');lc.update('Turn by Turn Directions');if(hd!=null)
hd.setOpacity(1);}
else if(type==2){lh.update('Videos and Movies');lc.update('Select video from the list');if(hd!=null)
hd.setOpacity(0.1);}},generateSplits:function(Team){this.updateLeftHeader(0);this.genResultsNav();var resultsDiv=$('results');var theSplits;var splitsheader=this.cfgClubs[Team].name+' Team Splits';theSplits=this.club[Team].Splits;resultsDiv.update();var div=new Element('div',{'class':'box1_splits_hd'}).update(splitsheader);resultsDiv.insert({'bottom':div});div=new Element('div',{'class':sport+'_box1_splits_bg'});resultsDiv.insert({'bottom':div});this.processSplits(resultsDiv,theSplits);},processSplits:function(resultsDiv,theSplits){var splitsHeader;var splitsDetail;var splitsColumn;var splitsClear;for(var x=0;x<theSplits.length;x++)
{splitsHeader=new Element('div',{'class':'box1_splits_chd'}).update(theSplits[x].Type);splitsDetail=new Element('div',{'class':'box2_splits'});splitsColumn=new Element('div',{'class':'column1'}).update(theSplits[x].Wins);splitsDetail.insert({'bottom':splitsColumn});splitsColumn=new Element('div',{'class':'column2'}).update(theSplits[x].Losses);splitsDetail.insert({'bottom':splitsColumn});splitsColumn=new Element('div',{'class':'column3'}).update(theSplits[x].Ties);splitsDetail.insert({'bottom':splitsColumn});splitsColumn=new Element('div',{'class':'column4'}).update(theSplits[x].PCT);splitsDetail.insert({'bottom':splitsColumn});splitsColumn=new Element('div',{'class':'column5'}).update(theSplits[x].Runs);splitsDetail.insert({'bottom':splitsColumn});splitsColumn=new Element('div',{'class':'column6'}).update(theSplits[x].RunsAgainst);splitsDetail.insert({'bottom':splitsColumn});splitsColumn=new Element('div',{'class':'clear'});splitsDetail.insert({'bottom':splitsColumn});resultsDiv.insert({'bottom':splitsHeader});resultsDiv.insert({'bottom':splitsDetail});}},displayScheduleSummary:function(Team){var ScheduleSummaryText=this.club[Team].ScheduleSummary;$('schedulesummary').update(ScheduleSummaryText);},genDugoutClub:function(){var mouseOver="dmxAnimate('#popButton', {translateY:0}, {translateY:-28}, {duration:700,easing:'easeOutElastic',loop:1,stop:true});dmxAnimate('#pennant', {}, {rotate:-12}, {duration:400,loop:1});";var mouseOut="dmxAnimate('#popButton', {}, {translateY:0}, {duration:1000,loop:1,stop:true});dmxAnimate('#pennant', {}, {rotate:0}, {duration:400,loop:1});";var dugoutDiv=$('dugoutclub');var ClearDiv=new Element('div',{'class':'clear'});var popElement=new Element('img',{'id':'popButton','src':'images/custom/signuptoday.png','alt':''});var ImgElement=new Element('img',{'id':'pennant','src':pennantImage,'alt':'','onclick':'WebSite.getDugoutData();','onmouseover':mouseOver,'onmouseout':mouseOut});dugoutDiv.update();dugoutDiv.insert({'bottom':ImgElement});dugoutDiv.insert({'bottom':popElement});dugoutDiv.insert({'bottom':ClearDiv});dugoutDiv.show();},getDugoutData:function(){if(this.dugout!=null)
this.genDugoutPitch();else{var UniqueQS=this.getRandomNumber(2400);var url='xmldata/'+this.currentSeason+'/dugout.xml?u='+UniqueQS;var aj_dugout=new Ajax.Request(url,{method:'get',onSuccess:this.getDugoutVar.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});}},getDugoutVar:function(oReq){this.dugout=XMLObjectifier.xmlToJSON(oReq.responseXML);this.genDugoutPitch();},genDugoutPitch:function(){var updh1=this.dugout.title;var updtext=this.dugout.Text;var updh3='If you are not a member, join today!';var LinkURL='javascript:handleMenu("show0");';var boosterDiv=$('prime');if(this.dugout.showfull=='1'){this.preparePrime();WebSite.transFull(1);boosterDiv=$('fullPage');}
this.transFull(this.dugout.showfull);boosterDiv.update();var leadStory=new Element('div');leadStory.insert({bottom:new Element('h1').update(updh1)});leadStory.insert({bottom:new Element('h3').update(updh3)});leadStory.insert({bottom:new Element('span').update(updtext)});leadStory.insert({bottom:new Element('a',{'href':LinkURL}).update('Lead News Story')});boosterDiv.insert({'bottom':leadStory});boosterDiv.show();dmxAnimate('#dugoutPennant',{},{rotate:90},{duration:800,loop:1});dmxAnimate('#dugoutPennant',{translateY:0},{translateY:-20},{duration:700,easing:'easeOutElastic',loop:1,stop:true});},getToday:function(){var today=new Date();var todayText=null;var H3=null;todayText=today.format('l, jS F Y');H3=new Element('h3').update(todayText);var dateDiv=$('currdate');dateDiv.update();ClearDiv=new Element('div',{'class':'clear'});dateDiv.insert({'bottom':H3});dateDiv.insert({'bottom':ClearDiv});dateDiv.appear();},getWeather:function(){var aj_weather=new Ajax.Request('/cgi-bin/get-weather.php?zip='+weatherZip,{method:'get',onSuccess:this.getForecast.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getForecast:function(oReq){this.forecast=XMLObjectifier.xmlToJSON(oReq.responseXML);this.processCurrentCondition(this.forecast);},processCurrentCondition:function(reqdata){if(reqdata.RootName=='parsererror')
return;var current=reqdata.weather[0].current_conditions[0];var city=reqdata.weather[0].forecast_information[0].city[0].data;var zip=reqdata.weather[0].forecast_information[0].postal_code[0].data;var weatherDiv=$('weather');var ImgElement=null;var Span=null;var ClearDiv=null;var H3=null;var wCondition=current.condition[0].data;var wTemp=current.temp_f[0].data;var wWind=current.wind_condition[0].data;var wHumid=current.humidity[0].data;var wImage=current.icon[0].data;var weatherText=wCondition+' '+wTemp+'&deg; ';weatherDiv.update();H3=new Element('h3').update(city+' Conditions');ImgElement=new Element('img',{'class':'img_indent','src':wImage});Span=new Element('span').update(weatherText);Span.insert(new Element('br'));Span.insert(wWind+' ');Span.insert(wHumid);weatherDiv.insert({'bottom':H3});weatherDiv.insert({'bottom':ImgElement});weatherDiv.insert({'bottom':Span});ClearDiv=new Element('div',{'class':'clear'});weatherDiv.insert({'bottom':ClearDiv});weatherDiv.appear();},getSlideShow:function(){var UniqueQS=this.getRandomNumber(2400);var url='xmldata/'+this.currentSeason+'/slideshow.xml?u='+UniqueQS;if(this.slideshow==null)
var aj_slideshow=new Ajax.Request(url,{method:'get',onSuccess:this.getSlideShowData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});else
this.showSlideShow(this.slideshow);},getSlideShowData:function(oReq){this.slideshow=XMLObjectifier.xmlToJSON(oReq.responseXML);this.showSlideShow(this.slideshow);},showSlideShow:function(SlideShow){this.preparePrime();WebSite.transFull(1);var slideDiv=$('fullPage');slideDiv.update();H2=new Element('h2').update('Slide Show');H3=new Element('h3').update('Thank you to all who have taken these pictures!');slideDiv.insert({'bottom':H2});slideDiv.insert({'bottom':H3});var slideSize='width:'+slideShowWidth+'px;height:'+slideShowHeight+'px;left:'+slideShowLeft+'px;';var mainDiv=new Element('div',{'id':'slideshow','class':'dmxSlideshow '+sss,'style':slideSize});var totSlides=SlideShow.item.length;for(var x=0;x<20;x++)
{var slide=this.getRandomNumber(totSlides);var imgName=SlideShow.item[slide].image;var simg='images/team/'+this.currentSeason+'/'+imgName;var img=new Element('img',{'src':simg});var div=new Element('div',{'class':'dmxSlide'}).update(img);mainDiv.insert({'bottom':div});}
slideDiv.insert({'bottom':mainDiv});jQuery("#slideshow").dmxHTML5Slideshow({width:slideShowWidth,height:slideShowHeight,shuffle:true,controls:{enabled:true,position:'bottom'},kenburns:{enabled:animateSlideShow,start:{zoom:'1~1.1',pan:'random'},end:{zoom:'1~1.1',pan:'random'}}});},showDirections:function(latlong){var lat=null;var long=null
var loc=null;var myArr=new Array();var myString=new String();myString=latlong;myArr=myString.split(",");if(myArr.length==3)
{lat=myArr[0];long=myArr[1];loc=myArr[2];}
else
{lat=33.961604;long=-83.977239;loc="Park";}
this.map=null;this.dirDis=null;this.dirSer=null;this.renOpt=null;this.textLatLong=null;this.textLatLong=lat+','+long;this.preparePrime();var mapDiv=$('prime');var mapDir=$('mapdir');mapDir.update();mapDir.hide();var js='javascript:WebSite.showNarrative();';var printjs='javascript:WebSite.printDir();';var cntrDiv=new Element('div',{'id':"dirEntry"});var spn=new Element('span',{'id':'dirText','class':'dirText'}).update('Enter your starting address and click <b>Get Directions</b> to get driving directions to '+loc);var br=new Element('br');var txt=new Element('input',{'id':'origin','type':'text','name':'origin','size':'32'});var btn=new Element('input',{'type':'button','name':'showDir','value':'Get Directions','onClick':js});var printbtn=new Element('input',{'type':'button','id':'printDir','value':'Print Directions','onClick':printjs,'style':'display:none'});cntrDiv.insert({'bottom':spn});cntrDiv.insert({'bottom':br});cntrDiv.insert({'bottom':txt});cntrDiv.insert({'bottom':btn});cntrDiv.insert({'bottom':printbtn});mapDiv.insert({'bottom':cntrDiv});var mapDimensions='width: '+mapWidth+'px; height: '+mapHeight+'px;';var div=new Element('div',{'id':"map_canvas",'class':'map','style':mapDimensions});mapDiv.insert({'bottom':div});mapDiv.show();this.initMap3(div,lat,long,loc);},initMap3:function(mapDiv,lat,long,loc){var mapLatlng=new google.maps.LatLng(lat,long);var mapOptions={zoom:14,center:mapLatlng,mapTypeId:google.maps.MapTypeId.ROADMAP}
this.map=new google.maps.Map(mapDiv,mapOptions);var marker=new google.maps.Marker({position:mapLatlng,map:this.map,title:loc});this.renOpt={draggable:true};this.dirDis=new google.maps.DirectionsRenderer(this.renOpt);;this.dirSer=new google.maps.DirectionsService();var mapDir=$('mapdir');this.dirDis.setMap(this.map);this.dirDis.setPanel(mapDir);google.maps.event.addListener(this.dirDis,'directions_changed',function(){WebSite.compTotDist(WebSite.dirDis.directions);});google.maps.event.trigger(this.map,'resize');},calcRoute:function(){var orgAddr=$F('origin');var request={origin:orgAddr,destination:WebSite.textLatLong,travelMode:google.maps.DirectionsTravelMode.DRIVING};WebSite.dirSer.route(request,function(response,status){if(status==google.maps.DirectionsStatus.OK){WebSite.dirDis.setDirections(response);$('mapdir').appear();}});},compTotDist:function(result){var total=0;var myroute=result.routes[0];for(i=0;i<myroute.legs.length;i++){total+=myroute.legs[i].distance.value;}
total=total/1000;var mapText=$('dirText');mapText.update('Total Distance: '+total+'km');},showNarrative:function(){this.calcRoute();this.updateLeftHeader(1);var pBtn=$('printDir');pBtn.appear();},getToon:function(){var url='xmldata/'+this.currentSeason+'/cartoons.xml';if(this.toon==null)
var aj_toon=new Ajax.Request(url,{method:'get',onSuccess:this.getToonData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});else
this.showToon(this.toon);},getToonData:function(oReq){this.toon=XMLObjectifier.xmlToJSON(oReq.responseXML);this.showToon(this.toon);},showToon:function(Toon){this.preparePrime();var toonDiv=$('prime');toonDiv.update();H2=new Element('h2').update(Toon.title);H3=new Element('h3').update('&copy; '+Toon.copyright);var img=new Element('img',{'src':'/common/images/InTheBleachersButton'+cartoonWidth+'.png','alt':'Link to: '+Toon.title,'align':'right'});var button=new Element('a',{'href':Toon.url,'target':'_blank'}).update(img);toonDiv.insert({'bottom':H2});toonDiv.insert({'bottom':H3});var toonSize='width:'+cartoonWidth+'px;height:425px';var mainDiv=new Element('div',{'id':'tuneshow','class':'dmxSlideshow '+sss,'style':toonSize});var totSlides=Toon.item.length;for(var x=0;x<30;x++)
{var slide=this.getRandomNumber(totSlides);var imgName=Toon.item[slide].image;var simg='/common/images/Cartoons/'+imgName;var img=new Element('img',{'src':simg});var div=new Element('div',{'class':'dmxSlide'}).update(img);mainDiv.insert({'bottom':div});}
toonDiv.insert({'bottom':button});toonDiv.insert({'bottom':mainDiv});$('prime').show();jQuery("#tuneshow").dmxHTML5Slideshow({width:cartoonWidth,height:425,shuffle:true,slide:{duration:10000},transition:{effect:"random",duration:1000},controls:{enabled:true,position:'bottom'},kenburns:{enabled:false}});},getCheer:function(){var url='xmldata/'+this.currentSeason+'/cheer.xml';if(this.cheer==null)
var aj_cheer=new Ajax.Request(url,{method:'get',onSuccess:this.getCheerData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});else
this.showCheer();},getCheerData:function(oReq){this.cheer=XMLObjectifier.xmlToJSON(oReq.responseXML);this.showCheer();},getStaff:function(){var url='xmldata/'+this.currentSeason+'/staff.xml';if(this.staff==null)
var aj_staff=new Ajax.Request(url,{method:'get',onSuccess:this.getStaffData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});else
this.showStaff(this.staff);},getStaffData:function(oReq){this.staff=XMLObjectifier.xmlToJSON(oReq.responseXML);this.showStaff(this.staff);},showStaff:function(Staff){this.preparePrime();var staffDiv=$('prime');var staffSize='width:'+staffWidth+'px;height:480px';var mainDiv=new Element('div',{'class':'dmxSlidingPanels '+sms,'style':staffSize});var headerDiv=new Element('div',{'class':'dmxSlidingPanelsHeader'});var slidePanel=new Element('div',{'id':'staffSlidePanel','class':'dmxSlidingPanelView'});var footerDiv=new Element('div',{'class':'dmxSlidingPanelsFooter'});var prevButton=new Element('a',{'href':'#'}).update('Prev');var nextButton=new Element('a',{'href':'#'}).update('Next');var prevButtonDiv=new Element('div',{'class':'dmxSlidingPanelsPrev'}).update(prevButton);var nextButtonDiv=new Element('div',{'class':'dmxSlidingPanelsNext'}).update(nextButton);var staffTitle=new Element('div',{'class':'dmxSlidingPanelsTitle'}).update('Staff');var staffNavDiv=new Element('div',{'class':'dmxSlidingPanelsNav'});this.genStaffNav(staffNavDiv,Staff.category[0].items[0].item);this.genStaffContent(slidePanel,Staff.category[0].items[0].item);headerDiv.insert({'bottom':prevButtonDiv});headerDiv.insert({'bottom':nextButtonDiv});headerDiv.insert({'bottom':staffTitle});headerDiv.insert({'bottom':staffNavDiv});mainDiv.insert({'bottom':headerDiv});mainDiv.insert({'bottom':slidePanel});mainDiv.insert({'bottom':footerDiv});staffDiv.insert({'bottom':mainDiv});$('prime').show();jQuery("#staffSlidePanel").dmxSlidingPanels({});},genStaffNav:function(nav,Staff){var ul=new Element('ul');for(var x=0;x<Staff.length;x++)
{var li=new Element('li');var a=new Element('a',{'href':'#'}).update(Staff[x].key);li.insert({'bottom':a});ul.insert({'bottom':li});}
nav.insert({'bottom':ul});},genStaffContent:function(content,Staff){for(var x=0;x<Staff.length;x++)
{var page=new Element('div',{'id':'page'+x+1,'class':'dmxSlidingPanelsPage'});var ul=new Element('ul',{'class':'galleries'});var li=new Element('li');var img=new Element('img',{'src':Staff[x].thumbnail,'alt':Staff[x].title});var div=new Element('div').update(Staff[x].content[0].Text);var h2=new Element('h2').update(Staff[x].title);var h3=new Element('h3').update(Staff[x].description[0].Text);li.insert({'bottom':img});li.insert({'bottom':h2});li.insert({'bottom':h3});li.insert({'bottom':div});ul.insert({'bottom':li});page.insert({'bottom':ul});content.insert({'bottom':page});}},transFull:function(trans){if(trans==1)
{if(this.showFull!=1)
{this.showFull=1;$('content').hide();$('full').show();var exists=$('hdSlideShow');if(exists)
exists.update();}}
else{if(this.showFull==1)
{this.showFull=0;$('full').hide();$('content').show();this.buildHeaderSlideShow();$('fullPage').update();}}
$('mapdir').hide();},showCalView:function(){$('schedulenav').hide();$('schedule').hide();var mainDiv=$('prime');mainDiv.update();var calDiv=new Element('div',{'class':'dmx_ajax_event_calendar '+sms,'id':'gamecal','style':'width:'+calendarWidth+'px;'});mainDiv.insert({'bottom':calDiv});this.ShowCal(this.currentSeason,calendarWidth);mainDiv.show();},showLocations:function(Team){this.preparePrime();var locDiv=$('prime');var locHeader=null;var locData=null;this.currentteam=Team;locData=this.club[Team].locations;locHeader=this.cfgClubs[Team].name+' Event Locations';this.genLocationNav(locDiv);this.genLocationDetail(locDiv,locHeader,locData);$('prime').show();jQuery("#locSlideMenu").dmxSlidingMenu({updateBackLabel:false});},genLocationNav:function(locDiv){var div=new Element('div',{'class':'locationdiv'});for(var x=0;x<this.cfgClubs.length;x++)
{var rostLink="javascript:handleMenu('loca"+x+"')";var LinkRef=new Element('a',{'href':rostLink,'class':'locationnav'}).update(this.cfgClubs[x].name);div.insert({'bottom':LinkRef});if(x+1!=this.cfgClubs.length)
{var seperator=new Element('span').update(' | ');div.insert({'bottom':seperator});}}
locDiv.insert({'bottom':div});},genLocationDetail:function(locDiv,locHeader,locData){var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+locationsWidth+'px;height:480px'});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var backButton=new Element('a',{'href':'#'}).update('Back');var locTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(locHeader);var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'});var slideMenu=new Element('div',{'id':'locSlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':locHeader});var locItem=new Element('li',{'title':locHeader});backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':locTitle});slideMenu.insert({'bottom':slideMenuTitle});this.genLocItems(slideMenuTitle,locData);mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});locDiv.insert({'bottom':mainDiv});},genLocItems:function(slideMenu,locData){var liClass=null;for(var x=0;x<locData.length;x++)
{if(x==0)
liClass='dmxSlidingMenuItemFirst';else if(x==locData.length-1)
liClass='dmxSlidingMenuItemLast';else
liClass=null;var thisItem=locData[x];var js="javascript:WebSite.showDirections('"+thisItem.latlong+","+thisItem.name+"');";var updh1=thisItem.name;var updh3=thisItem.address+', '+thisItem.city+' '+thisItem.state+' '+thisItem.zip;var spanItemTitle=new Element('span',{'class':'txt_news'}).update(updh1);var spanItemDesc=new Element('span',{'class':'txt_newsdesc'}).update(updh3);var link=new Element('input',{'type':'button','value':'View','class':'viewButton','title':'Show Directions to '+thisItem.name,'onClick':js});var adv=new Element('div',{'style':'float:right;margin-top:-13px;'}).update(link);var locItem=null;if(liClass==null)
locItem=new Element('li',{'title':updh1});else
locItem=new Element('li',{'title':updh1,'class':liClass});var anchorLink=new Element('a',{'href':'javascript:void(0);'});anchorLink.insert({'bottom':spanItemTitle});spanItemDesc.insert({'bottom':adv});anchorLink.insert({'bottom':spanItemDesc});locItem.insert({'bottom':anchorLink});slideMenu.insert({'bottom':locItem});}},showAllNews:function(newsType){this.preparePrime();var newsDiv=$('prime');var newsHeader='All News and Announcements';var newsData=this.news.category[0].items[0];this.genNewsDetail(newsDiv,newsHeader,newsData);$('prime').show();jQuery("#newsSlideMenu").dmxSlidingMenu({updateBackLabel:false});},genNewsDetail:function(newsDiv,newsHeader,newsData){var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+allNewsWidth+'px;height:480px'});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var backButton=new Element('a',{'href':'#'}).update('Back');var newsTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(newsHeader);var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'});var slideMenu=new Element('div',{'id':'newsSlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':newsHeader});var newsItem=new Element('li',{'title':newsHeader});backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':newsTitle});slideMenu.insert({'bottom':slideMenuTitle});this.genNewsItems(slideMenuTitle,newsData.item);mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});newsDiv.insert({'bottom':mainDiv});},genNewsItems:function(slideMenu,newsData){var liClass=null;for(var x=0;x<newsData.length;x++)
{if(x==0)
liClass='dmxSlidingMenuItemFirst';else if(x==newsData.length-1)
liClass='dmxSlidingMenuItemLast';else
liClass=null;var thisItem=newsData[x];var updtext=thisItem.content[0].Text;var updh1=thisItem.title;var updh3=thisItem.date+' - '+thisItem.description[0].Text;var spanItemTitle=new Element('span',{'class':'txt_news'}).update(updh1);var spanItemDesc=new Element('span',{'class':'txt_newsdesc'}).update(updh3);var newsItem=null;if(liClass==null)
newsItem=new Element('li',{'title':updh1});else
newsItem=new Element('li',{'title':updh1,'class':liClass});var anchorLink=new Element('a',{'href':'javascript:void(0);'});anchorLink.insert({'bottom':spanItemTitle});anchorLink.insert({'bottom':spanItemDesc});var contentPage=new Element('ul',{'title':updh1,'class':'dmxSlidingMenuContentPage'});var contentDetail=new Element('li',{'class':'dmxSlidingMenuItemContent'});this.genNewsContent(contentDetail,updh1,updh3,updtext);contentPage.insert({'bottom':contentDetail});newsItem.insert({'bottom':anchorLink});newsItem.insert({'bottom':contentPage});slideMenu.insert({'bottom':newsItem});}},genNewsContent:function(content,newsTitle,newsDesc,newsContent){var desc=new Element('h3').update(newsDesc);var cont=new Element('span').update(newsContent);var nimg='/common/images/news_sm.png';var img=new Element('img',{'src':nimg,'class':'dmxSlidingMenuItemImageRight','border':'0'});content.insert({'bottom':img});content.insert({'bottom':desc});content.insert({'bottom':cont});},genGameDayTeamNav:function(gamedayDiv){var div=new Element('div',{'class':'gamedaydiv'});for(var x=0;x<this.cfgClubs.length;x++)
{var statLink="javascript:WebSite.showGameDay('"+x+"')";var LinkRef=new Element('a',{'href':statLink,'class':'gamedaynav'}).update(this.cfgClubs[x].name);div.insert({'bottom':LinkRef});if(x+1!=this.cfgClubs.length)
{var seperator=new Element('span').update(' | ');div.insert({'bottom':seperator});}}
gamedayDiv.insert({'bottom':div});},showGameDay:function(team){this.preparePrime();var gamedayDiv=$('prime');this.genGameDayTeamNav(gamedayDiv);var gamedayHeader=null;var gamedayData=this.iScore[team];if(gamedayData==null){alert('iScore data is not loaded yet, please try again later');return;}
gamedayHeader='Select Game for Live Action or Replay';this.genGameDayDetail(gamedayDiv,gamedayHeader,gamedayData,team);gamedayDiv.show();jQuery("#gamedaySlideMenu").dmxSlidingMenu({updateBackLabel:false});},genGameDayDetail:function(gamedayDiv,gamedayHeader,gamedayData,team){var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+gamedayWidth+'px;height:'+gamedayHeight+'px'});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var js="javascript:WebSite.cleariScoreGames("+team+");";var backButton=new Element('a',{'href':'#','onClick':js}).update('Back');var gamedayTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(gamedayHeader);var footerText=null;if(gamedayData=='No iScore Games')
footerText='This team has no iScore games this season';else
footerText='Select from '+gamedayData.GAME.length+' games.';var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'}).update(footerText);var slideMenu=new Element('div',{'id':'gamedaySlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':gamedayHeader});var gamedayItem=new Element('li',{'title':gamedayHeader});backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':gamedayTitle});slideMenu.insert({'bottom':slideMenuTitle});if(gamedayData!='No iScore Games')
this.genGameDayItems(slideMenuTitle,gamedayData.GAME);mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});gamedayDiv.insert({'bottom':mainDiv});},genGameDayItems:function(slideMenu,gamedayData){var liClass=null;for(var x=0;x<gamedayData.length;x++)
{if(x==0)
liClass='dmxSlidingMenuItemLast';else if(x==gamedayData.length-1)
liClass='dmxSlidingMenuItemFirst';else
liClass=null;var thisItem=gamedayData[x];var updh1=unescape(thisItem.gameName);var spanItemTitle=new Element('span',{'class':'txt_news'}).update(updh1);var gamedayItem=null;if(liClass==null)
gamedayItem=new Element('li',{'title':updh1});else
gamedayItem=new Element('li',{'title':updh1,'class':liClass});var guid=thisItem.guid;var js="javascript:WebSite.showiScoreGame('"+guid+"');";var anchorLink=new Element('a',{'href':'javascript:void(0);','onClick':js});anchorLink.insert({'bottom':spanItemTitle});var contentPage=new Element('ul',{'title':updh1,'class':'dmxSlidingMenuContentPage'});var contentDetail=new Element('li',{'class':'dmxSlidingMenuItemContent'});this.genGameDayContent(contentDetail,updh1,guid);contentPage.insert({'bottom':contentDetail});gamedayItem.insert({'bottom':anchorLink});gamedayItem.insert({'bottom':contentPage});slideMenu.insert({'top':gamedayItem});}},genGameDayContent:function(content,gamedayTitle,guid){var cont=new Element('div',{'id':guid,'style':'background:#ffffff;'});content.insert({'bottom':cont});},showiScoreGame:function(guid){var gameDiv=$(guid);var gameURL='http://data.iscorecentral.com/iscorecast/htmlplayer.php?g='+guid;var iF=new Element('iframe',{'src':gameURL,'width':iScoreWidth,'height':iScoreHeight,'frameborder':'0'});gameDiv.insert({'bottom':iF});},cleariScoreGames:function(team){var gamedayData=this.iScore[team];var idx=0;for(idx=0;idx<gamedayData.GAME.length;idx++)
$(gamedayData.GAME[idx].guid).update();},getMaxSponsors:function(){max=null;var tot=this.sponsors.category[0].items[0].item.length;if(tot>maxSponsors)
max=maxSponsors;else
max=tot;return(max);},processNews:function(reqdata){var News=reqdata.category[0].items[0];var updtext=News.item[this.newsSlot[0]].content[0].Text;var updh1=News.item[this.newsSlot[0]].title;var newsDescript=News.item[this.newsSlot[0]].description[0].Text;var updh3=News.item[this.newsSlot[0]].date;if(newsDescript!=undefined)
updh3+=' - '+News.item[this.newsSlot[0]].description[0].Text;$('prime').update();var leadStory=new Element('div',{'class':"inner1"});leadStory.insert({bottom:new Element('h1').update(updh1)});leadStory.insert({bottom:new Element('h3').update(updh3)});leadStory.insert({bottom:new Element('span').update(updtext)});var allLink=new Element('p',{'class':'more'});allLink.insert({bottom:new Element('a',{'href':'javascript:handleMenu("News");'}).update('All News and Announcements')});leadStory.insert({bottom:allLink});Element.insert($('prime'),{'bottom':leadStory});$('lastUpdated').update(reqdata.lastupdated);if(News.item.length>=2)
{$('subnews').update();var Story2=new Element('div',{'class':'line_hor'});updh1=News.item[this.newsSlot[1]].title;updh3=News.item[this.newsSlot[1]].date+' - '+News.item[this.newsSlot[1]].description[0].Text;Story2.insert({bottom:new Element('img',{'class':'img_indent','src':News.item[this.newsSlot[1]].thumbnail})});Story2.insert({bottom:new Element('a',{'class':'link2','href':'javascript:handleMenu("show1");'}).update(updh1)});Story2.insert({bottom:new Element('p',{'class':'txt4'}).update(updh3)});Story2.insert({bottom:new Element('div',{'class':'clear'})});Element.insert($('subnews'),{'bottom':Story2});}
if(News.item.length>=3)
{var Story3=new Element('div',{'class':'line_hor'});updh1=News.item[this.newsSlot[2]].title;updh3=News.item[this.newsSlot[2]].date+' - '+News.item[this.newsSlot[2]].description[0].Text;Story3.insert({bottom:new Element('img',{'class':'img_indent','src':News.item[this.newsSlot[2]].thumbnail})});Story3.insert({bottom:new Element('a',{'class':'link2','href':'javascript:handleMenu("show2");'}).update(updh1)});Story3.insert({bottom:new Element('p',{'class':'txt4'}).update(updh3)});Story3.insert({bottom:new Element('div',{'class':'clear'})});Element.insert($('subnews'),{'bottom':Story3});}
if(News.item.length>=4)
{var TotLinks=News.item.length-3;if(TotLinks>10)
TotLinks=10;this.processNewsLinks(News,TotLinks);}
var newsStory=getQueryValue('n');if(newsStory)
this.showDynamic(newsStory);},processNewsLinks:function(News,TotLinks){var LinkURL;var LinkTitle;var LinkDescription;var linkList=new Element('ul',{'class':'list1 p4'});for(var x=3;x<TotLinks+3;x++)
{LinkDescription=News.item[x].description[0].Text;LinkTitle=News.item[x].title;LinkURL='javascript:handleMenu("show'+x+'");';this.insertNewsLink(linkList,LinkURL,LinkTitle,x);}
LinkDescription=News.item[0].description[0].Text;LinkTitle=News.item[0].title;LinkURL='javascript:handleMenu("show0");';this.insertNewsLink(linkList,LinkURL,LinkTitle,x);$('newslist').update();Element.insert($('newslist'),{'bottom':linkList});var moviesDiv=new Element('div',{'class':'line_hor'});var mclear=new Element('div',{'class':'clear'});var movies=new Element('h4').update('Videos and Movies');var moviesLink=new Element('a',{'class':'link2','href':'javascript:handleMenu("movies");'}).update('Team movies uploaded to YouTube&copy;');moviesDiv.insert({'bottom':clear});$('newslist').insert({'bottom':moviesDiv});$('newslist').insert({'bottom':movies});$('newslist').insert({'bottom':moviesLink});var cartoonDiv=new Element('div',{'class':'line_hor'});var clear=new Element('div',{'class':'clear'});var cartoon=new Element('h4').update('In The Bleachers');var cartoonLink=new Element('a',{'class':'link2','href':'javascript:handleMenu("toon");'}).update('Baseball Cartoon Humor');cartoonDiv.insert({'bottom':clear});$('newslist').insert({'bottom':cartoonDiv});$('newslist').insert({'bottom':cartoon});$('newslist').insert({'bottom':cartoonLink});var gamedayDiv=new Element('div',{'class':'line_hor'});var clear=new Element('div',{'class':'clear'});var gameday=new Element('h4').update('Game Day');var img=new Element('img',{'src':'/ig/images/common/iScore.png','alt':'ESPN iScore','height':'64px','width':'64px','align':'right'});var gamedayLink=new Element('a',{'class':'link2','href':'javascript:handleMenu("gameday");'}).update('Play by Play coverage on Game Day');gameday.insert({'bottom':img});gamedayDiv.insert({'bottom':clear});$('newslist').insert({'bottom':gamedayDiv});$('newslist').insert({'bottom':gameday});$('newslist').insert({'bottom':gamedayLink});$('newslist').insert({'bottom':gamedayDiv});},insertNewsLink:function(linkList,theLink,theText,idx)
{var bElement=new Element('span').update(theText);var emElement=new Element('em');var linkAnchor;var listItem=new Element('li');if(idx%2)
{linkAnchor=new Element('a',{'href':theLink});}
else
{linkAnchor=new Element('a',{'href':theLink,'class':'bgd'});}
emElement.insert({'bottom':bElement});linkAnchor.insert({'bottom':emElement});listItem.insert({'bottom':linkAnchor});linkList.insert({'bottom':listItem});},displayNewsItem:function(NewsItem,showschedulelink){var News=this.news.category[0].items[0];var updtext=News.item[NewsItem].content[0].Text;var updh1=News.item[NewsItem].title;var updh3=News.item[NewsItem].date+' - '+News.item[NewsItem].description[0].Text;this.preparePrime();var leadStory=new Element('div',{'class':'inner1'});leadStory.insert({bottom:new Element('h1').update(updh1)});leadStory.insert({bottom:new Element('h3').update(updh3)});leadStory.insert({bottom:new Element('span').update(updtext)});if(showschedulelink)
{if(this.gameName!=News.item[NewsItem].key)
{this.gameName=News.item[NewsItem].key;this.gameStats.length=0;}
leadStory.insert({bottom:new Element('div',{'id':'gameBoxScore','style':'display:none'})});leadStory.insert({bottom:new Element('div',{'class':'clear'})});leadStory.insert({bottom:new Element('a',{'href':'javascript:handleMenu("News");'}).update('All News and Announcements')});leadStory.insert({bottom:new Element('span').update(' | ')});leadStory.insert({bottom:new Element('a',{'href':'javascript:WebSite.showSchedule(WebSite.currentteam, WebSite.currentschedule);'}).update('Back to Schedule')});this.initGameStats();this.getGameStats();}
else
leadStory.insert({bottom:new Element('a',{'href':'javascript:handleMenu("News");'}).update('All News and Announcements')});Element.insert($('prime'),{'bottom':leadStory});$('prime').appear();},processNewsChange:function(obj){switch(this.currDisplay){case'Home':case'show0':case'show1':case'show2':this.changeOutNews();break;}},changeOutNews:function(){if(this.newsSlot[0]==0){this.newsSlot[0]=1;this.newsSlot[1]=2;this.newsSlot[2]=0;}
else if(this.newsSlot[0]==1){this.newsSlot[0]=2;this.newsSlot[1]=0;this.newsSlot[2]=1;}
else if(this.newsSlot[0]==2){this.newsSlot[0]=0;this.newsSlot[1]=1;this.newsSlot[2]=2;}
this.processNews(this.news);},processSponsors:function(){var x=0;var y=0;var GoodIdx=1;var totSponsors=this.getMaxSponsors();if(totSponsors==0)
return;var allSponsors=null;var idx=[];var premiumSponsors=[];var sponsors=null;var tmpIdx;var sponsorDiv=$('sponsors');sponsorDiv.hide();sponsorDiv.update();sponsors=this.sponsors.category[0].items[0];allSponsors=sponsors.item.length;for(var x=0;x<allSponsors;x++)
if(sponsors.item[x].level=='0')
premiumSponsors.push(x);if(premiumSponsors.length)
idx.push(premiumSponsors[this.getRandomNumber(premiumSponsors.length)]);while(1)
{tmpIdx=this.getRandomNumber(allSponsors);if(!this.sponsorExists(tmpIdx,idx))
idx.push(tmpIdx);if(idx.length==totSponsors)
break;}
if(totSponsors!=idx.length)
return;for(y=0;y<totSponsors;y++)
{this.insertSponsorLink(sponsorDiv,idx[y],1);}
this.insertSponsorLink(sponsorDiv,0,0);sponsorDiv.appear();},sponsorExists:function(idx,sponsorList){var exists=0;for(x=0;x<sponsorList.length;x++)
{if(sponsorList[x]==idx)
{exists=1;break;}}
return(exists);},insertSponsorLink:function(sponsorDiv,sponsorIndex,sw){var LinkURL='javascript:handleMenu("spons");';var sponsor=this.sponsors.category[0].items[0];var allSponsorAnchor=new Element('a',{'href':LinkURL,'title':'List All Sponsors'});var sponsorAnchor=new Element('a',{'href':sponsor.item[sponsorIndex].url,'target':'_blank'});var sponsorImage=new Element('img',{'alt':sponsor.item[sponsorIndex].title,'src':sponsor.item[sponsorIndex].img,'border':'no'});if(sw)
{sponsorAnchor.update(sponsorImage);Element.insert(sponsorDiv,sponsorAnchor);}
else
{Element.insert(sponsorDiv,new Element('br'));allSponsorAnchor.update('All Sponsors');Element.insert(sponsorDiv,allSponsorAnchor);}
Element.insert(sponsorDiv,new Element('br'));},showMovies:function(movieID){var movieURL='http://www.youtube.com/embed/';if(this.movies!=null){var moviesList=this.movies.category[0].items[0].item;if(moviesList.length>0){if(movieID==null)
movieURL+=moviesList[0].url;else
movieURL+=movieID;}
else
return(0);}
else{alert('No videos are configured at this time.');return(0);}
this.preparePrime();var moviesDiv=$('prime');var moviesFrame=new Element('iframe',{'src':movieURL,'width':moviesWidth,'height':moviesHeight,'frameborder':'0','allowfullscreen':'true'});moviesDiv.insert({'bottom':moviesFrame});moviesDiv.appear();var sm=$('moviesSlideMenu');if(sm!=null)
{sm.fade();this.showMoviesList();}
return(1);},showMoviesList:function(){var mapDir=$('mapdir');mapDir.update();mapDir.hide();this.updateLeftHeader(2);var moviesHeader=null;var moviesData=null;moviesData=this.movies.category[0].items[0].item;moviesHeader='YouTube Movies Selection';this.genMoviesDetail(mapDir,moviesHeader,moviesData);mapDir.show();jQuery("#moviesSlideMenu").dmxSlidingMenu({updateBackLabel:false});},genMoviesDetail:function(moviesDiv,header,data){var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+moviesListWidth+'px;'+moviesStyle});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var backButton=new Element('a',{'href':'#'}).update('Back');var moviesTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(header);var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'});var slideMenu=new Element('div',{'id':'moviesSlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':header});var moviesItem=new Element('li',{'title':header});var totItems=null;var footInfo=null;backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':moviesTitle});slideMenu.insert({'bottom':slideMenuTitle});totItems=this.genMoviesItems(slideMenuTitle,data);footInfo='Select from '+totItems+' videos.';footerDiv.insert({'bottom':footInfo});mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});moviesDiv.insert({'bottom':mainDiv});return;},genMoviesItems:function(slideMenu,data){var liClass=null;for(var x=0;x<data.length;x++)
{if(x==0)
liClass='dmxSlidingMenuItemFirst';else if(x==data.length-1)
liClass='dmxSlidingMenuItemLast';else
liClass=null;var title=data[x].title;var descript=data[x].description;var displayImage=docImages+'youtube16.png';var img=new Element('img',{'src':displayImage,'class':'dmxSlidingMenuItemImageLeft','border':'0','title':'Select YouTube Video'});var spanItemTitle=new Element('span',{'class':'dmxSlidingMenuItemTitle'}).update(title);var spanItemDesc=new Element('span',{'class':'dmxSlidingMenuItemDescription'}).update(descript);var videosItem=null;if(liClass==null)
videosItem=new Element('li',{'title':title});else
videosItem=new Element('li',{'title':title,'class':liClass});var anchorLink=new Element('a',{'href':'javascript:void(0);'});anchorLink.insert({'bottom':img});anchorLink.insert({'bottom':spanItemTitle});var contentPage=new Element('ul',{'title':title,'class':'dmxSlidingMenuContentPage'});var contentDetail=new Element('li',{'class':'dmxSlidingMenuItemContent'});this.genVideoContent(contentDetail,title,descript,data[x].url);contentPage.insert({'bottom':contentDetail});videosItem.insert({'bottom':anchorLink});videosItem.insert({'bottom':contentPage});slideMenu.insert({'bottom':videosItem});}
return(data.length);},genVideoContent:function(content,title,descript,url){var imgURL='http://i.ytimg.com/vi/'+url+'/default.jpg';var js="javascript:WebSite.showMovies('"+url+"');";var displayImage=docImages+'youtube.png';var videoTitle=new Element('span',{'class':'txt_score'}).update(title);var img=new Element('img',{'src':displayImage,'class':'dmxSlidingMenuItemImageRight','border':'0'});var ytimg=new Element('img',{'src':imgURL,'border':'0'});var link=new Element('input',{'type':'button','value':'View','class':'viewButton','title':'Select YouTube Video','onClick':js});var dv=new Element('div',{'class':'moviesListContent'});var p=new Element('p',{'class':'p1'}).update(descript);var adv=new Element('div',{'style':'text-align:center;margin-top:10px;'}).update(link);dv.insert({'bottom':img});dv.insert({'bottom':videoTitle});dv.insert({'bottom':p});dv.insert({'bottom':ytimg});content.insert({'bottom':dv});content.insert({'bottom':adv});},showRoster:function(Team){this.preparePrime();var rosterDiv=$('prime');var rosterHeader=null;var rosterData=null;this.currentteam=Team;rosterData=this.club[Team].rosterdata;rosterHeader=this.cfgClubs[Team].name+' Roster';this.genRosterNav(rosterDiv);this.genRosterDetail(rosterDiv,rosterHeader,rosterData,Team);$('prime').show();},genRosterNav:function(rosterDiv){var div=new Element('div',{'class':'rosterdiv'});for(var x=0;x<this.cfgClubs.length;x++)
{var rostLink="javascript:handleMenu('rost"+x+"')";var LinkRef=new Element('a',{'href':rostLink,'class':'rosternav'}).update(this.cfgClubs[x].name);div.insert({'bottom':LinkRef});if(x+1!=this.cfgClubs.length)
{var seperator=new Element('span').update(' | ');div.insert({'bottom':seperator});}}
rosterDiv.insert({'bottom':div});},genRosterDetail:function(rosterDiv,rosterHeader,rosterData,Team){var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+rosterWidth+'px;height:480px'});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var backButton=new Element('a',{'href':'#'}).update('Back');var rosterTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(rosterHeader);var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'});var slideMenu=new Element('div',{'id':'rosterSlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':rosterHeader});var rosterItem=new Element('li',{'title':rosterHeader});backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':rosterTitle});slideMenu.insert({'bottom':slideMenuTitle});this.genRosterItems(slideMenuTitle,rosterData,Team);mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});rosterDiv.insert({'bottom':mainDiv});},getPlayerYear:function(yr){var year=null;if(yr=='FR'||yr=='09'||yr=='13')
year='Freshman';else if(yr=='SO'||yr=='10'||yr=='14')
year='Sophmore';else if(yr=='JR'||yr=='11'||yr=='15')
year='Junior';else if(yr=='SR'||yr=='12'||yr=='16')
year='Senior';else if(yr=='08')
year='8th Grade';else if(yr=='07')
year='7th Grade';else if(yr=='06')
year='6th Grade';else if(yr=='05')
year='5th Grade';else if(yr=='04')
year='4th Grade';else if(yr=='03')
year='3rd Grade';else if(yr=='02')
year='2nd Grade';else if(yr=='01')
year='1st Grade';else year=yr;return(year);},genRosterItems:function(slideMenu,rosterData,Team){var liClass=null;var fName=null;for(var x=0;x<rosterData.length;x++)
{if(x==0)
liClass='dmxSlidingMenuItemFirst';else if(x==rosterData.length-1)
liClass='dmxSlidingMenuItemLast';else
liClass=null;var thisPlayer=rosterData[x];var year=this.getPlayerYear(thisPlayer.year);var number='#'+thisPlayer.number;if(this.cfgClubs[Team].maskRosterNames)
fName=thisPlayer.first.substring(0,1)+'.';else
fName=thisPlayer.first;var player=thisPlayer.first+' '+thisPlayer.last;var playerName=fName+' '+thisPlayer.last;var descript;if(sport=='Volleyball')
descript='Height: '+thisPlayer.height+' '+year;else
descript='Height: '+thisPlayer.height+' Weight: '+thisPlayer.weight+'lbs '+year;var displayImage='images/roster/'+this.currentSeason+'/'+thisPlayer.rostimg;var img=new Element('img',{'src':displayImage,'class':'dmxSlidingMenuItemImageLeft','border':'0'});var spanItemNumber=new Element('span',{'class':'txt_roster'}).update(number);var spanItemTitle=new Element('span',{'class':'txt_name'}).update(playerName);var spanItemDesc=new Element('span',{'class':'dmxSlidingMenuItemDescription'}).update(descript);var pStats=null;var ppStats=null;if(this.isLoggedIn())
{var playerStats=this.getPlayerStats(player,0);if(playerStats!=null&&playerStats!=999)
pStats=playerStats;var pitcherStats=this.getPlayerStats(player,1);if(playerStats!=null&&playerStats!=999)
ppStats=pitcherStats;}
var playerItem=null;if(liClass==null)
playerItem=new Element('li',{'title':playerName});else
playerItem=new Element('li',{'title':playerName,'class':liClass});var anchorLink=new Element('a',{'href':'javascript:void(0);'});anchorLink.insert({'bottom':img});anchorLink.insert({'bottom':spanItemNumber});anchorLink.insert({'bottom':spanItemTitle});anchorLink.insert({'bottom':spanItemDesc});var contentPage=new Element('ul',{'title':playerName,'class':'dmxSlidingMenuContentPage'});var contentDetail=new Element('li',{'class':'dmxSlidingMenuItemContent'});this.genRosterPersonalContent(contentDetail,thisPlayer,playerName,descript,pStats,ppStats,Team);contentPage.insert({'bottom':contentDetail});playerItem.insert({'bottom':anchorLink});playerItem.insert({'bottom':contentPage});slideMenu.insert({'bottom':playerItem});}},genRosterPersonalContent:function(content,thisPlayer,name,descript,stats,pitching,Team){var number='#'+thisPlayer.number;var thePlayer=number+' '+name;var playerName=new Element('span',{'class':'txt_roster'}).update(thePlayer);var displayImage='images/profile/'+this.currentSeason+'/'+thisPlayer.profimg;var img=new Element('img',{'src':displayImage,'class':'dmxSlidingMenuItemImageRight','border':'0'});content.insert({'bottom':playerName});content.insert({'bottom':img});var birthInfo=null;if(thisPlayer.dob.length)
{if(thisPlayer.dob.length==8)
{var mo=thisPlayer.dob.substring(4,6);var yr=thisPlayer.dob.substring(0,4);var dy=thisPlayer.dob.substring(6,8);var d=new Date(yr,mo-1,dy);if(!this.cfgClubs[Team].maskRosterDOB)
birthInfo='Born '+d.format('l, F jS Y')+' '+thisPlayer.hometown;else
{if(mo=='12'||mo=='01'||mo=='02')
birthInfo='Born in the Winter of '+yr+' in '+thisPlayer.hometown;else if(mo=='03'||mo=='04'||mo=='05')
birthInfo='Born in the Spring of '+yr+' in '+thisPlayer.hometown;else if(mo=='06'||mo=='07'||mo=='08')
birthInfo='Born in the Summer of '+yr+' in '+thisPlayer.hometown;else if(mo=='09'||mo=='10'||mo=='11')
birthInfo='Born in the Fall of '+yr+' in '+thisPlayer.hometown;}}
else
birthInfo=thisPlayer.dob;}
if(birthInfo!=null)
{var birthData=new Element('span',{'class':'txt4'}).update(birthInfo+' - '+descript);content.insert({'bottom':birthData});}
else
content.insert({'bottom':descript});if(thisPlayer.bats.length)
{var hand1Label='Bats: ';var hand2Label=' Throws: ';if(sport=='Volleyball')
{hand1Label='Serves: ';hand2Label=' Strikes: ';}
else if(sport=='Football')
{hand1Label='Throws: ';hand2Label=' Kicks: ';}
else if(sport=='Lacrosse')
{hand1Label='Stick: ';hand2Label=' Kicks: ';}
else if(sport=='Soccer')
{hand1Label='Kicks: ';hand2Label=' Dominate: ';}
var spanContain=new Element('span',{'class':'rItem'});var spanBatsLabel=new Element('span',{'class':'rLabel'}).update(hand1Label);var spanBatsData=new Element('span',{'class':'rData'}).update(thisPlayer.bats);var spanThrowsLabel=new Element('span',{'class':'rLabel'}).update(hand2Label);var spanThrowsData=new Element('span',{'class':'rData'}).update(thisPlayer.throws);spanContain.insert({'bottom':spanBatsLabel});spanContain.insert({'bottom':spanBatsData});spanContain.insert({'bottom':spanThrowsLabel});spanContain.insert({'bottom':spanThrowsData});content.insert({'bottom':spanContain});if(stats!=null)
content.insert({'bottom':stats});if(pitching!=null)
content.insert({'bottom':pitching});}
if(thisPlayer.middle.length)
this.genRostLine('Middle School: ',thisPlayer.middle,content);if(thisPlayer.awards.length)
this.genRostLine('Baseball Awards: ',thisPlayer.awards,content);if(thisPlayer.parents.length)
this.genRostLine('Parents or Guardians: ',thisPlayer.parents,content);if(thisPlayer.siblings.length)
this.genRostLine('Siblings: ',thisPlayer.siblings,content);if(thisPlayer.snack.length)
this.genRostLine('Favorite Midnight Snack: ',thisPlayer.snack,content);if(thisPlayer.movie.length)
this.genRostLine('Favorite Movie: ',thisPlayer.movie,content);if(thisPlayer.musician.length)
this.genRostLine('Favorite Musician/Band: ',thisPlayer.musician,content);if(thisPlayer.favteam.length)
this.genRostLine('Favorite Sports Team: ',thisPlayer.favteam,content);if(thisPlayer.ready.length)
this.genRostLine('How to get ready for a game: ',thisPlayer.ready,content);if(thisPlayer.goodat.length)
this.genRostLine(thisPlayer.first+' is good at: ',thisPlayer.goodat,content);if(thisPlayer.athletes.length)
this.genRostLine('Favorite Athlete: ',thisPlayer.athletes,content);if(thisPlayer.advice.length)
this.genRostLine(thisPlayer.first+'s advice to kids: ',thisPlayer.advice,content);if(thisPlayer.color.length)
this.genRostLine('Favorite Color: ',thisPlayer.color,content);if(thisPlayer.food.length)
this.genRostLine('Favorite Food: ',thisPlayer.food,content);if(thisPlayer.sport.length)
this.genRostLine('Favorite (other) Sport: ',thisPlayer.sport,content);if(thisPlayer.admire.length)
this.genRostLine('People '+thisPlayer.first+' admires most: ',thisPlayer.admire,content);if(thisPlayer.shoesize.length)
this.genRostLine('Shoe Size: ',thisPlayer.shoesize,content);if(thisPlayer.famous.length)
this.genRostLine(thisPlayer.first+' has met: ',thisPlayer.famous,content);if(thisPlayer.coach.length)
this.genRostLine('About our Coaches: ',thisPlayer.coach,content);if(thisPlayer.toughest.length)
this.genRostLine('Toughest Individual Opponent: ',thisPlayer.toughest,content);if(thisPlayer.aboutme.length)
this.genRostLine('What People Dont Know about '+thisPlayer.first,thisPlayer.aboutme,content);},genRostLine:function(label,data,content){var spanContain=new Element('span',{'class':'rItem'});var spanLabel=new Element('span',{'class':'rLabel'}).update(label);var spanData=new Element('span',{'class':'rData'}).update(data);spanContain.insert({'bottom':spanLabel});spanContain.insert({'bottom':spanData});content.insert({'bottom':spanContain});},showCheer:function(){if(this.cheer==null){alert("Sorry there are no Cheerleaders entered.");return;}
this.preparePrime();var cheerDiv=$('prime');var cheerHeader=null;cheerHeader=this.cheer.title;this.genCheerDetail(cheerDiv,cheerHeader);$('prime').show();jQuery("#cheerSlideMenu").dmxSlidingMenu({updateBackLabel:false});},genCheerDetail:function(cheerDiv,cheerHeader){var totItems=this.cheer.category[0].items[0].item.length;var cheerHeight=580;if(totItems<3)
cheerHeight=(totItems*100)+50;var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+cheerWidth+'px;height:'+cheerHeight+'px'});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var backButton=new Element('a',{'href':'#'}).update('Back');var cheerTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(cheerHeader);var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'});var slideMenu=new Element('div',{'id':'cheerSlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':cheerHeader});var cheerItem=new Element('li',{'title':cheerHeader});backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':cheerTitle});slideMenu.insert({'bottom':slideMenuTitle});this.genCheerItems(slideMenuTitle);mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});cheerDiv.insert({'bottom':mainDiv});},genCheerItems:function(slideMenu){var cheerData=this.cheer.category[0].items[0].item;var liClass=null;for(var x=0;x<cheerData.length;x++)
{if(x==0)
liClass='dmxSlidingMenuItemFirst';else if(x==cheerData.length-1)
liClass='dmxSlidingMenuItemLast';else
liClass=null;var thisCheer=cheerData[x];var descript=thisCheer.description[0].Text;var img=new Element('img',{'src':thisCheer.thumbnail,'class':'dmxSlidingMenuItemImageLeft','border':'0'});var spanItemTitle=new Element('span',{'class':'txt_name'}).update(thisCheer.title);var spanItemDesc=new Element('span',{'class':'dmxSlidingMenuItemDescription'}).update(descript);var cheerItem=null;if(liClass==null)
cheerItem=new Element('li',{'title':thisCheer.title});else
cheerItem=new Element('li',{'title':thisCheer.title,'class':liClass});var anchorLink=new Element('a',{'href':'javascript:void(0);'});anchorLink.insert({'bottom':img});anchorLink.insert({'bottom':spanItemTitle});anchorLink.insert({'bottom':spanItemDesc});var limg=new Element('img',{'src':thisCheer.img,'align':'right'});var sd=new Element('div');var cheerContent=new Element('span').update(thisCheer.content[0].Text);var contentPage=new Element('ul',{'title':thisCheer.title,'class':'dmxSlidingMenuContentPage'});var contentDetail=new Element('li',{'class':'dmxSlidingMenuItemContent'});sd.insert({'bottom':limg});sd.insert({'bottom':cheerContent});contentDetail.insert({'bottom':sd});contentPage.insert({'bottom':contentDetail});cheerItem.insert({'bottom':anchorLink});cheerItem.insert({'bottom':contentPage});slideMenu.insert({'bottom':cheerItem});}},showStore:function(){if(this.store==null){alert("Sorry there are no items in this store.");return;}
this.preparePrime();var storeDiv=$('prime');var storeHeader=null;storeHeader=this.store.title;this.genStoreDetail(storeDiv,storeHeader);$('prime').show();jQuery("#storeSlideMenu").dmxSlidingMenu({updateBackLabel:false});},genStoreDetail:function(storeDiv,storeHeader){var totItems=this.store.category[0].items[0].item.length;var storeHeight=580;if(totItems<3)
storeHeight=(totItems*100)+50;var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+storeWidth+'px;height:'+storeHeight+'px'});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var backButton=new Element('a',{'href':'#'}).update('Back');var storeTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(storeHeader);var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'});var slideMenu=new Element('div',{'id':'storeSlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':storeHeader});var storeItem=new Element('li',{'title':storeHeader});backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':storeTitle});slideMenu.insert({'bottom':slideMenuTitle});this.genStoreItems(slideMenuTitle);mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});storeDiv.insert({'bottom':mainDiv});},genStoreItems:function(slideMenu){var storeData=this.store.category[0].items[0].item;var liClass=null;for(var x=0;x<storeData.length;x++)
{if(x==0)
liClass='dmxSlidingMenuItemFirst';else if(x==storeData.length-1)
liClass='dmxSlidingMenuItemLast';else
liClass=null;var thisStore=storeData[x];var descript=thisStore.description[0].Text;var img=new Element('img',{'src':thisStore.thumbnail,'class':'dmxSlidingMenuItemImageLeft','border':'0'});var spanItemTitle=new Element('span',{'class':'txt_name'}).update(thisStore.title);var spanItemDesc=new Element('span',{'class':'dmxSlidingMenuItemDescription'}).update(descript);var storeItem=null;if(liClass==null)
storeItem=new Element('li',{'title':thisStore.title});else
storeItem=new Element('li',{'title':thisStore.title,'class':liClass});var anchorLink=new Element('a',{'href':'javascript:void(0);'});anchorLink.insert({'bottom':img});anchorLink.insert({'bottom':spanItemTitle});anchorLink.insert({'bottom':spanItemDesc});var limg=new Element('img',{'src':thisStore.img,'title':'Link to '+thisStore.title+' web site','align':'right'});var logo=new Element('a',{'href':thisStore.url,'target':'_blank'}).update(limg);var sd=new Element('div');var storeContent=new Element('span').update(thisStore.content[0].Text);var contentPage=new Element('ul',{'title':thisStore.title,'class':'dmxSlidingMenuContentPage'});var contentDetail=new Element('li',{'class':'dmxSlidingMenuItemContent'});sd.insert({'bottom':logo});sd.insert({'bottom':storeContent});contentDetail.insert({'bottom':sd});contentPage.insert({'bottom':contentDetail});storeItem.insert({'bottom':anchorLink});storeItem.insert({'bottom':contentPage});slideMenu.insert({'bottom':storeItem});}},showSponsors:function(){if(this.sponsors==null){alert("Sorry there are no sponsors found");return;}
this.preparePrime();var sponsorDiv=$('prime');var sponsorHeader=null;sponsorHeader=this.sponsors.title;this.genSponsorDetail(sponsorDiv,sponsorHeader);$('prime').show();jQuery("#sponsorSlideMenu").dmxSlidingMenu({updateBackLabel:false});},genSponsorDetail:function(sponsorDiv,sponsorHeader){var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+rosterWidth+'px;height:580px'});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var backButton=new Element('a',{'href':'#'}).update('Back');var sponsorTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(sponsorHeader);var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'});var slideMenu=new Element('div',{'id':'sponsorSlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':sponsorHeader});var sponsorItem=new Element('li',{'title':sponsorHeader});backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':sponsorTitle});slideMenu.insert({'bottom':slideMenuTitle});this.genSponsorItems(slideMenuTitle);mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});sponsorDiv.insert({'bottom':mainDiv});},genSponsorItems:function(slideMenu){var sponsorData=this.sponsors.category[0].items[0].item;var liClass=null;for(var x=0;x<sponsorData.length;x++)
{if(x==0)
liClass='dmxSlidingMenuItemFirst';else if(x==sponsorData.length-1)
liClass='dmxSlidingMenuItemLast';else
liClass=null;var thisSponsor=sponsorData[x];var descript=thisSponsor.description[0].Text+' '+thisSponsor.phone;var img=new Element('img',{'src':thisSponsor.thumbnail,'class':'dmxSlidingMenuItemImageLeft','border':'0'});var spanItemTitle=new Element('span',{'class':'txt_name'}).update(thisSponsor.title);var spanItemDesc=new Element('span',{'class':'dmxSlidingMenuItemDescription'}).update(descript);var sponsorItem=null;if(liClass==null)
sponsorItem=new Element('li',{'title':thisSponsor.title});else
sponsorItem=new Element('li',{'title':thisSponsor.title,'class':liClass});var anchorLink=new Element('a',{'href':'javascript:void(0);'});anchorLink.insert({'bottom':img});anchorLink.insert({'bottom':spanItemTitle});anchorLink.insert({'bottom':spanItemDesc});var limg=new Element('img',{'src':thisSponsor.img,'title':'Link to '+thisSponsor.title+' web site','align':'right'});var logo=new Element('a',{'href':thisSponsor.url,'target':'_blank'}).update(limg);var sd=new Element('div');var sponsorContent=new Element('span').update(thisSponsor.content[0].Text);var contentPage=new Element('ul',{'title':thisSponsor.title,'class':'dmxSlidingMenuContentPage'});var contentDetail=new Element('li',{'class':'dmxSlidingMenuItemContent'});sd.insert({'bottom':logo});sd.insert({'bottom':sponsorContent});contentDetail.insert({'bottom':sd});contentPage.insert({'bottom':contentDetail});sponsorItem.insert({'bottom':anchorLink});sponsorItem.insert({'bottom':contentPage});slideMenu.insert({'bottom':sponsorItem});}},showAdminPage:function(email,session){url=adminURL+'?t='+adminTeam+'&email='+email+'&sess='+session;window.open(url,'adminwindow','width=990,height=800,scrollbars=yes');},showAdminPopup:function(email,session){url=adminURL+'?t='+adminTeam+'&email='+email+'&sess='+session;dmxAdvLayerPopup('Administrator',url,'Admin','','iPod','center','center',1020,790,0,true,true,true,40,'','Linear',.5,true,'','Linear',.5,true,'',1,5,true,true,'#000000');return document.MM_returnValue;},showAboutPopup:function(){dmxAdvLayerPopup('About','/walch/index.html','Admin','','iPod','center','center',366,436,0,true,true,true,40,'','Linear',1,true,'','Linear',1,true,'',1,5,true,true,'');return document.MM_returnValue;},verifyUser:function(type){var email=document.teamball.email.value;var sess=document.teamball.sess.value;var level=document.teamball.level.value;if(email&&sess&&level)
{this.transFull(0);this.genLogoff();this.buildNav(1);if(type=='Admin')
{if(level=='2'){this.displayNewsItem(this.newsSlot[0],0);this.launchAdmin(email,sess);}
else{this.displayNewsItem(this.newsSlot[0],0);alert("You do not have sufficient user privalages for site administration");}}
else if(type=='Stats')
this.showTeamStats('0');else if(type=='Login'){this.buildNav(1);this.displayNewsItem(this.newsSlot[0],0);return;}}
else
{if(type=='Stats')
var loginType='WebSite.loginStats();';else if(type=='Admin')
var loginType='WebSite.loginAdmin();';else
var loginType='WebSite.loginApp();';var loginDiv=$('prime');var loginForm=new Element('div',{'class':'inner1'});var containDiv=new Element('div',{'id':'formcontainer'});var fieldSet=new Element('fieldset');var setLegend=new Element('legend').update('Login details');var theForm=new Element('form',{'action':'#'});var divUser=new Element('div',{'class':'div_texbox'});var divPass=new Element('div',{'class':'div_texbox'});var divButt=new Element('div',{'class':'button_div'});var divClear=new Element('div',{'class':'clear'});var emLabel=new Element('label',{'id':'loginLabel','for':'username'}).update('Email');var psLabel=new Element('label',{'id':'loginLabel','for':'password'}).update('Password');var em=new Element('input',{'class':'username','id':'username','name':'username','type':'text','maxlength':'50','value':email});var ps=new Element('input',{'class':'password','id':'password','name':'password','type':'password','maxlength':'20','onkeydown':'if (event.keyCode == 13) { '+loginType+'return false; }'});var bt=new Element('input',{'name':'submit','type':'button','value':'Login','class':'buttons','onclick':loginType});this.preparePrime();divUser.insert({bottom:em});divPass.insert({bottom:ps});divButt.insert({bottom:bt});theForm.insert({bottom:emLabel});theForm.insert({bottom:divUser});theForm.insert({bottom:psLabel});theForm.insert({bottom:divPass});theForm.insert({bottom:divButt});fieldSet.insert({bottom:setLegend});fieldSet.insert({bottom:theForm});fieldSet.insert({bottom:divClear});containDiv.insert({bottom:fieldSet});loginForm.insert({bottom:new Element('h1').update('Login')});loginForm.insert({bottom:new Element('h3').update('Enter your Email Address and password.')});loginForm.insert({bottom:containDiv});loginDiv.insert({bottom:loginForm});loginDiv.appear();}},loginAdmin:function(){var email=$F('username');var sess=$F('password');if(email&&sess)
{var req=genjson+'?e='+email+'&n='+sess+'&t='+this.cfgClubs[0].key;var aj_login=new Ajax.Request(req,{method:'get',onSuccess:this.loginResponseAdmin.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});}
else
alert("Email and Password are required fields, please re-enter");},loginResponseAdmin:function(oReq){var loginResponse=oReq.responseJSON;if(loginResponse.rc=='2')
{var email=$F('username');var sess=$F('password');document.teamball.email.value=loginResponse.email;document.teamball.sess.value=loginResponse.sess;document.teamball.level.value=loginResponse.rc;this.verifyUser('Admin');}
else if(loginResponse.rc=='1')
alert("You do not have sufficient user privalages for site administration");else
alert(loginResponse.message+' Please double-check your entry and try again.');},loginStats:function(){var email=$F('username');var sess=$F('password');if(email&&sess)
{var req=genjson+'?e='+email+'&n='+sess+'&t='+this.cfgClubs[0].key;var aj_login=new Ajax.Request(req,{method:'get',onSuccess:this.loginResponseStats.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});}
else
alert("Email and Password are required fields, please re-enter");},loginResponseStats:function(oReq){var loginResponse=oReq.responseJSON;if(loginResponse.rc=='2'||loginResponse.rc=='1')
{var email=$F('username');var sess=$F('password');document.teamball.email.value=loginResponse.email;document.teamball.sess.value=loginResponse.sess;document.teamball.level.value=loginResponse.rc;this.verifyUser('Stats');}
else
alert(loginResponse.message+' Please double-check your entry and try again.');},loginApp:function(){var email=$F('username');var sess=$F('password');if(email&&sess)
{var req=genjson+'?e='+email+'&n='+sess+'&t='+this.cfgClubs[0].key;var aj_login=new Ajax.Request(req,{method:'get',onSuccess:this.loginResponseApp.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});}
else
alert("Email and Password are required fields, please re-enter");},loginResponseApp:function(oReq){var loginResponse=oReq.responseJSON;if(loginResponse.rc=='2'||loginResponse.rc=='1')
{var email=$F('username');var sess=$F('password');document.teamball.email.value=loginResponse.email;document.teamball.sess.value=loginResponse.sess;document.teamball.level.value=loginResponse.rc;this.verifyUser('Login');}
else
alert(loginResponse.message+' Please double-check your entry and try again.');},launchAdmin:function(email,session){var isiPad=navigator.userAgent.match(/iPad/i)!=null;if(isiPad)
WebSite.showAdminPage(email,session);else
WebSite.showAdminPopup(email,session);},showTeamStats:function(theTeam){this.currentStatsTeam=theTeam;this.GenSeasonStats(theTeam);},genStatsTeamNav:function(statsDiv){var div=new Element('div',{'id':'statsnav'});for(var x=0;x<this.cfgClubs.length;x++)
{var statLink="javascript:WebSite.showTeamStats('"+x+"')";var LinkRef=new Element('a',{'href':statLink,'class':'statsnav'}).update(this.cfgClubs[x].name);div.insert({'bottom':LinkRef});if(x+1!=this.cfgClubs.length)
{var seperator=new Element('span').update(' | ');div.insert({'bottom':seperator});}}
statsDiv.insert({'bottom':div});},GenSeasonStats:function(team){this.preparePrime();var statsDiv=$('prime');this.genStatsTeamNav(statsDiv);var statsSize='width:'+statsWidth+'px;height:'+statsHeight+'px';var mainDiv=new Element('div',{'class':'dmxSlidingPanels '+sms,'style':statsSize});var headerDiv=new Element('div',{'class':'dmxSlidingPanelsHeader'});var slidePanel=new Element('div',{'id':'staffSlidePanel','class':'dmxSlidingPanelView'});var footerDiv=new Element('div',{'class':'dmxSlidingPanelsFooter'});var prevButton=new Element('a',{'href':'#'}).update('Prev');var nextButton=new Element('a',{'href':'#'}).update('Next');var prevButtonDiv=new Element('div',{'class':'dmxSlidingPanelsPrev'}).update(prevButton);var nextButtonDiv=new Element('div',{'class':'dmxSlidingPanelsNext'}).update(nextButton);var statsTitle=new Element('div',{'class':'dmxSlidingPanelsTitle'}).update(this.cfgClubs[this.currentStatsTeam].name+' Team Stats');var statsNavDiv=new Element('div',{'class':'dmxSlidingPanelsNav'});this.genStatsNav(statsNavDiv,this.stats);this.genStatsContent(slidePanel,team);headerDiv.insert({'bottom':prevButtonDiv});headerDiv.insert({'bottom':nextButtonDiv});headerDiv.insert({'bottom':statsTitle});headerDiv.insert({'bottom':statsNavDiv});mainDiv.insert({'bottom':headerDiv});mainDiv.insert({'bottom':slidePanel});mainDiv.insert({'bottom':footerDiv});statsDiv.insert({'bottom':mainDiv});$('prime').show();jQuery("#staffSlidePanel").dmxSlidingPanels({});},genStatsNav:function(nav,Stats){var ul=new Element('ul');for(var x=0;x<3;x++)
{var Title=this.getStatsTitle(x);var li=new Element('li');var a=new Element('a',{'href':'#'}).update(Title);li.insert({'bottom':a});ul.insert({'bottom':li});}
nav.insert({'bottom':ul});},genStatsContent:function(content,team){for(var x=0;x<3;x++)
{var page=new Element('div',{'id':'page'+x+1,'class':'dmxSlidingPanelsPage'});var ul=new Element('ul',{'class':'galleries'});var Table=this.genStatsTable(x,0,team);ul.insert({bottom:Table});page.insert({'bottom':ul});content.insert({'bottom':page});}},getStatsTitle:function(index){var Title=null;if(index==0)
Title="Batting";else if(index==1)
Title="Pitching";else if(index==2)
Title="Defense";return(Title);},initGameStats:function(){this.gameStats.length=0;},genStatsTable:function(type,game,team){var Table=null;var Stats=null;var firstCol=' ';var theStyle=null;if(!game)
{if(tableStyle=='one-column-emphasis')
firstCol='oce-first';theStyle=tableStyle;}
else
{theStyle=boxStyle;firstCol='bs-first';}
var col=new Element('col',{'class':firstCol});var colgroup=new Element('colgroup');colgroup.insert({bottom:col});var thead=new Element('thead');this.genTableHead(thead,type,game);var tbody=new Element('tbody');this.genTableBody(tbody,type,game,team);Table=new Element('table',{'id':theStyle,'summary':'stats'});Table.insert({bottom:colgroup});Table.insert({bottom:thead});Table.insert({bottom:tbody});return(Table);},genStatsExtras:function(type,game){var divExtras=null;var Stats=null;divExtras=new Element('div',{'id':'boxExtra'});var defaultCols=colDefaults.type[type].cols;var totCols=defaultCols.size();for(var x=0;x<totCols;x++)
{if(defaultCols[x].box=='2')
{var ex=this.getExtras(defaultCols[x].desc,defaultCols[x].col,type,game);if(ex)
divExtras.insert({bottom:ex});}}
return(divExtras);},getExtras:function(desc,col,type,game){var exHead=new Element('span',{'class':'exHead'}).update(' '+desc+': ');var ex=new Element('span').update(exHead);var data=this.getStatsData(type,game,0);var totPlayers=data.size();var f=null;for(var c=0;c<totPlayers;c++)
{var totCols=data[c].player.size();for(var x=0;x<totCols;x++)
{if(col==data[c].player[x].c)
{if(data[c].player[x].v!='0'&&data[c].player[1].v!='TOTALS')
{f=1;if(data[c].player[x].v>1)
ex.insert({bottom:' '+data[c].player[1].v+'('+data[c].player[x].v+')'});else
ex.insert({bottom:' '+data[c].player[1].v});}}}}
if(f)
return(ex);else
return(null);},genTableHead:function(thead,type,game){var defaultCols=colDefaults.type[type].cols;var totCols=defaultCols.size();var tr=new Element('tr');for(var x=0;x<totCols;x++)
{if(!game)
{if(defaultCols[x].show=='1')
{var th=new Element('th',{'scope':'col'}).update(defaultCols[x].col);tr.insert({bottom:th});}}
else
{if(defaultCols[x].box=='1')
{if(type=='1'&&x==1)
var th=new Element('th',{'scope':'col'}).update('Pitcher');else
var th=new Element('th',{'scope':'col'}).update(defaultCols[x].col);tr.insert({bottom:th});}}}
thead.insert({bottom:tr});},genTableBody:function(tbody,type,game,team){var data=this.getStatsData(type,game,team);if(data==null)
return;var totPlayers=data.size();for(var c=0;c<totPlayers;c++)
{var totCols=data[c].player.size();var tr=new Element('tr');for(var x=0;x<totCols;x++)
{if(this.colIncluded(data[c].player[x].c,type,game)=='1')
{var V=this.trimLZ(data[c].player[x].v);var td=new Element('td').update(V);tr.insert({bottom:td});}}
tbody.insert({bottom:tr});}},colIncluded:function(col,type,game){var rc='0';var defaultCols=colDefaults.type[type].cols;var totCols=defaultCols.size();for(var x=0;x<totCols;x++)
{if(defaultCols[x].col==col)
{if(game==0)
rc=defaultCols[x].show;else if(game==3)
rc=defaultCols[x].ros;else
rc=defaultCols[x].box;break;}};return(rc);},getDesc:function(col,type,game){var rc='0';var defaultCols=colDefaults.type[type].cols;var totCols=defaultCols.size();for(var x=0;x<totCols;x++)
{if(defaultCols[x].col==col)
{rc=defaultCols[x].desc;break;}};return(rc);},getStatsData:function(type,game,team){var retData=null;if(!game){if(this.stats[team].rc==null){if(type==0)
retData=this.stats[team].offense[0].team;else if(type==1)
retData=this.stats[team].pitching[0].team;else if(type==2)
retData=this.stats[team].fielding[0].team;}}
else
{if(game==1&&type==0)
retData=this.gameStats[0];else if(game==1&&type==1)
retData=this.gameStats[1];else if(game==2&&type==0)
retData=this.gameStats[2];else if(game==2&&type==1)
retData=this.gameStats[3];}
return(retData);},getGameStats:function(){var statsFile=null;var recCount=this.gameStats.length;if(sport=="Baseball"){if(recCount==0)
statsFile=this.gameName+'_statsVisitorBatting.json';else if(recCount==1)
statsFile=this.gameName+'_statsVisitorPitching.json';else if(recCount==2)
statsFile=this.gameName+'_statsHomeBatting.json';else if(recCount==3)
statsFile=this.gameName+'_statsHomePitching.json';else if(recCount==4)
{this.GenGameStats();return;}}
else
return;var req=genjson+'?x=1&f='+statsFile+'&season='+this.currentSeason+'&t='+this.cfgClubs[0].key;var aj_stats=new Ajax.Request(req,{method:'get',onSuccess:this.getGameStatsAjaxData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},getGameStatsAjaxData:function(oReq){var statsResponse=oReq.responseJSON;this.gameStats.push(statsResponse.team);this.gameStatsLoaded=this.gameStats.length;this.getGameStats();},GenGameStats:function(){var boxDiv=$('gameBoxScore');var containDiv=new Element('div',{'id':'box','class':'boxContain'});var awayDiv=new Element('div',{'id':'awayBox','class':'leftBox'});var homeDiv=new Element('div',{'id':'homeBox','class':'rightBox'});var abTable=this.genStatsTable(0,1,null);var apTable=this.genStatsTable(1,1,null);var hbTable=this.genStatsTable(0,2,null);var hpTable=this.genStatsTable(1,2,null);var abExtra=this.genStatsExtras(0,1);var apExtra=this.genStatsExtras(1,1);var hbExtra=this.genStatsExtras(0,2);var hpExtra=this.genStatsExtras(1,2);awayDiv.insert({bottom:abTable});awayDiv.insert({bottom:abExtra});awayDiv.insert({bottom:apTable});awayDiv.insert({bottom:apExtra});homeDiv.insert({bottom:hbTable});homeDiv.insert({bottom:hbExtra});homeDiv.insert({bottom:hpTable});homeDiv.insert({bottom:hpExtra});containDiv.insert({bottom:awayDiv});containDiv.insert({bottom:homeDiv});boxDiv.insert({bottom:containDiv});boxDiv.appear();return;},getPlayerStats:function(player,type){var data=this.getStatsData(type,0,0);if(data==null)
return(null);var c=this.getPlayerOffset(data,player);if(c==999)
return(null);var sContain=new Element('div',{'id':'rs_stats_cont'});var title=this.getStatsTitle(type);var sTitle=new Element('p',{'id':'rs_title'}).update(title);sContain.insert({bottom:sTitle});var totCols=data[c].player.size();for(var x=0;x<totCols;x++)
{if(this.colIncluded(data[c].player[x].c,type,3)=='1')
{var descText=this.getDesc(data[c].player[x].c,type,3);if(descText=='0')
descText=data[c].player[x].c;var sDiv=new Element('div',{'id':'rs_stats'});var sDesc=new Element('div',{'class':'rs_txt_desc'}).update(descText);var Value=this.trimLZ(data[c].player[x].v);var sVal=new Element('div',{'class':'rs_txt_val'}).update(Value);sDiv.insert({bottom:sDesc});sDiv.insert({bottom:sVal});sContain.insert({bottom:sDiv});}}
return(sContain);},getPlayerOffset:function(data,player)
{var totPlayers=data.size();for(var c=0;c<totPlayers;c++)
{if(data[c].player[1].v==player)
return c;}
return 999;},genGameCardsTeamNav:function(cardsDiv){var div=new Element('div',{'id':'cardsnav'});for(var x=0;x<this.cfgClubs.length;x++)
{var statLink="javascript:WebSite.showGameCardsList('"+x+"')";var LinkRef=new Element('a',{'href':statLink,'class':'cardsnav'}).update(this.cfgClubs[x].name);div.insert({'bottom':LinkRef});if(x+1!=this.cfgClubs.length)
{var seperator=new Element('span').update(' | ');div.insert({'bottom':seperator});}}
cardsDiv.insert({'bottom':div});},showGameCardsList:function(team){this.preparePrime();var gcardsDiv=$('prime');this.genGameCardsTeamNav(gcardsDiv);var gcardsHeader=null;var gcardsData=null;gcardsData=this.gamecards[team];gcardsHeader='Game Card Selection';this.genGameCardsDetail(gcardsDiv,gcardsHeader,gcardsData,team);gcardsDiv.show();jQuery("#gameCardsSlideMenu").dmxSlidingMenu({updateBackLabel:false});},genGameCardsDetail:function(cardsDiv,header,data,team){var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+cardsWidth+'px;height:370px'});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var backButton=new Element('a',{'href':'#'}).update('Back');var cardsTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(header);var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'});var slideMenu=new Element('div',{'id':'gameCardsSlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':header});var cardsItem=new Element('li',{'title':header});var totItems=null;var footInfo=null;backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':cardsTitle});slideMenu.insert({'bottom':slideMenuTitle});totItems=this.genGameCardsItems(slideMenuTitle,data,team);if(totItems)
footInfo='Select card from '+totItems+' games.';else
footInfo='No game cards have been uploaded for this team.';footerDiv.insert({'bottom':footInfo});mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});cardsDiv.insert({'bottom':mainDiv});return;},genGameCardsItems:function(slideMenu,data,team){var count=null;if(data.rc!=null)
count=0;else
count=data.length;var liClass=null;for(var x=0;x<count;x++)
{if(x==0)
liClass='dmxSlidingMenuItemFirst';else if(x==data.length-1)
liClass='dmxSlidingMenuItemLast';else
liClass=null;var selGame=this.getCardGame(team,data[x].game);if(selGame!=null){var title=selGame.name;var displayImage='/ig/images/filetypes/file_extension_pdf.png';var descript=this.getGameCardDesc(team,selGame,data[x]);var img=new Element('img',{'src':displayImage,'class':'dmxSlidingMenuItemImageLeft','border':'0','title':title,'style':'width:35px;height:35px;'});var spanItemTitle=new Element('span',{'class':'dmxSlidingMenuItemTitle'}).update(title);var spanItemDesc=new Element('span',{'class':'dmxSlidingMenuItemDescription'}).update(descript);var js="javascript:WebSite.showPDF('"+data[x].game+"','"+team+"');";var link=new Element('input',{'type':'button','value':'View','class':'viewButton','title':'Show PDF Scorecard for '+title,'onClick':js});var adv=new Element('div',{'style':'float:right;margin-top:-13px;'}).update(link);var cardsItem=null;if(liClass==null)
cardsItem=new Element('li',{'title':title});else
cardsItem=new Element('li',{'title':title,'class':liClass});var anchorLink=new Element('a',{'href':'javascript:void(0);'});anchorLink.insert({'bottom':img});anchorLink.insert({'bottom':spanItemTitle});spanItemDesc.insert({'bottom':adv});anchorLink.insert({'bottom':spanItemDesc});cardsItem.insert({'bottom':anchorLink});slideMenu.insert({'bottom':cardsItem});}}
return(count);},getCardGame:function(team,card){var theGames=this.club[team].games;var returnGame=null;var idx=0;for(idx=0;idx<theGames.length;idx++){var recap=theGames[idx].recap;var key=recap.substring(0,recap.length-6);var compare=this.cfgClubs[team].key+key+'_gamecard.pdf';if(compare==card){returnGame=theGames[idx];break;}}
return(returnGame);},getGameCardDesc:function(team,selGame,pdata){var returnDesc='';var WL=null;if(selGame.result=='L')
WL=' - Loss ('+selGame.score+') ';else if(selGame.result=='T')
WL=' - Tied ('+selGame.score+') ';else
WL=' - Win ('+selGame.score+') ';returnDesc=selGame.date+' @ '+selGame.time+WL+pdata.size+' bytes';return(returnDesc);},genCardsTeamNav:function(cardsDiv){var div=new Element('div',{'id':'cardsnav'});for(var x=0;x<this.cfgClubs.length;x++)
{var statLink="javascript:WebSite.showCardsList('"+x+"')";var LinkRef=new Element('a',{'href':statLink,'class':'cardsnav'}).update(this.cfgClubs[x].name);div.insert({'bottom':LinkRef});if(x+1!=this.cfgClubs.length)
{var seperator=new Element('span').update(' | ');div.insert({'bottom':seperator});}}
cardsDiv.insert({'bottom':div});},showCardsList:function(team){this.preparePrime();var cardsDiv=$('prime');this.genCardsTeamNav(cardsDiv);var cardsHeader=null;var cardsData=null;cardsData=this.cards[team];cardsHeader='Player Card Selection';this.genCardsDetail(cardsDiv,cardsHeader,cardsData,team);cardsDiv.show();jQuery("#cardsSlideMenu").dmxSlidingMenu({updateBackLabel:false});},genCardsDetail:function(cardsDiv,header,data,team){var mainDiv=new Element('div',{'class':'dmxSlidingMenu '+sms,'style':'width:'+cardsWidth+'px;height:370px'});var headerDiv=new Element('div',{'class':'dmxSlidingMenuHeader'});var backButtonDiv=new Element('div',{'class':'dmxSlidingMenuBack'});var backButton=new Element('a',{'href':'#'}).update('Back');var cardsTitle=new Element('div',{'class':'dmxSlidingMenuTitle'}).update(header);var footerDiv=new Element('div',{'class':'dmxSlidingMenuFooter'});var slideMenu=new Element('div',{'id':'cardsSlideMenu','class':'dmxSlidingMenuView'});var slideMenuTitle=new Element('ul',{'title':header});var cardsItem=new Element('li',{'title':header});var totItems=null;var footInfo=null;backButtonDiv.insert({'bottom':backButton});headerDiv.insert({'bottom':backButtonDiv});headerDiv.insert({'bottom':cardsTitle});slideMenu.insert({'bottom':slideMenuTitle});totItems=this.genCardsItems(slideMenuTitle,data,team);if(totItems)
footInfo='Select card from '+totItems+' players.';else
footInfo='No player cards have been uploaded for this team.';footerDiv.insert({'bottom':footInfo});mainDiv.insert({'bottom':headerDiv});slideMenu.insert({'bottom':slideMenuTitle});mainDiv.insert({'bottom':slideMenu});mainDiv.insert({'bottom':footerDiv});cardsDiv.insert({'bottom':mainDiv});return;},genCardsItems:function(slideMenu,data,team){var count=null;if(data.rc!=null)
count=0;else
count=data.length;var liClass=null;for(var x=0;x<count;x++)
{if(x==0)
liClass='dmxSlidingMenuItemFirst';else if(x==data.length-1)
liClass='dmxSlidingMenuItemLast';else
liClass=null;var selPlayer=this.getCardPlayer(team,data[x].player);if(selPlayer!=null){var title=selPlayer.first+" "+selPlayer.last;var displayImage='images/roster/'+this.currentSeason+'/'+selPlayer.rostimg;var descript=this.getCardPlayerDesc(team,selPlayer,data[x]);var img=new Element('img',{'src':displayImage,'class':'dmxSlidingMenuItemImageLeft','border':'0','title':title,'style':'width:35px;height:35px;'});var spanItemTitle=new Element('span',{'class':'dmxSlidingMenuItemTitle'}).update(title);var spanItemDesc=new Element('span',{'class':'dmxSlidingMenuItemDescription'}).update(descript);var js="javascript:WebSite.showPDF('"+data[x].player+"','"+team+"');";var link=new Element('input',{'type':'button','value':'View','class':'viewButton','title':'Show PDF Stats for '+title,'onClick':js});var adv=new Element('div',{'style':'float:right;margin-top:-13px;'}).update(link);var cardsItem=null;if(liClass==null)
cardsItem=new Element('li',{'title':title});else
cardsItem=new Element('li',{'title':title,'class':liClass});var anchorLink=new Element('a',{'href':'javascript:void(0);'});anchorLink.insert({'bottom':img});anchorLink.insert({'bottom':spanItemTitle});spanItemDesc.insert({'bottom':adv});anchorLink.insert({'bottom':spanItemDesc});cardsItem.insert({'bottom':anchorLink});slideMenu.insert({'bottom':cardsItem});}}
return(count);},getCardPlayer:function(team,card){var returnPlayer=null;var idx=0;for(idx=0;idx<this.club[team].rosterdata.length;idx++){var compare=this.club[team].rosterdata[idx].first+this.club[team].rosterdata[idx].last+'_playercard.pdf';if(compare==card){returnPlayer=this.club[team].rosterdata[idx];break;}}
return(returnPlayer);},getCardPlayerDesc:function(team,selPlayer,pdata){var returnDesc='',data=null;var c,o,p,d,t=null;var player=selPlayer.first+' '+selPlayer.last;data=this.getStatsData(0,0,team);c=this.getPlayerOffset(data,player);if(c!=999)
o=1;data=this.getStatsData(1,0,team);c=this.getPlayerOffset(data,player);if(c!=999)
p=1;data=this.getStatsData(2,0,team);c=this.getPlayerOffset(data,player);if(c!=999)
d=1;t=o+p+d;if(t==0)
returnDesc=' ';else{if(o==1)
returnDesc+='Batting ';if(p==1)
returnDesc+='Pitching ';if(d==1)
returnDesc+='Fielding ';returnDesc+='PDF ';}
var d=new Date(pdata.date);var dt=d.format('D, m/d/Y @ g:ia');returnDesc+=pdata.size+' b, dated '+dt;return(returnDesc);},printRoster:function(Team){this.printTeam=this.cfgClubs[Team].name;var url='xmldata/'+this.currentSeason+'/html/'+this.cfgClubs[Team].key+'/roster.html';this.printHeader='Team Roster';var UniqueQS=this.getRandomNumber(2400);var aj=new Ajax.Request(url+'?u='+UniqueQS,{method:'get',onSuccess:this.genRosterPrint.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});},genRosterPrint:function(oReq){if(oReq.responseText.length>0)
{var rosterWin=window.open("","printroster","width=600,height=480,status,scrollbars,resizable, screenX=20,screenY=40,left=20,top=40");rosterWin.document.write('<html><head><title>'+this.printHeader+'</title>');rosterWin.document.write('<link type="text/css" href="/common/styles/print.css" rel="stylesheet"></head>');rosterWin.document.write('<BODY BGCOLOR=#ffffff TEXT=#0000CC LINK=#33CCFF VLINK=#FF6666>');rosterWin.document.write('<div class="teamListContent" id=sheduleWin>');rosterWin.document.write(oReq.responseText);rosterWin.document.write('</div><div><br/><input name="print" value="Print" type="button" onClick="window.print()" /></div></body></html>');}
else
alert('Roster is not ready to print, please try later.');},isLoggedIn:function(){var email=document.teamball.email.value;var sess=document.teamball.sess.value;var level=document.teamball.level.value;if(email&&sess&&level)
return level;else
return 0;},loadGoogleMaps:function(){var script=new Element('script',{'type':'text/javascript','src':'http://maps.google.com/maps/api/js?sensor=false&callback=WebSite.mapInit'});document.body.appendChild(script);},mapInit:function(){return;},buildHeader:function(){var logo=$('hdLogo');if(logo!=null)
logo.src=logoImage;this.buildNav(0);if(showHeaderSlideShow)
this.buildHeaderSlideShow();if(hasBoosterClub)
this.genDugoutClub();},buildHeaderSlideShow:function(){var UniqueQS=this.getRandomNumber(2400);var url='xmldata/'+this.currentSeason+'/header.xml?u='+UniqueQS;if(this.headerslideshow==null)
var aj_slideshow=new Ajax.Request(url,{method:'get',onSuccess:this.getHeaderSSData.bind(this),onException:this.hException.bind(this),onFailure:this.hFailure.bind(this)});else
this.showHeaderSlideShow(this.headerslideshow);},getHeaderSSData:function(oReq){this.headerslideshow=XMLObjectifier.xmlToJSON(oReq.responseXML);this.showHeaderSlideShow(this.headerslideshow);},showHeaderSlideShow:function(SlideShow){var slideDiv=$('hdSlideShow');if(slideDiv==null)
return;slideDiv.update();var slideStyle='width:'+headerSlideShowWidth+'px;height:'+headerSlideShowHeight+'px';var mainDiv=new Element('div',{'id':'header_ss','class':'dmxSlideshow '+sss,'style':slideStyle});var totSlides=SlideShow.item.length;for(var x=0;x<10;x++)
{var slide=this.getRandomNumber(totSlides);var imgName=SlideShow.item[slide].image;var simg='images/header/'+imgName;var img=new Element('img',{'src':simg});var div=new Element('div',{'class':'dmxSlide'}).update(img);mainDiv.insert({'bottom':div});}
slideDiv.insert({'bottom':mainDiv});jQuery("#header_ss").dmxHTML5Slideshow({width:headerSlideShowWidth,height:headerSlideShowHeight,shuffle:true,controls:{enabled:false},kenburns:{enabled:true}});},buildFooter:function(){var today=new Date();var year=today.format('Y');var footerDiv=$('footer');var text=CopyrightValue;var par=new Element('div',{'class':'copyrighttext'}).update(text);var pbImg=new Element('img',{'src':'/common/images/PoweredBy.png','align':'right','class':'poweredByLogo'});var aboutLink=new Element('a',{'href':'javascript:handleMenu("About");'});aboutLink.insert({'bottom':pbImg});footerDiv.insert({'bottom':par});footerDiv.insert({'bottom':aboutLink});},getMenuLoginIdx:function(){var rc=null;for(x=0;x<menu.opt.length;x++)
{if(menu.opt[x].name=='Login'||menu.opt[x].name=='Logout'){rc=x;break;}}
return(rc);},shiftNav:function(nType){idx=this.getMenuLoginIdx();menu.opt[idx].name=nType;menu.opt[idx].img=nType+'.png';menu.opt[idx].url="javascript:handleMenu('"+nType+"');";},buildNav:function(sw){var navDiv=$('hdNavButtons');navDiv.update();var level=this.isLoggedIn();if(level)
{if(level=='2'||level=='1')
this.shiftNav('Logout');else
this.shiftNav('Login');}
else
this.shiftNav('Login');var menDiv=new Element('div',{'id':'mainMenu','class':'dmxNavigationMenu '+menu.dimensions[0].style,'style':'opacity:'+menu.dimensions[0].opacity+';width:'+menu.dimensions[0].width+'px;height:'+menu.dimensions[0].height+'px;'+'border-style:'+menu.dimensions[0].border+' ;border-radius:0px;'});var ul=new Element('ul',{'class':'menu '+menu.dimensions[0].style+' horizontal','style':'border-style:hidden'});var mIdx=0;var LoginOpt=0;for(mIdx=0;mIdx<menu.opt.length;mIdx++){var exp=null;var sub=null;if(menu.opt[mIdx].sub.length>0){exp='expandable';sub=new Element('ul',{'class':'sub'});}
var mli=new Element('li',{'title':menu.opt[mIdx].name,'style':'width:'+menu.dimensions[0].itemWidth+'px'});var href=new Element('a',{'href':menu.opt[mIdx].url,'class':exp}).update(menu.opt[mIdx].name);var miSpan=new Element('span',{'class':'sub_down'});var img=new Element('img',{'src':menu.dimensions[0].imgpath+menu.opt[mIdx].img,'border':'0','width':'32','height':'32','alt':menu.opt[mIdx].name});if(menu.dimensions[0].menuimages==true)
href.insert({'top':img});href.insert({'bottom':miSpan});if(menu.opt[mIdx].name=='Login'||menu.opt[mIdx].name=='Logout')
LoginOpt=1;else
LoginOpt=0;if(sub!=null){var subIdx=0,subTot=menu.opt[mIdx].sub.length;if(!LoginOpt||(LoginOpt&&(level=='2'||level=='1'))){for(subIdx=0;subIdx<subTot;subIdx++){var hex=null;if(menu.opt[mIdx].sub[subIdx].name=='History'&&hist.seasons.length>1)
hex='expandable';var sli=new Element('li');var shref=new Element('a',{'title':menu.opt[mIdx].sub[subIdx].name,'href':menu.opt[mIdx].sub[subIdx].url,'class':hex}).update(menu.opt[mIdx].sub[subIdx].name);var simg=new Element('img',{'title':menu.opt[mIdx].sub[subIdx].name,'src':menu.dimensions[0].imgpath+menu.opt[mIdx].sub[subIdx].img,'border':'0','width':'32','height':'32','alt':menu.opt[mIdx].sub[subIdx].name});if(menu.dimensions[0].submenuimages==true)
shref.insert({'top':simg});sli.insert({'bottom':shref});if(menu.opt[mIdx].sub[subIdx].name=='History'&&hist.seasons.length>1)
this.processHistoryMenu(sli);sub.insert({'bottom':sli});}}
mli.insert({'bottom':href});mli.insert({'bottom':sub});}
ul.insert({'bottom':mli});}
menDiv.insert({'bottom':ul});var jsSearch='javascript:WebSite.searchSite();';var frm=new Element('form',{'class':'dmxSearchForm','style':menu.dimensions[0].searchFormStyle});var txt=new Element('input',{'class':'textfield','name':'search','id':'search','size':menu.dimensions[0].searchTextSize,'type':'text','style':menu.dimensions[0].searchFormTextStyle,'value':this.searchText});var but=new Element('input',{'id':'siteSearch','class':'button','type':'button','value':'Search','onclick':jsSearch});var dvc=new Element('div',{'style':'height:0;font-size:0;clear:both;'});frm.insert({'bottom':txt});frm.insert({'bottom':but});menDiv.insert({'bottom':frm});menDiv.insert({'bottom':dvc});navDiv.insert({'bottom':menDiv});if(sw)
jQuery(document).ready(function(){jQuery("#mainMenu").dmxNavigationMenu({width:menu.dimensions[0].width,mainShowEffect:"jump",mainShowDuration:"fast",mainShowEasing:"swing",mainHideEffect:"jump",mainHideDuration:"slow",mainHideEasing:"swing",subShowDuration:"slow",subShowEasing:"easeInQuart",subHideDuration:"slow",subHideEasing:"easeOutQuad",menuOrientation:"horizontal",design:menu.dimensions[0].style});});},processHistoryMenu:function(div){var hIdx=0;var sub=new Element('ul',{'class':'sub'});for(hIdx=0;hIdx<hist.seasons.length;hIdx++){var hli=new Element('li');var hhref=new Element('a',{'title':hist.seasons[hIdx].name,'href':"javascript:WebSite.changeSeason('"+hist.seasons[hIdx].year+"');"}).update(hist.seasons[hIdx].name);var himg=new Element('img',{'title':hist.seasons[hIdx].name,'src':menu.dimensions[0].imgpath+hist.seasons[hIdx].year+'.png','border':'0','width':'32','alt':hist.seasons[hIdx].name});hhref.insert({'top':himg});hli.insert({'bottom':hhref});sub.insert({'bottom':hli});}
div.insert({'bottom':sub});},searchSite:function(){var searchText=null;var search=$('search');if(search!=null)
searchText=search.value;else
searchText='(nothing entered)';alert('Searching for '+searchText+'...\n\nSorry, the search feature is under development.\nPlease try your search later.');},genLogoff:function(){var logoff=$('userLogoff');if(logoff)
{logoff.update();var logoffText='Logoff '+document.teamball.email.value;var logoffLink=new Element('span',{'class':'clear'});logoffLink.insert({bottom:new Element('a',{'href':'javascript:WebSite.logoffUser("Logout");'}).update(logoffText)});logoff.insert({'bottom':logoffLink});logoff.appear();}},logoffUser:function(){var logoff=$('userLogoff');document.teamball.sess.value=null;document.teamball.level.value=null;this.buildNav(1);logoff.fade();logoff.update();},printDir:function(){var mapDir=$('mapdir');if(mapDir.innerHTML.length>0)
{var dirWin=window.open("","directions","width=600,height=480,status,scrollbars,resizable, screenX=20,screenY=40,left=20,top=40");dirWin.document.write('<html><head><title>Directions</title><link type="text/css" rel="stylesheet" href="/common/styles/pop.css"></head>');dirWin.document.write('<BODY>');dirWin.document.write('<div class="teamListContent" id=dirWin>');dirWin.document.write(mapDir.innerHTML);dirWin.document.write('</div><div><br/><input name="print" value="Print" type="button" onClick="window.print()" /></div></body></html>');}
else
alert('Enter starting address and Get Directions before you can print.');},trimLZ:function(val){var ret=val.replace(/^[0]+/g,"");if(!ret.length)
ret='0';else if(ret=='.00')
ret='0.00';return(ret);},preparePrime:function(){$('schedule').fade();$('schedulenav').fade();$('prime').hide();$('prime').update();this.updateLeftHeader(0);},animSeasonChange:function(toSeason){this.hideFooter(0);if(toSeason>this.currentSeason){dmxAnimate('#page1',{translateX:0},{translateX:1200},{duration:650,queue:false});dmxAnimate('#page1',{translateX:-1200},{translateX:0},{duration:650,easing:'easeInElastic',delay:750});}
else{dmxAnimate('#page1',{translateX:0},{translateX:-1200},{duration:650,queue:false});dmxAnimate('#page1',{translateX:1200},{translateX:0},{duration:650,easing:'easeInElastic',delay:750});}},hideFooter:function(show){return;if(show==1){$('footer').show();$('userLogoff').show();$('error').show();}
else{$('footer').hide();$('userLogoff').hide();$('error').hide();}},changeSeason:function(season){$('error').update();if(season.length==4&&this.currentSeason!=season){if(animateSeasonChange)
this.animSeasonChange(season)
this.currentSeason=season;this.initData();this.getApplicationData(1);var csDiv=$('seasonImg');if(csDiv!=null)
{csDiv.update();if(season!=hist.seasons[0].year){var img=new Element('img',{'src':menu.dimensions[0].imgpath+season+'.png','border':'0','width':'32','alt':season+' Season','title':season+' Season'});csDiv.insert({'bottom':img});}}}},ShowCal:function(season,calWidth){this.loadCalData(season);jQuery("#gamecal").dmxAjaxCalendar({id:"gamecal",calendar_name:"Scheduled Events",width:calWidth,animation_easing:"swing",allowed_display_types:[true,true,true,true],legend_position:"bottom",display_type:2,events_type:this.calEvents,google_feeds:[],ajax_feeds:this.calAjaxFeeds,date_display_type:1,week_start:1});},loadCalData:function(season){this.calEvents.length=0;this.calAjaxFeeds.length=0;var urlPath=null;for(var x=0;x<this.cfgClubs.length;x++)
{urlPath="xmldata/"+season+"/cal/"+this.cfgClubs[x].key+"/calschedule.json";var color=this.getCalColor(x);var detail={"number":x,"name":this.cfgClubs[x].name,"color":"#FFFFFF","background_color":color,"border_color":"#000000"};var url={"url":urlPath};this.calEvents.push(detail)
this.calAjaxFeeds.push(url);}},getCalColor:function(idx){var rColor=null;switch(idx){case 0:case 6:rColor="#500000";break;case 1:case 7:rColor="#005000";break;case 2:case 8:rColor="#000050";break;case 3:case 9:rColor="#500050";break;case 4:case 10:rColor="#005050";break;case 5:case 10:rColor="#505000";break;default:rColor="#500000";break;}
return rColor;},hFailure:function(oReq){var errMessage=oReq.responseText;$('error').update(errMessage);$('error').appear();},hException:function(transport,exceptionObj)
{var errMessage=exceptionObj.message+' Line: '+exceptionObj.lineNumber;$('error').update(errMessage);$('error').appear();}});function init(){if(showClock)
jClock(clockImage,$('jclock'));WebSite=new sg();}
function handleMenu(menuOption)
{WebSite.currDisplay=menuOption;var bodyid=document.body.id;switch(menuOption){case'About':WebSite.showAboutPopup();break;case'Home':WebSite.transFull(0);WebSite.displayNewsItem(WebSite.newsSlot[0],0);break;case'opt2':WebSite.transFull(0);WebSite.showSchedule(0,1);break;case'opt3':WebSite.transFull(0);WebSite.showRoster(0);jQuery("#rosterSlideMenu").dmxSlidingMenu({updateBackLabel:false});break;case'opt4':WebSite.transFull(0);WebSite.getStaff();break;case'opt5':WebSite.getSlideShow();break;case'opt6':if(displayStats)
WebSite.verifyUser('Stats');else
alert('Stats are not available for this team');break;case'club':case'boost':WebSite.getDugoutData();break;case'opt7':if(WebSite.loginButton=='Admin')
WebSite.verifyUser('Admin');else if(WebSite.loginButton=='Logoff')
WebSite.logoffUser();else if(WebSite.loginButton=='Login')
WebSite.verifyUser('Login');break;case'cheer':WebSite.transFull(0);WebSite.getCheer();break;case'Admin':WebSite.verifyUser('Admin');break;case'Login':WebSite.verifyUser('Login');break;case'Logout':WebSite.logoffUser('Logout');break;case'News':WebSite.transFull(0);WebSite.showAllNews('latest');break;case'Locations':WebSite.transFull(0);WebSite.showLocations(WebSite.currentteam);break;case'toon':WebSite.transFull(0);WebSite.getToon();break;case'cards':WebSite.transFull(0);WebSite.showCardsList(0);break;case'scorecards':WebSite.transFull(0);WebSite.showGameCardsList(0);break;case'gameday':WebSite.transFull(0);WebSite.showGameDay(0);break;case'movies':WebSite.transFull(0);if(WebSite.showMovies(null))
WebSite.showMoviesList();break;case'calv':WebSite.transFull(0);WebSite.showCalView();break;case'selResults':WebSite.transFull(0);var SelTeam=$F('teamselect');WebSite.showResults(SelTeam);break;case'printDir':WebSite.printDir();break;case'spons':WebSite.transFull(0);WebSite.showSponsors();break;case'store':WebSite.transFull(0);WebSite.showStore();break;case'show0':case'show1':case'show2':WebSite.transFull(0);var NewsItem=menuOption.substring(4,menuOption.length);WebSite.displayNewsItem(WebSite.newsSlot[NewsItem],0);break;case'show3':case'show4':case'show5':case'show6':case'show7':case'show8':case'show9':case'show10':case'show11':case'show12':case'show13':case'show14':case'show15':WebSite.transFull(0);var NewsItem=menuOption.substring(4,menuOption.length);WebSite.displayNewsItem(NewsItem,0);break;case'tourney':WebSite.showDynamic('sshs_showcase');break;case'tryouts':WebSite.showDynamic('tryouts');break;case'club0':case'club1':case'club2':case'club3':case'club4':case'club5':case'club6':case'club7':case'club8':case'club9':case'club10':WebSite.transFull(0);var theClub=menuOption.substring(4,menuOption.length);WebSite.initNavVars();WebSite.currentteam=theClub;WebSite.showSchedule(WebSite.currentteam,WebSite.currentschedule);WebSite.showResults(WebSite.currentteam);break;case'rost0':case'rost1':case'rost2':case'rost3':case'rost4':case'rost5':case'rost6':case'rost7':case'rost8':case'rost9':case'rost10':var theClub=menuOption.substring(4,menuOption.length);WebSite.showRoster(theClub);jQuery("#rosterSlideMenu").dmxSlidingMenu({updateBackLabel:false});break;case'loca0':case'loca1':case'loca2':case'loca3':case'loca4':case'loca5':case'loca6':case'loca7':case'loca8':case'loca9':case'loca10':var theClub=menuOption.substring(4,menuOption.length);WebSite.showLocations(theClub);break;case'full':WebSite.initNavVars();WebSite.showSchedule(WebSite.currentteam,1);break;case'practice':WebSite.initNavVars();WebSite.showSchedule(WebSite.currentteam,2);break;case'league':WebSite.initNavVars();WebSite.showSchedule(WebSite.currentteam,3);break;case'tourn':WebSite.initNavVars();WebSite.showSchedule(WebSite.currentteam,4);break;case'home':WebSite.initNavVars();WebSite.showSchedule(WebSite.currentteam,5);break;case'away':WebSite.initNavVars();WebSite.showSchedule(WebSite.currentteam,6);break;case'day':WebSite.initNavVars();WebSite.showSchedule(WebSite.currentteam,7);break;case'night':WebSite.initNavVars();WebSite.showSchedule(WebSite.currentteam,8);break;case'prnfull':WebSite.printSchedule(WebSite.currentteam,1);break;case'prnpractice':WebSite.printSchedule(WebSite.currentteam,2);break;case'prnleague':WebSite.printSchedule(WebSite.currentteam,3);break;case'prntourn':WebSite.printSchedule(WebSite.currentteam,4);break;case'prnhome':WebSite.printSchedule(WebSite.currentteam,5);break;case'prnaway':WebSite.printSchedule(WebSite.currentteam,6);break;case'prnday':WebSite.printSchedule(WebSite.currentteam,7);break;case'prnnight':WebSite.printSchedule(WebSite.currentteam,8);break;case'prnroster':WebSite.printRoster(WebSite.currentteam);break;default:break;}}
