Control.DatePicker.sanitizeTime = function(elemId)
{
	time = $F(elemId);

	verif = /^([0-2][0-9]):([0-5][0-9])/.test(time);

	if(verif === false)
	{
		timeInfo = time.split(':');

		switch(timeInfo.size())
		{
			case 1 :
				tmpTime = parseInt(time);
				tmpTime = tmpTime+'';
	
				if(tmpTime.blank())
				{
					hour = '12';
					min = '00';
				}
				else
				{
					if(tmpTime.length > 3)
					{
						hour = tmpTime.substr(0, 2);
						min = tmpTime.substr(2, 2);
					}
					else if(tmpTime.length > 2)
					{
						hour = '0'+tmpTime.substr(0, 1);
						min = tmpTime.substr(1, 2);
					}
					else
					{
						hour = tmpTime.substr(0, tmpTime.length);
						if(hour.length < 2) hour = '0' + hour;
						if(hour == '0') hour = '00';
						min = '00';
					}
				}
			break;

			default:
				hour = timeInfo[0];
				min = timeInfo[1];

				hour = parseInt(hour);
				hour = hour+'';

				min = parseInt(min);
				min = min+'';

				hour = (hour.length > 1) ? hour.substr(0, 2) : hour = '0' + hour.substr(0, hour.length);
				min = (min.length > 1) ? min.substr(0, 2) : min = '0' + min.substr(0, 2);
			break;


		}

		verifHour = /^([0-2][0-9])/.test(hour);
		if(verifHour === false) hour = '12';


		verifMin = /^([0-5][0-9])/.test(min);
		if(verifMin === false) min = '00';
	}
	else
	{
		timeInfo = time.substr(0,5).split(':');

		hour = timeInfo[0];
		min = timeInfo[1];
	}

	if(parseInt(hour) > 23) hour = '23';

	time = hour+':'+min;

	$(elemId).value = time;
}
