function DateComboControl(strControlName, strInitialDate, strStartYear, strEndYear)
{
	// ----------- Enum Declarations ---------------------------------------------
	
	this.MM		=	1	;
	this.DD		=	2	;
	this.YYYY	=	3	;
	this.M		=	4	;
	this.D		=	5	;
	this.YY		=	6	;
	this.MMM	=	7	;
	this.MMMM	=	8	;
	
	this.DISPLAY_ORDER_MONTH_DAY_YEAR	=	1	;
	this.DISPLAY_ORDER_DAY_MONTH_YEAR	=	2	;
	this.DISPLAY_ORDER_YEAR_MONTH_DAY	=	3	;
	
	this.DATE_YYYY_MM_DD	=	DATE_YYYY_MM_DD		;
	this.DATE_MM_DD_YYYY	=	DATE_MM_DD_YYYY		;
	this.DATE_DD_MM_YYYY	=	DATE_DD_MM_YYYY		;
	
	// ----------- Class Properties ----------------------------------------------
	
	this.controlName = strControlName ;
	
	this.yearFormat = this.YYYY ;
	this.monthFormat = this.MMM ;
	this.dayFormat = this.D ;
	
	this.displayOrder = this.DISPLAY_ORDER_MONTH_DAY_YEAR ;
	
	this.startYear = strStartYear ;
	this.endYear = strEndYear ;
	
	this.yearCSSClass = "" ;
	this.monthCSSClass = "" ;
	this.dayCSSClass = "" ;
	
	this.yearStyleAttribute = "" ;
	this.monthStyleAttribute = "" ;
	this.dayStyleAttribute = "" ;
	
	this.showSelectionPrompt = true ;
	this.yearSelectPrompt = "Year" ;
	this.monthSelectPrompt = "Month" ;
	this.daySelectPrompt = "Day" ;
	
	this.returnDateFormat = this.DATE_YYYY_MM_DD ;
	
	// ----------- Class Methods --------------------------------------
	
	this.drawControl = drawControl ;
	this.getSelectedDate = getSelectedDate ;
	this.setDate = setDate ;
	
	// ----------- Private Members ------------------------------------
	
	var objDayCombo, objYearCombo, objMonthCombo, objHiddenDateField ;
	
	var months = new Array() ;
	months[1] = new Array("01", "1", "01", "Jan", "January") ;
	months[2] = new Array("02", "2", "02", "Feb", "February") ;
	months[3] = new Array("03", "3", "03", "Mar", "March") ;
	months[4] = new Array("04", "4", "04", "Apr", "April") ;
	months[5] = new Array("05", "5", "05", "May", "May") ;
	months[6] = new Array("06", "6", "06", "Jun", "June") ;
	months[7] = new Array("07", "7", "07", "Jul", "July") ;
	months[8] = new Array("08", "8", "08", "Aug", "August") ;
	months[9] = new Array("09", "9", "09", "Sep", "September") ;
	months[10] = new Array("10", "10", "10", "Oct", "October") ;
	months[11] = new Array("11", "11", "11", "Nov", "November") ;
	months[12] = new Array("12", "12", "12", "Dec", "December") ;
	
	var days = new Array() ;
	days[1] = new Array("01", "1", "01") ;
	days[2] = new Array("02", "2", "02") ;
	days[3] = new Array("03", "3", "03") ;
	days[4] = new Array("04", "4", "04") ;
	days[5] = new Array("05", "5", "05") ;
	days[6] = new Array("06", "6", "06") ;
	days[7] = new Array("07", "7", "07") ;
	days[8] = new Array("08", "8", "08") ;
	days[9] = new Array("09", "9", "09") ;
	days[10] = new Array("10", "10", "10") ;
	days[11] = new Array("11", "11", "11") ;
	days[12] = new Array("12", "12", "12") ;
	days[13] = new Array("13", "13", "13") ;
	days[14] = new Array("14", "14", "14") ;
	days[15] = new Array("15", "15", "15") ;
	days[16] = new Array("16", "16", "16") ;
	days[17] = new Array("17", "17", "17") ;
	days[18] = new Array("18", "18", "18") ;
	days[19] = new Array("19", "19", "19") ;
	days[20] = new Array("20", "20", "20") ;
	days[21] = new Array("21", "21", "21") ;
	days[22] = new Array("22", "22", "22") ;
	days[23] = new Array("23", "23", "23") ;
	days[24] = new Array("24", "24", "24") ;
	days[25] = new Array("25", "25", "25") ;
	days[26] = new Array("26", "26", "26") ;
	days[27] = new Array("27", "27", "27") ;
	days[28] = new Array("28", "28", "28") ;
	days[29] = new Array("29", "29", "29") ;
	days[30] = new Array("30", "30", "30") ;
	days[31] = new Array("31", "31", "31") ;
	
	// ----------- Private Functions ----------------------------------------------
	
	function dateComboControl_onChange()
	{
		objHiddenDateField.value = getSelectedDate() ;
	}

	// ----------- Class Method Definitions ---------------------------------------

	function drawControl()
	{
		var strExec, nStartYear, nEndYear, strDrawControlCode, i, j ;

		strDrawControlCode = "" ;
		switch(this.displayOrder)
		{
			case this.DISPLAY_ORDER_MONTH_DAY_YEAR	:

				strDrawControlCode = "<select name=\"cmb" + strControlName + "Month\" class=\"" + this.monthCSSClass + "\" style=\"" + this.monthStyleAttribute + "\"></select>\n" +
									 "<select name=\"cmb" + strControlName + "Day\" class=\"" + this.dayCSSClass + "\" style=\"" + this.dayStyleAttribute + "\"></select>\n" +
									 "<select name=\"cmb" + strControlName + "Year\" class=\"" + this.yearCSSClass + "\" style=\"" + this.yearStyleAttribute + "\"></select>\n" ;
				break ;
			
			case this.DISPLAY_ORDER_DAY_MONTH_YEAR	:

				strDrawControlCode = "<select name=\"cmb" + strControlName + "Day\" class=\"" + this.dayCSSClass + "\" style=\"" + this.dayStyleAttribute + "\"></select>\n" +
									 "<select name=\"cmb" + strControlName + "Month\" class=\"" + this.monthCSSClass + "\" style=\"" + this.monthStyleAttribute + "\"></select>\n" +
									 "<select name=\"cmb" + strControlName + "Year\" class=\"" + this.yearCSSClass + "\" style=\"" + this.yearStyleAttribute + "\"></select>\n" ;
				break ;
				
			case this.DISPLAY_ORDER_YEAR_MONTH_DAY	:

				strDrawControlCode = "<select name=\"cmb" + strControlName + "Year\" class=\"" + this.yearCSSClass + "\" style=\"" + this.yearStyleAttribute + "\"></select>\n" +
									 "<select name=\"cmb" + strControlName + "Month\" class=\"" + this.monthCSSClass + "\" style=\"" + this.monthStyleAttribute + "\"></select>\n" +
									 "<select name=\"cmb" + strControlName + "Day\" class=\"" + this.dayCSSClass + "\" style=\"" + this.dayStyleAttribute + "\"></select>\n" ;
				break ;								 
			
			default		:		throw("invalid value assigned to 'displayOrder' property of DateComboControl") ;
		}

		strDrawControlCode += "<input type=hidden name=\"" + strControlName + "\" value=\"\">\n" ;
		document.write(strDrawControlCode) ;
		
		strExec = "objMonthCombo = document.all.cmb" + strControlName + "Month ;" ;
		eval(strExec) ;
		
		strExec = "objDayCombo = document.all.cmb" + strControlName + "Day ;" ;
		eval(strExec) ;
		
		strExec = "objYearCombo = document.all.cmb" + strControlName + "Year ;" ;
		eval(strExec) ;
		
		strExec = "objHiddenDateField = document.all." + strControlName + " ;" ;
		eval(strExec) ;

		switch(this.monthFormat)
		{
			case this.M		:	j = 1 ; break ;
			case this.MM	:	j = 2 ; break ;
			case this.MMM	:	j = 3 ; break ;
			case this.MMMM	:	j = 4 ; break ;
			default			:	throw("invalid value assigned to 'monthFormat' property of DateComboControl") ;
		}
		
		for (i = 1 ; i < months.length ; i++)
		{
			objMonthCombo.options[i] = new Option(months[i][j], months[i][0]) ;
		}

		switch(this.dayFormat)
		{
			case this.D		:	j = 1 ; break ;
			case this.DD	:	j = 2 ; break ;
			default			:	throw("invalid value assigned to 'dayFormat' property of DateComboControl") ;
		}

		for (i = 1 ; i < days.length ; i++)
		{
			objDayCombo.options[i] = new Option(days[i][j], days[i][0]) ;
		}
		
		i = 1 ;
		nStartYear = parseInt(this.startYear, 10) ;
		nEndYear = parseInt(this.endYear, 10) ;
		while ( nStartYear <= nEndYear )
		{
			objYearCombo.options[i] = new Option(nStartYear, nStartYear) ;
			i++ ;
			nStartYear++ ;
		}
		
		if (this.showSelectionPrompt)
		{
			objMonthCombo.options[0].value = "00" ;
			objMonthCombo.options[0].text = this.monthSelectPrompt ;
			objDayCombo.options[0].value = "00" ;
			objDayCombo.options[0].text = this.daySelectPrompt ;
			objYearCombo.options[0].value = "0000" ;
			objYearCombo.options[0].text = this.yearSelectPrompt ;
		}
		else
		{
			objMonthCombo.options[0] = null ;
			objDayCombo.options[0] = null ;
			objYearCombo.options[0] = null ;
		}
		
		objYearCombo.attachEvent("onchange", dateComboControl_onChange) ;
		objMonthCombo.attachEvent("onchange", dateComboControl_onChange) ;
		objDayCombo.attachEvent("onchange", dateComboControl_onChange) ;

		this.setDate(strInitialDate);
		
	}
	
	function setDate(strNewDate, nDateFormat)
	{
		var strYear, strMonth, strDay, nYear, nMonth, nDay, arrDate, blYearFound ;
		
		if ( strNewDate == null | strNewDate == "" )
		{
			if (this.showSelectionPrompt)
			{
				objDayCombo.selectedIndex = 0 ;
				objMonthCombo.selectedIndex = 0 ;
				objYearCombo.selectedIndex = 0 ;
				objHiddenDateField.value = getSelectedDate(this.returnDateFormat) ;
			}
			return ;
		}
		
		//if ( !isDate(strNewDate, nDateFormat) )
		//	return ;
		
		arrDate = strNewDate.split("/") ;
	
		switch(nDateFormat)
		{
			case this.DATE_YYYY_MM_DD	:	strYear = arrDate[0] ; strMonth = arrDate[1] ; strDay = arrDate[2] ;
									break ;
					
			case this.DATE_MM_DD_YYYY	:	strYear = arrDate[2] ; strMonth = arrDate[0] ; strDay = arrDate[1] ;
									break ;
					
			case this.DATE_DD_MM_YYYY	:	strYear = arrDate[2] ; strMonth = arrDate[1] ; strDay = arrDate[0] ;
									break ;
					
			default				:	strYear = arrDate[0] ; strMonth = arrDate[1] ; strDay = arrDate[2] ;
									break ;
		}
		
		nYear = parseInt(strYear, 10) ;
		nMonth = parseInt(strMonth, 10) ;
		nDay = parseInt(strDay, 10) ;
	
		nYear = isNaN(nYear)? 0 : nYear ;
		nMonth = isNaN(nMonth)? 0 : nMonth ;
		nDay = isNaN(nDay)? 0 : nDay ;
		
		blYearFound = false ;
		for (i = 0 ; i < objYearCombo.length ; i++)
		{
			if ( objYearCombo.options[i].value == strYear )
			{
				objYearCombo.selectedIndex = i ;
				blYearFound = true ;
				break ;
			}
		}
		
		if ( blYearFound )
		{
			for (i = 0 ; i < objMonthCombo.length ; i++)
			{
				if ( parseInt(objMonthCombo.options[i].value, 10) == nMonth )
				{
					objMonthCombo.selectedIndex = i ;
					break ;
				}
			}
			
			for (i = 0 ; i < objDayCombo.length ; i++)
			{
				if ( parseInt(objDayCombo.options[i].value, 10) == nDay )
				{
					objDayCombo.selectedIndex = i ;
					break ;
				}
			}
		}
		
		objHiddenDateField.value = this.getSelectedDate(this.returnDateFormat) ;
	}
	
	
	function getSelectedDate(nDateFormat)
	{
		var strSelectedDate, strSelectedYear, strSelectedMonth, strSelectedDay ;
		
		strSelectedYear = objYearCombo.options[objYearCombo.selectedIndex].value ;
		strSelectedMonth = objMonthCombo.options[objMonthCombo.selectedIndex].value ;
		strSelectedDay = objDayCombo.options[objDayCombo.selectedIndex].value ;
		
		if (strSelectedYear == "0000" && strSelectedMonth == "00" && strSelectedDay == "00")
		{
			strSelectedDate =  "" ;
		}
		else
		{
			switch(nDateFormat)
			{
				case this.DATE_YYYY_MM_DD	:	strSelectedDate = strSelectedYear + "/" + strSelectedMonth + "/" + strSelectedDay ;
												break ;
				
				case this.DATE_MM_DD_YYYY	:	strSelectedDate = strSelectedMonth + "/" + strSelectedDay + "/" + strSelectedYear ;
												break ;
				
				case this.DATE_DD_MM_YYYY	:	strSelectedDate = strSelectedDay + "/" + strSelectedMonth + "/" + strSelectedYear ;
												break ;
				
				default						:	strSelectedDate = strSelectedYear + "/" + strSelectedMonth + "/" + strSelectedDay ;
												break ;
			}
			
		}
		
		return strSelectedDate ;
	}

	// ----------- Initialisation ------------------------------------------------
	
	if ( strControlName == null )
	{
		throw("Control Name for DateComboControl is invalid") ;
	}
		
	var strYearFormat = "^ *$|^[1-9]{1}[0-9]{3}$" ;
	objRegExp = new RegExp(strYearFormat) ;
		
	if ( strStartYear == null )
		this.startYear = "1990" ;
	else if ( isEmpty(strStartYear) )
		this.startYear = "1990" ;
	else if ( !objRegExp.test(strStartYear) )
		this.startYear = "1990" ;
	else
		this.startYear = strStartYear ;
		
	if ( parseInt(this.startYear, 10) < 1900 )
		this.startYear = "1900" ;
		
	if ( strEndYear == null )
		this.endYear = "2010" ;
	else if ( isEmpty(strEndYear) )
		this.endYear = "2010" ;
	else if ( !objRegExp.test(strEndYear) )
		this.endYear = "2010" ;
	else
		this.endYear = strEndYear ;
		
	if ( parseInt(this.endYear, 10) < 1900 )
		this.endYear = "1900" ;
	
	if ( parseInt(this.startYear, 10) > parseInt(this.endYear, 10) )
		this.endYear = this.startYear ;
		
}


function TimeComboControl(strControlName, strInitialTime, strSeparator)
{

	// ----------- Enum Declarations ---------------------------------------------

	this.TIME_FORMAT_12_HOUR = 101 ;
	this.TIME_FORMAT_24_HOUR = 102 ;
	
	this.HH = 202 ;
	this.MM = 203 ;
	this.SS = 204 ;
	this.H = 205 ;
	this.M = 206 ;
	this.S = 207 ;
	
	// ----------- Class Properties ----------------------------------------------
	
	this.controlName = strControlName ;

	this.hoursFormat = this.HH ;
	this.minutesFormat = this.MM ;
	this.secondsFormat = this.SS ;
	
	this.hoursCSSClass = "" ;
	this.minutesCSSClass = "" ;
	this.secondsCSSClass = "" ;
	this.AM_PM_CSSClass = "" ;
	
	this.hoursStyleAttribute = "" ;
	this.minutesStyleAttribute = "" ;
	this.secondsStyleAttribute = "" ;
	this.AM_PM_StyleAttributes = "" ;

	this.timeFormat = this.TIME_FORMAT_12_HOUR ;
	this.separator = ":" ;
	this.displaySeconds = false ;
	this.minutesInterval = 1 ;

	this.showSelectionPrompt = false ;
	this.hoursSelectPrompt = "HH" ;
	this.minutesSelectPrompt = "MM" ;
	this.secondsSelectPrompt = "SS" ;
	
	// ----------- Class Methods -------------------------------------------------
	
	this.setTime = setTime ;
	this.getSelectedTime = getSelectedTime ;
	this.drawControl = drawControl ;
	
	// ----------- Private Members -----------------------------------------------
	
	var objHoursCombo, objMinutesCombo, objSecondsCombo, objAMPMCombo, objHiddenTimeField ;
	
	var hours = new Array() ;
	hours[0] = new Array("00", "0", "00") ;
	hours[1] = new Array("01", "1", "01") ;
	hours[2] = new Array("02", "2", "02") ;
	hours[3] = new Array("03", "3", "03") ;
	hours[4] = new Array("04", "4", "04") ;
	hours[5] = new Array("05", "5", "05") ;
	hours[6] = new Array("06", "6", "06") ;
	hours[7] = new Array("07", "7", "07") ;
	hours[8] = new Array("08", "8", "08") ;
	hours[9] = new Array("09", "9", "09") ;
	hours[10] = new Array("10", "10", "10") ;
	hours[11] = new Array("11", "11", "11") ;
	hours[12] = new Array("12", "12", "12") ;
	hours[13] = new Array("13", "13", "13") ;
	hours[14] = new Array("14", "14", "14") ;
	hours[15] = new Array("15", "15", "15") ;
	hours[16] = new Array("16", "16", "16") ;
	hours[17] = new Array("17", "17", "17") ;
	hours[18] = new Array("18", "18", "18") ;
	hours[19] = new Array("19", "19", "19") ;
	hours[20] = new Array("20", "20", "20") ;
	hours[21] = new Array("21", "21", "21") ;
	hours[22] = new Array("22", "22", "22") ;
	hours[23] = new Array("23", "23", "23") ;
	hours[24] = new Array("24", "24", "24") ;
	
	var minsecs = new Array() ;
	minsecs[0] = new Array("00", "0", "00") ;
	minsecs[1] = new Array("01", "1", "01") ;
	minsecs[2] = new Array("02", "2", "02") ;
	minsecs[3] = new Array("03", "3", "03") ;
	minsecs[4] = new Array("04", "4", "04") ;
	minsecs[5] = new Array("05", "5", "05") ;
	minsecs[6] = new Array("06", "6", "06") ;
	minsecs[7] = new Array("07", "7", "07") ;
	minsecs[8] = new Array("08", "8", "08") ;
	minsecs[9] = new Array("09", "9", "09") ;
	minsecs[10] = new Array("10", "10", "10") ;
	minsecs[11] = new Array("11", "11", "11") ;
	minsecs[12] = new Array("12", "12", "12") ;
	minsecs[13] = new Array("13", "13", "13") ;
	minsecs[14] = new Array("14", "14", "14") ;
	minsecs[15] = new Array("15", "15", "15") ;
	minsecs[16] = new Array("16", "16", "16") ;
	minsecs[17] = new Array("17", "17", "17") ;
	minsecs[18] = new Array("18", "18", "18") ;
	minsecs[19] = new Array("19", "19", "19") ;
	minsecs[20] = new Array("20", "20", "20") ;
	minsecs[21] = new Array("21", "21", "21") ;	
	minsecs[22] = new Array("22", "22", "22") ;
	minsecs[23] = new Array("23", "23", "23") ;	
	minsecs[24] = new Array("24", "24", "24") ;
	minsecs[25] = new Array("25", "25", "25") ;	
	minsecs[26] = new Array("26", "26", "26") ;
	minsecs[27] = new Array("27", "27", "27") ;	
	minsecs[28] = new Array("28", "28", "28") ;
	minsecs[29] = new Array("29", "29", "29") ;	
	minsecs[30] = new Array("30", "30", "30") ;	
	minsecs[31] = new Array("31", "31", "31") ;	
	minsecs[32] = new Array("32", "32", "32") ;	
	minsecs[33] = new Array("33", "33", "33") ;	
	minsecs[34] = new Array("34", "34", "34") ;	
	minsecs[35] = new Array("35", "35", "35") ;	
	minsecs[36] = new Array("36", "36", "36") ;	
	minsecs[37] = new Array("37", "37", "37") ;	
	minsecs[38] = new Array("38", "38", "38") ;	
	minsecs[39] = new Array("39", "39", "39") ;	
	minsecs[40] = new Array("40", "40", "40") ;	
	minsecs[41] = new Array("41", "41", "41") ;	
	minsecs[42] = new Array("42", "42", "42") ;	
	minsecs[43] = new Array("43", "43", "43") ;	
	minsecs[44] = new Array("44", "44", "44") ;	
	minsecs[45] = new Array("45", "45", "45") ;	
	minsecs[46] = new Array("46", "46", "46") ;	
	minsecs[47] = new Array("47", "47", "47") ;	
	minsecs[48] = new Array("48", "48", "48") ;	
	minsecs[49] = new Array("49", "49", "49") ;	
	minsecs[50] = new Array("50", "50", "50") ;	
	minsecs[51] = new Array("51", "51", "51") ;	
	minsecs[52] = new Array("52", "52", "52") ;	
	minsecs[53] = new Array("53", "53", "53") ;	
	minsecs[54] = new Array("54", "54", "54") ;	
	minsecs[55] = new Array("55", "55", "55") ;	
	minsecs[56] = new Array("56", "56", "56") ;	
	minsecs[57] = new Array("57", "57", "57") ;	
	minsecs[58] = new Array("58", "58", "58") ;	
	minsecs[59] = new Array("59", "59", "59") ;	

	// ----------- Private Functions ---------------------------------------------
	function timeComboControl_onChange()
	{
		objHiddenTimeField.value = getSelectedTime() ;
	}
	
	// ----------- Class Method Definitions --------------------------------------
	
	function drawControl()
	{
		var strExec, strDrawControlCode, i, j ;
		
		strDrawControlCode = "" ;
		
		strDrawControlCode = "<select name=\"cmb" + strControlName + "Hours\" class=\"" + this.hoursCSSClass + "\" style=\"" + this.hoursStyleAttribute + "\"></select> :\n" +
							 "<select name=\"cmb" + strControlName + "Minutes\" class=\"" + this.minutesCSSClass + "\" style=\"" + this.minutesStyleAttribute + "\"></select>\n" ;
		if ( this.displaySeconds )
			strDrawControlCode += ": <select name=\"cmb" + strControlName + "Seconds\" class=\"" + this.secondsCSSClass + "\" style=\"" + this.secondsStyleAttribute + "\"></select>\n" ;
		
		if ( this.timeFormat == this.TIME_FORMAT_12_HOUR )
			strDrawControlCode += "&nbsp;&nbsp;<select name=\"cmb" + strControlName + "AMPM\" class=\"" + this.AM_PM_CSSClass + "\" style=\"" + this.AM_PM_StyleAttribute + "\"></select>\n" ;
		
		strDrawControlCode += "<input type=hidden name=\"" + strControlName + "\" value=\"\">\n" ;
		
		document.write(strDrawControlCode) ;
		
		strExec = "objHoursCombo = document.all.cmb" + strControlName + "Hours ;" ;
		eval(strExec) ;

		strExec = "objMinutesCombo = document.all.cmb" + strControlName + "Minutes ;" ;
		eval(strExec) ;

		strExec = "objHiddenTimeField = document.all." + strControlName + " ;" ;
		eval(strExec) ;

		if ( this.displaySeconds )
		{
			strExec = "objSecondsCombo = document.all.cmb" + strControlName + "Seconds ;" ;
			eval(strExec) ;
		}
		
		if ( this.timeFormat == this.TIME_FORMAT_12_HOUR )
		{
			strExec = "objAMPMCombo = document.all.cmb" + strControlName + "AMPM ;" ;
			eval(strExec) ;
		}
		
		switch(this.hoursFormat)
		{
			case this.H		:	j = 1 ; break ;
			case this.HH	:	j = 2 ; break ;
			default			:	throw("invalid value assigned to 'hoursFormat' property of DateComboControl") ;
		}

		if ( this.timeFormat == this.TIME_FORMAT_12_HOUR )
		{
			objAMPMCombo.options[0] = new Option("AM", "AM") ;
			objAMPMCombo.options[1] = new Option("PM", "PM") ;
		}
		
		if ( this.timeFormat == this.TIME_FORMAT_12_HOUR )
		{
			for (i = 1 ; i <= 12 ; i++)
			{
				objHoursCombo.options[i] = new Option(hours[i][j], hours[i][0]) ;
			}
		}
		else if ( this.timeFormat == this.TIME_FORMAT_24_HOUR )
		{
			for (i = 0 ; i < 24 ; i++)
			{
				objHoursCombo.options[i+1] = new Option(hours[i][j], hours[i][0]) ;
			}
		}
				
		switch(this.minutesFormat)
		{
			case this.M		:	j = 1 ; break ;
			case this.MM	:	j = 2 ; break ;
			default			:	throw("invalid value assigned to 'minutesFormat' property of DateComboControl") ;
		}

		objMinutesCombo.options[0]=new Option("00", "00")
		for (i = 0 ; i < 60 ; i = i + this.minutesInterval)
		{
			//objMinutesCombo.options[i+1] = new Option(minsecs[i][j], minsecs[i][0]) ;
			objMinutesCombo.options[objMinutesCombo.options.length] = new Option(minsecs[i][j], minsecs[i][0]) ;
		}
		
		if ( this.displaySeconds )
		{
			switch(this.secondsFormat)
			{
				case this.S		:	j = 1 ; break ;
				case this.SS	:	j = 2 ; break ;
				default		:	throw("invalid value assigned to 'secondsFormat' property of DateComboControl") ;
			}

			for (i = 0 ; i < 60 ; i++)
			{
				objSecondsCombo.options[i+1] = new Option(minsecs[i][j], minsecs[i][0]) ;
			}
		}

		if (this.showSelectionPrompt)
		{
			objHoursCombo.options[0].value = "" ;
			objHoursCombo.options[0].text = this.hoursSelectPrompt ;
			objMinutesCombo.options[0].value = "" ;
			objMinutesCombo.options[0].text = this.minutesSelectPrompt ;
			if ( this.displaySeconds )
			{
				objSecondsCombo.options[0].value = "" ;
				objSecondsCombo.options[0].text = this.secondsSelectPrompt ;
			}
		}
		else
		{
			objHoursCombo.options[0] = null ;
			objMinutesCombo.options[0] = null ;
			if ( this.displaySeconds )
				objSecondsCombo.options[0] = null ;
		}
		
		objHoursCombo.attachEvent("onchange", timeComboControl_onChange) ;
		objMinutesCombo.attachEvent("onchange", timeComboControl_onChange) ;
		if ( this.displaySeconds )
			objSecondsCombo.attachEvent("onchange", timeComboControl_onChange) ;
		if ( this.timeFormat == this.TIME_FORMAT_12_HOUR )
			objAMPMCombo.attachEvent("onchange", timeComboControl_onChange) ;
			
		
		this.setTime(strInitialTime) ;	
	}
	
	function setTime(strNewTime)
	{
		var arrTemp, strHours, strMinutes, strSeconds, nHours, nMinutes, nSeconds, strAM_PM ;
		
		arrTemp = strNewTime.split(":") ;
		
		strHours = arrTemp[0] ;
		strMinutes = arrTemp[1] ;
		strSeconds = arrTemp[2] ;
		
		nHours = parseInt(strHours, 10) ;
		nMinutes = parseInt(strMinutes, 10) ;
		nSeconds = parseInt(strSeconds, 10) ;
	
		nHours = isNaN(nHours)? 0 : nHours ;
		nMinutes = isNaN(nMinutes)? 0 : nMinutes ;
		nSeconds = isNaN(nSeconds)? 0 : nSeconds ;
//		alert(nHours) ; alert(nMinutes) ; alert(nSeconds);
		if ( this.timeFormat == this.TIME_FORMAT_12_HOUR )
		{
//			alert("") ;
			if ( nHours == 0 )
			{
				nHours = 12 ;
				strAM_PM = "AM" ;
			}
			else if ( nHours == 12 )
			{
				nHours = 12 ;
				strAM_PM = "PM" ;
			}
			else if ( nHours > 12 )
			{
				nHours = nHours - 12 ;
				strAM_PM = "PM" ;
			}
			else if ( nHours < 12 )
			{
				strAM_PM = "AM" ;
			}
		}
		
		for ( var i = 0 ; i < objHoursCombo.length ; i++ )
		{
			if ( parseInt(objHoursCombo.options[i].value, 10) == nHours )
			{
				objHoursCombo.selectedIndex = i ;
				break ;
			}
		}

		for ( var i = 0 ; i < objMinutesCombo.length ; i++ )
		{
			if ( parseInt(objMinutesCombo.options[i].value, 10) == nMinutes )
			{
				objMinutesCombo.selectedIndex = i ;
				break ;
			}
		}
		
		if ( this.displaySeconds )
		{
			for ( var i = 0 ; i < objSecondsCombo.length ; i++ )
			{
				if ( parseInt(objSecondsCombo.options[i].value, 10) == nSeconds )
				{
					objSecondsCombo.selectedIndex = i ;
					break ;
				}
			}
		}
		
		if ( this.timeFormat == this.TIME_FORMAT_12_HOUR )
		{
			for ( var i = 0 ; i < objAMPMCombo.length ; i++ )
			{
				if ( objAMPMCombo.options[i].value == strAM_PM )
				{
					objAMPMCombo.selectedIndex = i ;
					break ;
				}
			}
		}
		
		objHiddenTimeField.value = this.getSelectedTime() ;
	}
	
	function getSelectedTime()
	{
		var strSelectedTime, strSelectedHour, strSelectedMinute, strSelectedSecond ;
		
		strSelectedHour = objHoursCombo.options[objHoursCombo.selectedIndex].value ;
		if ( objAMPMCombo != null )
		{
			if ( objAMPMCombo.options[objAMPMCombo.selectedIndex].value == "PM" && strSelectedHour != "12" )
			{
				strSelectedHour = parseInt(strSelectedHour, 10) + 12 ;
			}
			if ( objAMPMCombo.options[objAMPMCombo.selectedIndex].value == "AM" && strSelectedHour == "12" )
			{
				strSelectedHour = "00" ;
			}
		}
		
		strSelectedMinute = objMinutesCombo.options[objMinutesCombo.selectedIndex].value ;
		if ( objSecondsCombo != null )
			strSelectedSecond = objSecondsCombo.options[objSecondsCombo.selectedIndex].value ;
		else
			strSelectedSecond = "00" ;
		
		if ( (objSecondsCombo != null && strSelectedHour == "" && strSelectedMinute == "" && strSelectedSecond == "") ||
			 (objSecondsCombo == null && strSelectedHour == "" && strSelectedMinute == "") )
		{
			strSelectedTime = "" ;
		}
		else
		{
			strSelectedTime = strSelectedHour + ":" + strSelectedMinute + ":" + strSelectedSecond ;
		}
		
		return strSelectedTime ;
	}
	
	// ----------- Initialisation ------------------------------------------------------------------------------------
	
}
