function DisplayPasswordOfTheDay() { if (document.all['T1'].style.display == 'none') { var dates = document.all['T2'].value.split('/'); if (dates.length == 3 && ValidNumber(dates[0]) && ValidNumber(dates[1]) && ValidNumber(dates[2])) { if (dates[2].length == 2) document.all['T2'].value = dates[0] + '/' + dates[1] + '/' + '20' + dates[2]; DisplayDate(document.all['T2'].value, new Date(document.all['T2'].value)); } else alert('The entered date was not valid. Enter a date in the format MM/DD/YYYY in order to get the RRC Password for a different day.'); } else if (document.all['T1'].value.toUpperCase() == 'RICHMOND') { var today = new Date(); DisplayDate('today', today); document.all['T1'].style.display = 'none'; document.all['T2'].style.display = ''; document.all['T2'].value = (today.getMonth() + 1) + '/' + today.getDate() + '/' + today.getFullYear(); document.all['Instruction'].innerText = "New Date:" } else { alert('The key code was not valid. Please enter a valid key code.'); } } function DisplayDate(dateName, dt) { var day = dt.getDate(); var month = dt.getMonth() + 1; var year = dt.getFullYear(); var password = (((year%128)*256 + month*32 + (day*199999)%5179)*32749)%10000; alert('The RRC password for ' + dateName + ' is: ' + password + '\n\n Enter a date in the format MM/DD/YYYY in order to get the RRC Password for a different day.'); } function ValidNumber(str) { if (str.length == 0 || isNaN(str)) return false; for (var i=0; i