var Selected_Month,Selected_Year,Current_Date=new Date,currentMonth=Current_Date.getMonth(),Days_in_Month=[31,28,31,30,31,30,31,31,30,31,30,31],Month_Label="January,February,March,April,May,June,July,August,September,October,November,December".split(","),currentYear=Current_Date.getYear();currentYear<1E3&&(currentYear+=1900); var screenBoxPercentage=0.85,today=Current_Date.getDate(),todayInt=currentYear*1E4+(currentMonth+1)*100+today,firstVideoYear=2004,firstVideoMonth=10,firstVideoDate=20020301,dataHTTP=createXMLHTTPRequest(),listGetURL="/cgi-bin/showVideoAvailable.cgi",switchVidViewURL="/cgi-bin/rep_link/switchView",currentRRView="p",allowRRViewToggle=!1,otherRRView=[];otherRRView.p="h";otherRRView.h="p";var RRViewLabels=[];RRViewLabels.p="Pan Shot";RRViewLabels.h="Head-On Shot"; function setRRViewButtonImage(a,b){document.getElementById(a).src="/images/video/button_"+b+otherRRView[currentRRView]+".png"}function setViewToggleLabelText(){setInnerHTML("switchLink",'<img id="switchViewImg" src="/images/video/button_enabled'+otherRRView[currentRRView]+'.png" border="0" alt="Switch to the '+RRViewLabels[otherRRView[currentRRView]]+' video" />')} function activateVidSwitch(){if(dataHTTP.readyState==4&&dataHTTP.status==200){var a=dataHTTP.responseText;a.length>5&&(setInnerHTML("playerObject",a),currentRRView=otherRRView[currentRRView],setViewToggleLabelText())}} function switchRRView(a,b){if(allowRRViewToggle)if(a!="w"||/MSIE (\d+\.\d+);/.test(navigator.userAgent)){if(dataHTTP=createXMLHTTPRequest()){var c="?file="+b+"&view="+otherRRView[currentRRView]+"&format="+a;dataHTTP.onreadystatechange=activateVidSwitch;dataHTTP.open("GET",switchVidViewURL+c,!0);dataHTTP.send(null)}}else self.location.search="?_"+otherRRView[currentRRView]+a} function showRRDataView(a){a=="s"?(document.getElementById("entriesTabButton").src="/images/video/starters-off.gif",document.getElementById("resultsTabButton").src="/images/video/results.gif",document.getElementById("resultsTab").style.display="none",document.getElementById("entriesTab").style.display="block"):(document.getElementById("entriesTabButton").src="/images/video/starters.gif",document.getElementById("resultsTabButton").src="/images/video/results-off.gif",document.getElementById("entriesTab").style.display= "none",document.getElementById("resultsTab").style.display="block")}function header(a,b){b==1&&(Days_in_Month[1]=a%400==0||a%4==0&&a%100!=0?29:28);return Month_Label[b]+" "+a} function makeCalendar(a,b){var c=new Date(a,b,1),f=header(a,b),c=c.getDay()+1,e=5;Days_in_Month[b]==31&&c>=6||Days_in_Month[b]==30&&c==7?e=6:Days_in_Month[b]==28&&c==1&&(e=4);document.when.nextMonth.disabled=a>currentYear||a==currentYear&&b>=currentMonth?!0:!1;document.when.previousMonth.disabled=a<firstVideoYear||a==firstVideoYear&&b<firstVideoMonth?!0:!1;var d='<table><tr><td valign="top"><table class="CalendarTable">';d+='<tr class="CalendarHeaderRow"><th colspan=7 class="CalendarHeader">'+f+"</th></tr>"; d+='<tr><th class="CalendarDayHeader">Sun</th><th class="CalendarDayHeader">Mon</th><th class="CalendarDayHeader">Tue</th><th class="CalendarDayHeader">Wed</th>';d+='<th class="CalendarDayHeader">Thu</th><th class="CalendarDayHeader">Fri</th><th class="CalendarDayHeader">Sat</th></tr>';for(var f=a*1E4+(b+1)*100,g=1,j=1,h=f+g,i=0,h="",k=1;k<=e;k++){d+='<tr class="CalendarDateRow">';for(i=1;i<8;i++)j>=c&&g<=Days_in_Month[b]?(h=f+g,h<=todayInt&&h>=firstVideoDate?(h="javascript:showTrackForDate("+h+", 0);", d+='<td class="CalendarActive"><a href="'+h+'" onMouseover="newToolTip(this,event,\'Will display Tracks Available for '+Month_Label[b]+" "+g+'\');" onMouseout="hidetip();">'+g+"</a>"):d+='<td class="CalendarFuture">'+g,d+="</td>",g++):d+='<td class="CalendarEmpty"> </td>',j++;d+="</tr>"}d+="</table></td></tr></table>";setInnerHTML("Calendar",d)}function Check_Nums(){if(event.keyCode<48||event.keyCode>57)return!1} function On_Year(){var a=document.when.year.value;if(a.length==4)Selected_Month=document.when.month.selectedIndex,Selected_Year=a,makeCalendar(Selected_Year,Selected_Month)}function On_Month(){var a=document.when.year.value;a.length==4?(Selected_Month=document.when.month.selectedIndex,Selected_Year=a,makeCalendar(Selected_Year,Selected_Month)):(alert("Please enter a valid year."),document.when.year.focus())} function Defaults(){Math.round(document.body.clientWidth/2);document.when.month.selectedIndex=currentMonth;document.when.year.value=currentYear;Selected_Month=currentMonth;Selected_Year=currentYear;makeCalendar(currentYear,currentMonth)} function Skip(a){a=="+"?Selected_Month==11?(Selected_Month=0,Selected_Year++):Selected_Month++:Selected_Month==0?(Selected_Month=11,Selected_Year--):Selected_Month--;makeCalendar(Selected_Year,Selected_Month);document.when.month.selectedIndex=Selected_Month;document.when.year.value=Selected_Year}function showDivElement(a){document.getElementById(a).style.visibility="visible"}function hideDivElement(a){document.getElementById(a).style.visibility="hidden"} function hideSelects(a){var b=navigator.appVersion.toLowerCase().indexOf("msie 5.")!=-1,c=navigator.appVersion.toLowerCase().indexOf("msie 6.")!=-1;a!="visible"&&(a="hidden");if(b||c)for(b=0;b<document.forms.length;b++)for(c=0;c<document.forms[b].length;c++)if(document.forms[b].elements[c].options)document.forms[b].elements[c].style.visibility=a;c=document.getElementsByTagName("iframe");for(b=0;b<c.length;++b)c[b].style.visibility=a} function closeDisplayWindow(a){hideDivElement(a);hideSelects("visible")}function showOneHideOne(a,b){a=="dateTrackBox"&&hideSelects("visible");hideDivElement(a);showDivElement(b)}function toggleSubList(a){a=document.getElementById(a);currDisp=a.style.display;!currDisp||currDisp=="none"?(a.style.display="inline",a.style.overflow="auto"):a.style.display="none"} function displayVidListData(a,b){var c=a+'<span id="dateTrackcloseTag" class="closeTag"><a href="javascript:showOneHideOne(\'dateTrackBox\', \'monthItem\')">Close X</a></span>'+b,f=document.getElementById("dateTrackBox"),e=document.getElementById("dateTrackBoxDetails"),d=getTop("dataTable");f.style.width=getWidth("dataTable")+"px";f.style.left=getLeft("dataTable")+"px";f.style.top=d+"px";d=getScreenHeight()-d-140;f.style.height=d+"px";showDivElement("dateTrackBox");hideSelects("hidden");e.style.height= d-5+"px";e.style.width=getWidth("dataTable")+"px";e.style.display="block";e.style.overflow="auto";e.innerHTML=c;statusSpinning=!1;updateStatus()} function showTrackForDate(a,b){dataHTTP.readyState!=0&&dataHTTP.abort();var c=a+"",f=c.substr(4,2)+"/"+c.substr(6,2)+"/"+c.substr(0,4),e="Here are the tracks with replay data for "+f+"<br /><span>Click on the track name to see which races are available</span>",c=["listType=DATE&breed=T&date="+a],d=listGetURL;dataHTTP.onreadystatechange=function(){dataHTTP.readyState==4&&(dataHTTP.status==200?displayVidListData(e,dataHTTP.responseText):(b++,b<=3?showTrackForDate(a,b):(e="There was a problem getting replay data for "+ f+'<br /><span>Please <a href="javascript:showTrackForDate('+a+", "+b+');">try again</a></span>',displayVidListData(e,""))))};var g=document.getElementById("statusBox");statusSpinning=!0;g.style.left=getLeft("dataTable")+"px";g.style.top=getTop("dataTable")+"px";updateStatus();g.style.visibility="visible";dataHTTP.open("POST",d,!0);dataHTTP.send(c[0])};
