// form2.js
function timeToTwelve(vIn,vDir)
{ 
	var vHour, vMin, vTime, vTimePart; 
	if (parseInt(vIn.substr(0,2)) >= 12) 
	{ 
		vMin = vIn.substr(3,2);
		vTimePart = "pm";
		if (parseInt(vIn.substr(0,2)) > 12) 
			{ vHour = parseInt(vIn.substr(0,2)) - 12; } else { vHour = parseInt(vIn.substr(0,2)); } 
		vTime = vHour + ":" + vMin;
		if (vTime.length < 5 && vTime.charAt(1) == ":") 
			{ vTime = "0" + vTime; } 
	} else { 
		vTime = vIn;
		vTimePart = "am";
	} 
	if (vDir == "FROM")
	{ 
		document.details.slFromTime.value = vTime;
		document.details.slFromTimePart.value = vTimePart;
	} else if (vDir == "TO") { 
		document.details.slToTime.value = vTime;
		document.details.slToTimePart.value = vTimePart;
	} 
}