var MONTH_DAYS=42;if(!window.XMLHttpRequest)window.XMLHttpRequest=function(){var xmlHttp;try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP.4.0");return xmlHttp}catch(ex){}try{xmlHttp=new ActiveXObject("MSXML2.XMLHTTP");return xmlHttp}catch(ex){}try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");return xmlHttp}catch(ex){}return null};function Popup(url,toolbar,scrollbars,location,statusbar,menubar,resizable,width,height){var day=new Date,id=day.getTime(),val="toolbar="+toolbar+",scrollbars="+scrollbars+",location="+location+",statusbar="+statusbar+",menubar="+menubar+",resizable="+resizable+",width="+width+",height="+height+",left = 100,top = 50";eval("var pg"+id+' = window.open(url, id.toString(), "\'" + val + "\'");')}function Toggle(id,show){var i=document.getElementById(id);if(i)i.style.display=show?"block":"none"}function GetXml(url){var request=new XMLHttpRequest;request.open("GET",url,false);request.send("");if(request.status==200)return request.responseXML}function GetPage(url){var request=new XMLHttpRequest;request.open("GET",url,false);request.send("");if(request.status==200)return request.responseText;return null}function PostXml(url,xmlDoc,doRetXml){var req=new XMLHttpRequest;req.open("POST",url,false);req.setRequestHeader("content-type","text/xml");req.send(xmlDoc);if(req.status==200)return doRetXml?req.responseXML:req.responseText;return "Connection Error Occured"}function BuildDropdown(ddl,opsArr,select){for(var i=0;i<opsArr.length;i++){var sp=opsArr[i].split("#");ddl.options[i]=new Option(sp[0],sp[1]);ddl.options[i].selected=select==sp[1]}}function ShowUpdating(){Toggle("updating",true)}function CloseUpdating(){Toggle("updating",false)}function CrcTrack(){GetPage("./data.aspx?type=crc");return true}function SetCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+(expires?"; expires="+expires.toGMTString():"")+(path?"; path="+path:"")+(domain?"; domain="+domain:"")+(secure?"; secure":"")}function GetCookie(name){var dc=document.cookie,prefix=name+"=",begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))}function GetOptionIndex(ops,value){value=value||"";value=value.toLowerCase();for(var i=0;i<ops.length;i++)if(ops[i].value.toLowerCase()==value)return i;return 0}function SelectToggle(show){var a=document.getElementsByTagName("select");if(a)for(var i=0;i<a.length;i++)a[i].style.display=show?"block":"none"}String.prototype.lTrim=function(){return this.replace(/^\s*/,"")};String.prototype.rTrim=function(){return this.replace(/\s*$/,"")};String.prototype.trim=function(){return this.rTrim().lTrim()};String.prototype.endsWith=function(sEnd){return this.substr(this.length-sEnd.length)==sEnd};String.prototype.startsWith=function(sStart){return this.substr(0,sStart.length)==sStart};String.prototype.format=function(){var s=this;for(var i=0;i<arguments.length;i++)s=s.replaceAll("{"+i+"}",arguments[i]);return s};String.prototype.format2=function(args){var s=this;for(var i=0;i<args.length;i++)s=s.replaceAll("{"+i+"}",args[i]);return s};String.prototype.replaceAll=function(srch,replace){var s=this;srch=srch.replace("{","\\{");srch=srch.replace("}","\\}");var regex=new RegExp(srch,"g");while(s.match(regex))s=s.replace(regex,replace);return s};String.prototype.removeSpaces=function(){return this.replace(/ /gi,"")};String.prototype.removeExtraSpaces=function(){return this.replace(String.prototype.removeExtraSpaces.re," ")};String.prototype.removeExtraSpaces.re=new RegExp("\\s+","g");String.prototype.removeSpaceDelimitedString=function(r){var s=" "+this.trim()+" ";return s.replace(" "+r,"").rTrim()};String.prototype.xmlEncode=function(){var s=this;s=s.replaceAll("&","{amp}");s=s.replaceAll(">","&gt;");s=s.replaceAll("<","&lt;");s=s.replaceAll('"',"&quot;");s=s.replaceAll("'","&apos;");s=s.replaceAll("{amp}","&amp;");return s};String.prototype.encodeURI=function(){var returnString;returnString=escape(this);returnString=returnString.replace(/\+/g,"%2B");return returnString};String.prototype.decodeURI=function(){return unescape(this)};String.Builder=function(p_strInitial){var arrParts=new Array;this.append=function(p_strText){if(!(p_strText==null||typeof p_strText=="undefined"||typeof p_strText=="string"&&p_strText.length==0))arrParts.push(p_strText)};this.appendFormat=function(p_strText){var s=new String(p_strText);for(var i=1;i<arguments.length;i++)s=s.replaceAll("{"+(i-1)+"}",arguments[i]);this.append(s)};this.appendLine=function(p_strText){this.append(p_strText);arrParts.push("\r\n")};this.clear=function(){arrParts.clear()};this.isEmpty=function(){return arrParts.length==0};this.toString=function(p_strDelim){p_strDelim=p_strDelim||"";return arrParts.join(p_strDelim)};this.append(p_strInitial);return this};Object.prototype.clone=function(){eval("var tmp = "+this.toJSON());return tmp};Object.prototype.toJSON=function(){var json=[];for(var i in this){if(!this.hasOwnProperty(i))continue;json.push(i.toJSON()+" : "+(this[i]!=null?this[i].toJSON():"null"))}return "{\n "+json.join(",\n ")+"\n}"};Array.prototype.toJSON=function(){for(var i=0,json=[];i<this.length;i++)json[i]=this[i]!=null?this[i].toJSON():"null";return "["+json.join(", ")+"]"};Boolean.prototype.toJSON=function(){return this};Function.prototype.toJSON=function(){return this};Number.prototype.toJSON=function(){return this};RegExp.prototype.toJSON=function(){return this};Date.prototype.toJSON=function(){return this.toShortDate().toJSON()};String.prototype.toJSON=function(){var tmp=this.split("");for(var i=0;i<tmp.length;i++){var c=tmp[i];c>=" "?c=="\\"?tmp[i]="\\\\":c=='"'?tmp[i]='\\"':0:tmp[i]=c=="\n"?"\\n":c=="\r"?"\\r":c=="\t"?"\\t":c=="\b"?"\\b":c=="\f"?"\\f":c=c.charCodeAt(),"\\u00"+(c>15?1:0)+c%16}return '"'+tmp.join("")+'"'};Array.prototype.indexOf=function(p_var){for(var i=0;i<this.length;i++)if(this[i]==p_var)return i;return -1};Array.prototype.exists=function(p_var){return this.indexOf(p_var)!=-1};Array.prototype.queue=function(p_var){this.push(p_var)};Array.prototype.dequeue=function(){return this.shift()};Array.prototype.insert=function(p_iIndex,p_objItem){this.splice(p_iIndex,0,p_objItem)};Array.prototype.clone=function(){var clonedArray=[],length=this.length;for(var index=0;index<length;index++)clonedArray[index]=this[index];return clonedArray};Array.prototype.removeAt=function(p_iIndex){return this.splice(p_iIndex,1)};Array.prototype.remove=function(o){var i=this.indexOf(o);if(i>-1)this.splice(i,1);return i>-1};Array.prototype.clear=function(){for(var i=0;i<this.length;i++)this[i]=null};Date.prototype.monthName=function(){switch(this.getMonth()){case 0:return "January";case 1:return "February";case 2:return "March";case 3:return "April";case 4:return "May";case 5:return "June";case 6:return "July";case 7:return "August";case 8:return "September";case 9:return "October";case 10:return "November";case 11:return "December";default:return null}};Date.prototype.addDays=function(numDays){var d=new Date(this.toLocaleString());d.setDate(this.getDate()+numDays);return d};Date.prototype.addMonths=function(numMonths){var d=new Date(this.toLocaleString());d.setMonth(this.getMonth()+numMonths);return d};Date.prototype.getDayName=function(){switch(this.getDay()){case 0:return "Sunday";case 1:return "Monday";case 2:return "Tuesday";case 3:return "Wednesday";case 4:return "Thursday";case 5:return "Friday";case 6:return "Saturday";default:return "Sunday"}};Date.prototype.weekInMonth=function(firstDayOfWeek){var firstDay=new Date(this.getFullYear(),this.getMonth(),1),first=firstDay.getDay(),firstWeek=firstDay.addDays(-1*(first-firstDayOfWeek)),wkNum=0;while(firstWeek.valueOf()<this.valueOf()&&wkNum<=6){firstWeek=firstWeek.addDays(7);wkNum++}return wkNum};Date.prototype.getFirstCalendarDay=function(firstDayOfWeek){var firstDay=new Date(this.getFullYear(),this.getMonth(),1),first=firstDay.getDay(),month1=firstDay.addDays(-1*(first-firstDayOfWeek)),month2=firstDay.addDays(35);return this.weekInMonth(firstDayOfWeek)>5?month2:month1};Date.prototype.getFirstWeekDay=function(firstDayOfWeek){var dt=new Date(this.toLocaleString()),dayct=dt.getDay()-firstDayOfWeek;if(dayct<0)dayct=7+dayct;dt=dt.addDays(-1*dayct);return dt};Date.prototype.toShortDate=function(){var s=new String.Builder;s.appendFormat("{0}/{1}/{2}",this.getMonth()+1,this.getDate(),this.getFullYear());return s.toString()};Date.prototype.toLongDate=function(){var s=new String.Builder;s.appendFormat("{0}, {1} {2}, {3}",this.getDayName(),this.monthName(),this.getDate(),this.getFullYear());return s.toString()};function ParseDateXml(dateStr){if(!dateStr)return null;var a=dateStr.split("T"),d=a[0].split("-"),dt=d.length==1?new Date(dateStr):new Date(d[1]+"/"+d[2]+"/"+d[0]);return dt}function GetWinHeight(){if(window.innerHeight!=window.undefined)return window.innerHeight;if(document.compatMode=="CSS1Compat")return document.documentElement.clientHeight;if(document.body)return document.body.clientHeight;return window.undefined}function GetWinWidth(){if(window.innerHeight!=window.undefined)return window.innerWidth;if(document.compatMode=="CSS1Compat")return document.documentElement.clientWidth;if(document.body)return document.body.clientWidth;return window.undefined}var CurrentStyle=_themes[0];SetTheme();function SetTheme(theme){if(!theme)theme=GetCookie("theme");if(!theme)theme=_themes[0];CurrentStyle=theme;var links=document.getElementsByTagName("link"),numLinks=links.length;for(var i=0;i<numLinks;i++){var link=links[i],title=link.getAttribute("title");if(link.getAttribute("rel").indexOf("stylesheet")!=-1&&title){link.disabled=true;if(link.getAttribute("title")==CurrentStyle)link.disabled=false}}var today=new Date;today.setMonth(today.getMonth()+1);SetCookie("theme",CurrentStyle,today,null,null,false)}Viewport=new function(){this.Height=function(){return window.screen.availHeight};this.Width=function(){return window.screen.availWidth};this.PageXOffset=function(){return document.all?document.body.scrollLeft:window.pageXOffset};this.PageYOffset=function(){return document.all?document.documentElement.scrollTop:window.pageYOffset}};function OnWebMethodError(ex){var s=new Sys.StringBuilder;s.appendLine("Error Details: ");s.appendLine("Message: "+ex.get_message());s.appendLine("Stack: "+ex.get_stackTrace());s.appendLine("Type: "+ex.get_exceptionType());alert(s.toString())}function CenterElement(parent,child){var childW=child.offsetWidth,childH=child.offsetHeight,parentW=parent.offsetWidth,parentH=parent.offsetHeight,wDiff=Math.abs(parentW-childW),hDiff=Math.abs(parentH-childH);child.style.top=hDiff/2+parent.offsetTop+"px";child.style.left=wDiff/2+parent.offsetLeft+"px"}function CenterElementOnScreen(ele){var eWidth=ele.offsetWidth,eHeight=ele.offsetHeight,wWidth=Viewport.Width(),wHeight=Viewport.Height(),vert=wHeight/2-eHeight/2+Viewport.PageYOffset(),horz=wWidth/2-eWidth/2+Viewport.PageXOffset();ele.style.top=vert+"px";ele.style.left=horz+"px"}function GetSelectedText(ddl){if(ddl.selectedIndex<ddl.options.length)return ddl.options[ddl.selectedIndex].text;else return ""}function GetSelectedValue(ddl){if(ddl.selectedIndex>=0&&ddl.selectedIndex<ddl.options.length)return ddl.options[ddl.selectedIndex].value;else return ""}function SetDropFromValue(ddl,value){for(var i=0;i<ddl.options.length;i++)if(ddl.options[i].value==value){ddl.selectedIndex=i;return}ddl.selectedIndex=0}function Display(obj,show){if(show)RemoveClass(obj,"invisible");else AttachClass(obj,"invisible")}function RemoveClassFromElements(parent,tagName,className){var tags=parent.getElementsByTagName(tagName);for(var i=0;i<tags.length;i++)RemoveClass(tags[i],className)}function AttachClass(ele,className){var clssArr=ele.className.split(" ");for(var i=0;i<clssArr.length;i++)if(clssArr[i]==className)return;clssArr.push(className);ele.className=clssArr.join(" ")}function RemoveClass(ele,className){var clssArr=ele.className.split(" ");for(var i=0;i<clssArr.length;i++)if(clssArr[i]==className){clssArr.splice(i,1);break}ele.className=clssArr.join(" ")}function GetTarget(event){event=event||window.event;var t=event.target||event.srcElement;return t}function GID(id){return document.getElementById(id)}function ApCh(parent,child){parent.appendChild(child)}function CrEl(tag){return document.createElement(tag)}var _registeredEvents=[];function Attach(element,eventName,action){if(element.attachEvent)element.attachEvent(eventName,action);else{if(eventName.startsWith("on"))eventName=eventName.substr(2);element.addEventListener(eventName,action,false)}_registeredEvents.push([element,eventName,action])}function UnregisterEvents(){while(_registeredEvents.length>0){var obj=_registeredEvents.pop();Detach(obj[0],obj[1],obj[2]);obj=null}_registeredEvents=null}function Detach(element,eventName,action){element.detachEvent(eventName,action)}function GetKeyCode(event){event=event||window.event;return event.keyCode}function CleanChildren(parent){while(parent.childNodes.length>0)parent.removeChild(parent.childNodes[0])}function ClearOptions(ddl){for(var i=0;i<ddl.options.length;i++)ddl.options[i]=null;ddl.options.length=0}function GetWinHeight(){if(window.innerHeight!=window.undefined)return window.innerHeight;if(document.compatMode=="CSS1Compat")return document.documentElement.clientHeight;if(document.body)return document.body.clientHeight;return window.undefined}function OnWebMethodError(ex){alert("An unhandled exception occurred. Mail has been sent to the administrator with the details. Refresh the page and try again.")}function StatusElement(){var _parentEle=null,_ele=null,_textEle=null;this.Initialize=function(parentElement){_parentEle=parentElement;Render();Display(_ele,false)};this.Dispose=function(){parentEle=_ele=_textEle=null};this.StatusWrite=function(text){_textEle.innerHTML=text||"";Display(_ele,text!=null);CenterElementOnScreen(_ele)};function Render(){_ele=CrEl("div");_textEle=CrEl("h4");ApCh(_parentEle,_ele);ApCh(_ele,_textEle);AttachClass(_ele,"StatusPane")}}function IsCoach(team,username){if(team){username=username.toLowerCase();var coaches=team.Coaches;for(var i=0;i<coaches.length;i++)if(coaches[i].Username.toLowerCase()==username)return true}return false}