<!-- 

//Percentage and rent calculation
function isBlank(aString) {
	var lString=" ";
	var TempChar;
	var Count;
	var SpacesOnly = 0;
	if (aString.length == 0||aString==""||aString==null)	{
		return(true);
	}

	for (Count=0; Count < aString.length; Count++)	{
		if(aString.charAt(Count) != lString)	{
			return(false);
		}
	}
	
	return(true);
}

function isValid(field, fieldName) {
  var lValue = field.value;
  if(isNaN(field.value) || isBlank(field.value) ) {
		alert("Please enter a numeric value for the field : " + fieldName);
		field.value = "";
		field.focus();
		return false;
  }	

  return true;
}

function stripBad(string) {
  for (var i=0, output='', valid="eE+/*-0123456789.()"; i<string.length; i++)
	 if (valid.indexOf(string.charAt(i)) != -1)
		output += string.charAt(i);
  return output;
}


// Racing Calculator
function CalculateRaceTime(aForm) {
	var lDist1 = (aForm.rdist.value)*1;
	var lDist2 = (aForm.prdist.value)*1;
	var lHour1 = (aForm.rhrs.value)*1;
	var lMin1 = (aForm.rmins.value)*1;
	var lSec1 = (aForm.rsecs.value)*1;
	var lMin2 = 0;
	var lHour2 = 0;
	var lTSecs = 0;	
	var lTSecsPerUnit = 0;
		
	var lDist1Unit = parseInt(aForm.rdisttype.value);
	var lDist2Unit = parseInt(aForm.prdisttype.value);
	
	if (lDist1Unit == '0' && lDist2Unit == '1') {
		lDist2 = milesToKilos(lDist2);
	}	else if (lDist1Unit == '1' && lDist2Unit == '0')	{
		lDist1 = milesToKilos(lDist1);
	}

	lTSecsPerUnit = lTSecs = lSec1*1 + (lMin1*1 + (lHour1 * 60)) * 60;
	lTSecs = Math.ceil(lTSecs * (Math.pow((lDist2 / lDist1), 1.06)));
	
	lTSecsPerUnit = Math.ceil(lTSecs/lDist2);

	var lTimeFormat = lBuildTime(lTSecs);
	aForm.prhrs.value = lTimeFormat.mHrs;
	aForm.prmins.value = lTimeFormat.mMins;	
	aForm.prsecs.value = lTimeFormat.mSecs;		
	
	lTimeFormat = lBuildTime(lTSecsPerUnit);
	aForm.tprmins.value = lTimeFormat.mMins;	
	aForm.tprsecs.value = lTimeFormat.mSecs;
	
	if (lDist1Unit == '0') 
		aForm.tprdist.value = "KM";	
	else
		aForm.tprdist.value = "Miles";	
}

function milesToKilos(aMiles) {
	return (Math.round(1.609 / 1 * aMiles * 1000)) / 1000;
}


function kilosToMiles(aKilos) {
	return (Math.round(1 / 1.609 * aKilos * 1000)) / 1000;
}

function pTimeFormat() {
	var mHrs;
	var mMins;
	var mSecs;
}

// buildTime(time)
// Return value: time (hh:mm:ss or mm:ss format)
// Takes a time in seconds and converts it to time in hh:mm:ss or mm:ss format
function lBuildTime(time) {
	var timeHour;
	var timeMin;
	var timeSec;
	var lString;

	timeSec = time;
	timeMin = Math.floor(timeSec / 60);
	timeSec = Math.round(timeSec - (timeMin * 60));
	
	if (timeSec < 10)
		timeSec = "0" + timeSec;
	
	timeHour = Math.floor(timeMin / 60);
	timeMin  = timeMin - (timeHour * 60);
	if (timeMin < 10)
		timeMin = "0" + timeMin;

	if (timeHour > 0)	{
		lString = timeHour + ":" + timeMin + ":" + timeSec;
	} else {
		lString = "00" + timeMin + ":" + timeSec;
	}
	
	var lTimeFormat = new pTimeFormat();
	
	lTimeFormat.mHrs = timeHour;
	lTimeFormat.mMins = timeMin;	
	lTimeFormat.mSecs = timeSec;		
	
	return lTimeFormat;
}


-->
