<!--

function MoveFocus(objInput, intLen, strNextField)
{
	if(objInput.value.length == intLen){
		oElement = document.getElementById(strNextField);
		if (oElement)
		{
			oElement.focus();
		}
	}
	return true;
}

function ConvertTime(oForm) {

	convInd  = oForm.convtype.value;
	minutes  = oForm.minutes.value;
	seconds  = oForm.seconds.value;
	hundreds = oForm.hundreds.value;
	multiplier = 0;
	divisor = 0;
	
	if (minutes == "" || minutes == " ") {
		minutes = 0;
	}

	if (!isInteger(minutes)) {
		alert("Invalid value in Minutes field.");
		return false;
	}

	if (!isInteger(seconds)) {
		alert("Invalid value in Seconds field.");
		return false;
	}

	if (!isInteger(hundreds)) {
		alert("Invalid value in Hundreds field.");
		return false;
	}

	convInd  = parseInt(convInd);
	minutes  = parseInt(minutes);
	seconds  = parseInt(seconds);
	hundreds = parseInt(hundreds);
	
	switch(convInd) {
		case 1:
			multiplier = 1;
			divisor = .9144;
			break;
		case 2:
			multiplier = .9144;
			divisor = 1;
			break;
		case 3:
			multiplier = 1;
			divisor = 1.2000;
			break;
		case 4:
			multiplier = 1.2000;
			divisor = 1;
			break;
		default:
			multiplier = 1;
			divisor = 1;
			break;
	}

	timeInSecs = ((minutes * 60) + seconds + (hundreds / 100)) * multiplier / divisor;

	document.getElementById('result').innerHTML = "<h1>" + FormatTime(timeInSecs) + "</h1>";
	
	return false; /* So that the form isn't actually submitted */
}

function FormatTime (timeInSecs)
{
	if (timeInSecs >= 60.00) {
		minutes = parseInt(timeInSecs / 60);
	} else {
		minutes = 0;
	}
	
	secWithHund = (parseInt((timeInSecs - (minutes * 60)) * 100, 10) / 100) + "";

	temp = secWithHund.split('.');
	seconds = PadDigits(temp[0], 2);
	
	if (temp[1] == undefined) {
		hundreds = "00";
	} else {
		hundreds = PadDigits(temp[1], 2);
	}
	
	if (minutes == 0) {
		formattedTime = seconds + "." + hundreds;
	} else {
		formattedTime = minutes + ":" + seconds + "." + hundreds;
	}
	
	return formattedTime;
}

function isInteger(val)
{
	for (var i=0;i<val.length;i++) {
		if (!isDigit(val.charAt(i))) {
			return false;
		}
	}

	return true;
}

function isDigit(num)
{
	if (num.length>1) {
		return false;
	}
	
	var string="1234567890";
	if (string.indexOf(num)!=-1) {
		return true;
	}
	return false;
}


function PadDigits(n, totalDigits) 
{ 
	n = n.toString(); 
	var pd = ''; 
	if (totalDigits > n.length) 
	{ 
		for (i=0; i < (totalDigits-n.length); i++) 
		{ 
			pd += '0'; 
		} 
	} 
	return pd + n.toString(); 
} 

//-->