function TimePickerClient(id, hoursDropDownId, minutesDropDownId, onClientChange) { /* -- PROPERTIES -- */ this.Id = id; this.HoursDropDownId = hoursDropDownId; this.MinutesDropDownId = minutesDropDownId; this.OnClientChange = onClientChange; } /* -- Methods -- */ // GetMinutesValue (return: integer) TimePickerClient.prototype.GetMinutesValue = function() { var oMinutesDropDown = document.getElementById(this.MinutesDropDownId); return parseInt(oMinutesDropDown.options[oMinutesDropDown.selectedIndex].value); } // GetHoursValue (return: integer between 0 and 23) TimePickerClient.prototype.GetHoursValue = function() { var oHoursDropDown = document.getElementById(this.HoursDropDownId); return oHoursDropDown.selectedIndex; } // GetDate (return: date) TimePickerClient.prototype.GetDate = function() { var minutes = this.GetMinutesValue(); var hours = this.GetHoursValue(); return new Date(0, 0, 0, hours, minutes, 0, 0); } // GetTime (return: integer) TimePickerClient.prototype.GetTime = function() { var date = this.GetDate(); return date.getTime(); //milliseconds } // CallClientFunction (return: Void) TimePickerClient.prototype.CallClientFunction = function() { if (this.OnClientChange.length > 0) { eval(this.OnClientChange + "();"); } } /* -- EVENTS -- */ // DropDownChanged (return: Void) TimePickerClient.prototype.DropDownChanged = function() { this.CallClientFunction(); } /* -- STAND ALONE METHODS -- */ function findTimePickerClient(id) { for (var i = 0; i < aTimePickerClientArray.length; i++) { if (aTimePickerClientArray[i].Id == id) { return aTimePickerClientArray[i]; } } } /* -- EVENT HANDLERS -- */ function timePickerClientOnDropDownValueChanged(id) { findTimePickerClient(id).DropDownChanged(); }