function populateCitySelect( country ) { newcountry = country.replace(/ /g,''); if ( newcountry.length == 0 ) { document.theForm.Choice.length = 1; document.theForm.Choice.options[0] = new Option('Choose a country:'); document.theForm.Choice.options[0].value = ''; return; } if ( country == 'Holland' ) { newcountry = 'Netherlands'; } if ( country == 'Britain' ) { newcountry = 'England'; } newOptions = eval(newcountry+'Array'); document.theForm.Choice.length = 1; document.theForm.Choice.options[0] = new Option('Choose a city :'); document.theForm.Choice.options[0].value = ''; document.theForm.Choice.options[0].selected = true; var citylength = newOptions.length + 1; for ( i=0; i= 2.0 ) && ( version < 2.1 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) ) { return false; } else { return true; } } function isLeapYear(yrStr) { var leapYear=false; // every fourth year is a leap year if ((parseInt(yrStr, 10)%4) == 0) { leapYear=true; } return leapYear; } function getDaysInMonth(mthIdx, YrStr) { //Default number of days in a month is 31 var maxDays=31 // expect Feb. if (mthIdx==2) { if (isLeapYear(YrStr)) { maxDays=29; } else { maxDays=28; } } // All the rest of the months have 30 days if (mthIdx==4 || mthIdx==6 || mthIdx==9 || mthIdx==11) { maxDays=30; } return maxDays; } function adjustDate(mthIdx, Dt, Yr) // **************************************************************** // * Author: Geraldine Healy Date: 25/08/1998 // * Description: Adjusts the format of the Date // **************************************************************** { var value=0; var numDays=getDaysInMonth(mthIdx, Yr.options[Yr.options.selectedIndex].value); if (mthIdx==2) { if (Dt.options.selectedIndex < numDays) { return 0; } else { //check for leap year Dt.options.selectedIndex=numDays; if (numDays==29) { return 99; } else { return 1; } } } if (Dt.options.selectedIndex < numDays) { value=0; } else { if (Dt.options.selectedIndex > numDays) { Dt.options.selectedIndex; value=3; } else { //index is 31 or 30 value=2; } } return value; } function parseMonth(mth, inM) // **************************************************************** // * Author: Geraldine Healy Date: 25/08/1998 // * Description: Parses a string and returns a month value // **************************************************************** { var i=1; var retval =1; for (i=1;i<=12;i++) { if (mth == inM.options[i].value) { retval=i; break; } } return retval; } function parseDay(day, inD){ var i=1; var retval =1; for (i=1;i<=31;i++) { if (day == inD.options[i].value) { retval=i; break; } } return retval; } function parseYear(year, inY){ var retval=0; var i=0; for (i=0; i<=5; i++) { if (year == inY.options[i].value) { retval=i; break; } } return retval; } function nextMonth(month){ if (month==12) { return 1; } else { return (month+1); } } function prevMonth(month) { var prevMonth = (month-1) if (month==1) { prevMonth = 12; } return prevMonth } function changeYear(direction,month,year) { var theYear = year if (direction=="next") { if (month == 12) { theYear = (year+1) } } if (direction=="prev") { if (month == 1) { theYear = (year-1) } } return theYear } function createCalendar(month,year,io) { if (!isBrowserSupp()) { alert("Your browser is outdated and does not support this feature") return; } if (navigator.appVersion.indexOf("Mac",0) != -1) { calendarWindow = window.open("","Calendar","width=230,height=365,resizable=yes,scrollbars=no"); } else { calendarWindow = window.open("","Calendar","width=230,height=345,resizable=yes,scrollbars=no"); } var mthIdx = month.options.selectedIndex var mthVal = month.options[mthIdx].value var yearVal = year.options[year.options.selectedIndex].value //call the function to populate the window generateCalendar(calendarWindow,mthVal,yearVal,io) } //generates the meat of the calendar function generateCalendar(target,month,year,io) { if (!isBrowserSupp()) { return; } var monthName = new Array ("January","February","March","April","May","June","July","August","September","October","November","December") //begin table for calendar target.document.open() calendar = "calendar
" calendar +="" calendar +="" //The parseInt function parses the string argument as a signed decimal integer. var mthIdx = parseInt(month); var endday = getDaysInMonth(mthIdx, year) //month header calendar +="" //writes in the day of the week labels calendar +="" calendar +="" calendar +="" calendar +="" calendar +="" calendar +="" calendar +="" calendar +="" calendar +="" wholeDate = month + "/01/" + year thedate = new Date(wholeDate) firstDay = thedate.getDay() selectedmonth = mthIdx; var today = new Date(); var thisyear = today.getYear() + 1900; selectedyear = year var lastDay = (endday + firstDay+1) calendar +="" for (var i = 1; i < lastDay; i++) { if (i <= firstDay) { // 'empty' boxes prior to first day calendar +="" } else { // enter date number calendar +="" } //must start new row after each week if (i % 7 == 0 && i != lastDay) { calendar +="" } } calendar +="" //separator line calendar +="" //next month and previous month buttons var goPrevMonth = prevMonth(mthIdx) var goNextMonth = nextMonth(mthIdx) var nextYear = changeYear("next",parseInt(month),parseInt(year)) var prevYear = changeYear("prev",parseInt(month),parseInt(year)) if(navigator.userAgent.indexOf('MSIE',0) != -1) { calendar +="" calendar +="" calendar +="" calendar +="
" var index = (mthIdx-1) calendar +="" + monthName[index] + " " + year + "
S M T W T F S
"+(i-firstDay)+"

Prev Next
" target.document.close() } else { calendar +="" calendar +=" " calendar +="" calendar +="" } target.document.write(calendar); target.document.close() } function closeCalendar(day) { var yrIdx = parseYear(selectedyear,document.theForm.selYear ); // Decrement index for day and month, because code assumes // that we have an extra defaultvalue at the start. document.theForm.selMonth.options.selectedIndex=selectedmonth-1; document.theForm.selYear.options.selectedIndex= yrIdx; document.theForm.selDay.options.selectedIndex=parseInt(day)-1; }