var t_bx='';var t_ev=0;var t_it=0;var t_cu=1;var t_hD=true;var t_eW;var t_iB=null;var t_iz=false;var t_iA=0;function sendFlashVar(t_gz,t_gC){var div=document.getElementById('remoteStatus');var t_dh=t_bx;t_at("click2");if(t_eW)clearTimeout(t_eW);t_bx=t_gz;switch(t_gz){case 'PLAY':t_ev=t_ib;if(t_dh!='PLAY'){if(t_dh!='FASTFORWARD'&&t_dh!='REWIND'){if(t_ct<=1||t_ct>=hdata.length-1){t_dj=0;}if(t_ct>=hdata.length-1){t_ct=1;}}else{t_dj=raceDuration;}t_eY=(new Date()).getTime();t_cu=1;t_ag=t_hX;div.innerHTML='PLAY';}break;case 'FASTFORWARD':t_ev=t_hY;if(t_dh!='PAUSE'){if(t_ct==0){t_eY=(new Date()).getTime();t_dj=0;}else{t_eY=t_dg;t_dj=raceDuration;}if(t_ag==t_hW){t_cu=1;}if(t_cu<64){t_cu*=2;}t_ag=t_hX;div.innerHTML='FFWDx'+t_cu;}else{t_cu=1;t_ag=t_hX;t_bx='PAUSE';t_gz='STOP';div.innerHTML='NEXT';if(t_ct<hdata.length-1){if(t_ct>0){t_eY=hdata[t_ct][0];t_dj=t_r(hdata[t_ct][0]);}t_ct++;t_E(t_ct,true);}}break;case 'REWIND':t_ev=t_ic;if(t_dh!='PAUSE'){if(t_ct==0){t_eY=(new Date()).getTime();t_dj=0;}else{t_eY=t_dg;t_dj=raceDuration;}if(t_ag==t_hX){t_cu=1;}if(t_cu<64){t_cu*=2;}t_ag=t_hW;div.innerHTML='REWx'+t_cu;}else{t_cu=1;t_ag=t_hW;t_bx='PAUSE';t_gz='STOP';div.innerHTML='PREV';if(t_ct>1){t_ct--;if(t_ct<hdata.length-1){t_eY=hdata[t_ct][0];t_dj=t_r(hdata[t_ct][0]);}t_E(t_ct,true);}}break;case 'PAUSE':t_ev=t_ia;t_dj=raceDuration;t_eY=t_dg;div.innerHTML='PAUSE';break;case 'STOP':t_ev=t_id;raceDuration=0;t_dj=0;t_eY=null;for(var jx=0;jx<t_ek;jx++){if(+hdata_horse[jx][1]>0)t_hK[jx].setPoint(t_ih);}t_ct=3;t_E(t_ct,true);timerDiv.innerHTML='';t_cu=1;t_ag=t_hX;div.innerHTML='STOP';t_ba(false);break;}t_az(t_ev);if(t_fC&&t_au){if(t_gz!='PLAY'){playAudio('stop');}else{if(t_ct==0){playAudio('play');}else{t_aQ(t_ct);}}}t_eu=false;if(t_gz=='STOP'||t_gz=='PAUSE')if(t_dh!='STOP'&&t_dh!='PAUSE')t_eu=true;t_aS("flashRemoteComms").processIncomingMessage(t_bx,t_gC);t_eW=setTimeout(t_n,1500);};function t_aQ(t_cl){var t_bR=t_r(hdata[t_cl][0]);t_bR=t_bR*0.012+(+10);if(t_cl>0)playAudio(Math.round(t_bR));};function t_az(mode){var i,t_bo=[5];t_bo[t_ic]=document.getElementById('buttonRewind');t_bo[t_ib]=document.getElementById('buttonPlay');t_bo[t_ia]=document.getElementById('buttonPause');t_bo[t_id]=document.getElementById('buttonStop');t_bo[t_hY]=document.getElementById('buttonForward');for(i=0;i<t_bo.length;i++){if(i==mode)t_bo[i].style.backgroundPosition="right";else t_bo[i].style.backgroundPosition="left";}};function t_n(){var div=document.getElementById('remoteStatus');if(t_bx=='STOP'||t_bx=='PLAY'){div.innerHTML='';if(t_bx=='STOP'){t_az(t_hZ);}}else if(t_bx=='PAUSE'){t_ev=t_ia;t_az(t_ev);div.innerHTML=t_bx;}};function machineTest(){if(t_ev!=t_id&&t_ev!=t_ia){alert("Animation must be stopped before\nthe Performance Test can be run.");return;}if(!confirm("The Performance Test will run for about 10 seconds.\nDo you wish to proceed?"))return;t_iv=true;setTimeout(t_cJ,10000);t_iq=t_ct;t_ct=50;t_it=t_ev;t_ev=t_ib;setTimeout(t_by,10);};function checkThrottle(){var t_gq=window.prompt("Enter a throttle percentage between 50% and 100%.",t_gr);if(t_gq==null)return;t_gq=parseInt(t_gq);if(t_gq>100)t_gq=100;if(t_gq<50)t_gq=50;if(t_gr!=t_gq){t_gr=t_gq;t_ju();}};function t_ju(){t_aS('flashRemoteComms').throttleFrameRate(t_gr);var t_fN="Throttle ["+t_gr+"%]";var t_bB=document.getElementsByTagName('div');for(var ix=t_bB.length-1;ix>0;ix--){if(t_bB[ix].innerHTML.substr(0,8)=="Throttle"){t_bB[ix].innerHTML=t_fN;break;}}};function t_by(){t_E(t_ct++,true);if(t_iv)setTimeout(t_by,10);};function t_cJ(){t_iv=false;var t_iy=t_r(hdata[t_ct][0])-t_r(hdata[50][0]);alert("Speed Test = "+Math.round(t_iy/100)+"%");t_ct=t_iq;t_ev=t_it;t_E(++t_ct,true);t_E(--t_ct,true);};function receiveFlashVar(t_al){if(t_bx==t_al){switch(t_al){case 'PLAY':case 'FASTFORWARD':if(t_ct>hdata.length-2){t_ct=1;return false;}t_D(t_al);break;case 'REWIND':if(t_ct<1){t_ct=1;return false;}t_D(t_al);break;case 'STOP':case 'PAUSE':return false;}}if(t_eu){t_eu=false;return false;}return true;}